aboutsummaryrefslogtreecommitdiff
path: root/src/lux/analyser/base.clj
diff options
context:
space:
mode:
authorEduardo Julian2015-03-15 21:09:52 -0400
committerEduardo Julian2015-03-15 21:09:52 -0400
commitfc946bea579db293d1c9f00fb133f5bb329136d2 (patch)
tree0ae44401cc13ea1aec9a65d30a356ec5fcd483cb /src/lux/analyser/base.clj
parent15280d41e3ba7bb305cc259c7200723d3daf326c (diff)
[2nd Super Refactoring That Breaks The System: Part 1]
- Finishing implementing the type-system. - Migrating more of the data-structures used in the compiler to the ones used by Lux itself.
Diffstat (limited to 'src/lux/analyser/base.clj')
-rw-r--r--src/lux/analyser/base.clj14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/lux/analyser/base.clj b/src/lux/analyser/base.clj
index 66451e97b..43bcd1181 100644
--- a/src/lux/analyser/base.clj
+++ b/src/lux/analyser/base.clj
@@ -1,8 +1,10 @@
(ns lux.analyser.base
- (:require [clojure.core.match :refer [match]]
+ (:require [clojure.core.match :as M :refer [match matchv]]
+ clojure.core.match.array
(lux [base :as & :refer [exec return fail
try-all-m map-m mapcat-m reduce-m
- assert!]])))
+ assert!]]
+ [type :as &type])))
;; [Resources]
(defn expr-type [syntax+]
@@ -31,3 +33,11 @@
:else
(fail "[Analyser Error] Can't expand to other than 2 elements."))))
+
+(defn with-var [k]
+ (exec [=var &type/fresh-var
+ =ret (k =var)]
+ (match =ret
+ [::Expression ?expr ?type]
+ (exec [=type (&type/clean =var ?type)]
+ (return [::Expression ?expr =type])))))