diff options
author | Eduardo Julian | 2015-03-20 23:52:07 -0400 |
---|---|---|
committer | Eduardo Julian | 2015-03-20 23:52:07 -0400 |
commit | 25be66a8a58b202284152d5a422d13fb81661abb (patch) | |
tree | d122524b87d875560064e463de9c45d26b923415 /src/lux/analyser/base.clj | |
parent | b2f4b64467d49904509fd5e87735536f846121b2 (diff) |
[2nd Super Refactoring That Breaks The System: Part 6]
- Corrected more bugs in the system.
Diffstat (limited to 'src/lux/analyser/base.clj')
-rw-r--r-- | src/lux/analyser/base.clj | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/src/lux/analyser/base.clj b/src/lux/analyser/base.clj index 256acd346..f67b7e281 100644 --- a/src/lux/analyser/base.clj +++ b/src/lux/analyser/base.clj @@ -7,30 +7,34 @@ ;; [Resources] (defn expr-type [syntax+] ;; (prn 'expr-type syntax+) + ;; (prn 'expr-type (aget syntax+ 0)) (matchv ::M/objects [syntax+] [["Expression" [_ type]]] - (return type) - - [_] - (fail (str "[Analyser Error] Can't retrieve the type of a non-expression: " (pr-str syntax+))))) + (do ;; (prn 'expr-type (&type/show-type type)) + (return type)) + + [["Statement" _]] + (fail (str "[Analyser Error] Can't retrieve the type of a statement: " (pr-str syntax+))))) (defn analyse-1 [analyse elem] (exec [output (analyse elem)] - (matchv ::M/objects [output] - [["Cons" [x ["Nil" _]]]] - (return x) + (do ;; (prn 'analyse-1 (aget output 0)) + (matchv ::M/objects [output] + [["Cons" [x ["Nil" _]]]] + (return x) - [_] - (fail "[Analyser Error] Can't expand to other than 1 element.")))) + [_] + (fail "[Analyser Error] Can't expand to other than 1 element."))))) (defn analyse-2 [analyse el1 el2] - (exec [output (&/flat-map analyse (list el1 el2))] - (matchv ::M/objects [output] - [["Cons" [x ["Cons" [y ["Nil" _]]]]]] - (return [x y]) + (exec [output (&/flat-map% analyse (&/|list el1 el2))] + (do ;; (prn 'analyse-2 (aget output 0)) + (matchv ::M/objects [output] + [["Cons" [x ["Cons" [y ["Nil" _]]]]]] + (return [x y]) - [_] - (fail "[Analyser Error] Can't expand to other than 2 elements.")))) + [_] + (fail "[Analyser Error] Can't expand to other than 2 elements."))))) (defn with-var [k] (exec [=var &type/fresh-var |