From 54815ade282ff4feb81d7d557188bde8111db376 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 5 Oct 2017 00:17:51 -0400 Subject: - Added tests for type-checking and type-coercion. - Implemented "eval". - Fixed bugs when analysing variants and tuples. --- new-luxc/source/luxc/analyser.lux | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'new-luxc/source/luxc/analyser.lux') diff --git a/new-luxc/source/luxc/analyser.lux b/new-luxc/source/luxc/analyser.lux index 3272057f2..f17ec8496 100644 --- a/new-luxc/source/luxc/analyser.lux +++ b/new-luxc/source/luxc/analyser.lux @@ -76,16 +76,12 @@ body))) (&&function;analyse-function analyse func-name arg-name body) - (^ (#;Form (list [_ (#;Symbol ["" "_lux_check"])] - type - value))) - (&&type;analyse-check analyse eval type value) - - (^ (#;Form (list [_ (#;Symbol ["" "_lux_coerce"])] - type - value))) - (&&type;analyse-coerce analyse eval type value) - + (^template [ ] + (^ (#;Form (list [_ (#;Symbol ["" ])] type value))) + ( analyse eval type value)) + (["_lux_check" &&type;analyse-check] + ["_lux_coerce" &&type;analyse-coerce]) + (^ (#;Form (list& [_ (#;Text proc-name)] proc-args))) (&&procedure;analyse-procedure analyse proc-name proc-args) @@ -96,13 +92,17 @@ [paired (to-branches branches)] (&&case;analyse-case analyse input paired)) - (^ (#;Form (list [_ (#;Nat tag)] - value))) - (&&structure;analyse-sum analyse tag value) + (^template [ ] + (^ (#;Form (list& [_ ( tag)] + values))) + (case values + (#;Cons value #;Nil) + ( analyse tag value) - (^ (#;Form (list [_ (#;Tag tag)] - value))) - (&&structure;analyse-tagged-sum analyse tag value) + _ + ( analyse tag (` [(~@ values)])))) + ([#;Nat &&structure;analyse-sum] + [#;Tag &&structure;analyse-tagged-sum]) (^ (#;Form (list& func args))) (do Monad -- cgit v1.2.3