diff options
author | Eduardo Julian | 2015-03-18 00:42:02 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-03-18 00:42:02 -0400 |
commit | 17c482dcbd49294a8d6e995ab6878445330b216c (patch) | |
tree | 7387dfe73a81e7dd6ee708cbed6fa8025896dc68 /src/lux/analyser/base.clj | |
parent | ee0ed41d8efa0b733961dfb2cd8b7ad6054f97e7 (diff) |
[2nd Super Refactoring That Breaks The System: Part 3]
- Migrated more of the compiler's data-structures to using Lux's format.
Diffstat (limited to 'src/lux/analyser/base.clj')
-rw-r--r-- | src/lux/analyser/base.clj | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/lux/analyser/base.clj b/src/lux/analyser/base.clj index 43bcd1181..b2ec4d0c5 100644 --- a/src/lux/analyser/base.clj +++ b/src/lux/analyser/base.clj @@ -9,35 +9,35 @@ ;; [Resources] (defn expr-type [syntax+] ;; (prn 'expr-type syntax+) - (match syntax+ - [::Expression _ type] + (matchv ::M/objects [syntax+] + [["Expression" [_ type]]] (return type) - _ + [_] (fail (str "[Analyser Error] Can't retrieve the type of a non-expression: " (pr-str syntax+))))) (defn analyse-1 [analyse elem] (exec [output (analyse elem)] - (match output - ([x] :seq) + (matchv ::M/objects [output] + ["Cons" [x ["Nil" _]]] (return x) - :else + [_] (fail "[Analyser Error] Can't expand to other than 1 element.")))) (defn analyse-2 [analyse el1 el2] (exec [output (mapcat-m analyse (list el1 el2))] (match output - ([x y] :seq) + ["Cons" [x ["Cons" [y ["Nil" _]]]]] (return [x y]) - :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] + (matchv ::M/objects [=ret] + [["Expression" [?expr ?type]]] (exec [=type (&type/clean =var ?type)] - (return [::Expression ?expr =type]))))) + (return (&/V "Expression" (&/T ?expr =type))))))) |