From 50cc5fbe7cc8abde05085944393fcec4c791402f Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 5 Sep 2017 18:36:09 -0400 Subject: - Updated new compiler's code to the recent changes in the language. - WIP: Some other changes/additions to the new compiler. --- new-luxc/source/luxc/analyser/procedure/common.lux | 90 +++++++++++----------- 1 file changed, 45 insertions(+), 45 deletions(-) (limited to 'new-luxc/source/luxc/analyser/procedure') diff --git a/new-luxc/source/luxc/analyser/procedure/common.lux b/new-luxc/source/luxc/analyser/procedure/common.lux index 1976d266d..0ba35a82e 100644 --- a/new-luxc/source/luxc/analyser/procedure/common.lux +++ b/new-luxc/source/luxc/analyser/procedure/common.lux @@ -1,6 +1,6 @@ (;module: lux - (lux (control monad) + (lux (control [monad #+ do]) (concurrency ["A" atom]) (data [text] text/format @@ -39,11 +39,11 @@ (let [num-actual (list;size args)] (if (n.= num-expected num-actual) (do Monad - [argsA (mapM @ - (function [[argT argC]] - (&;with-expected-type argT - (analyse argC))) - (list;zip2 input-types args)) + [argsA (monad;map @ + (function [[argT argC]] + (&;with-expected-type argT + (analyse argC))) + (list;zip2 input-types args)) expected macro;expected-type _ (&;within-type-env (TC;check expected output-type))] @@ -156,7 +156,7 @@ (install "int min" (special-value Int)) (install "int max" (special-value Int)) (install "int to-nat" (converter Int Nat)) - (install "int to-real" (converter Int Real)))) + (install "int to-frac" (converter Int Frac)))) (def: deg-procs Bundle @@ -172,28 +172,28 @@ (install "deg reciprocal" (binary-operation Deg Nat Deg)) (install "deg min" (special-value Deg)) (install "deg max" (special-value Deg)) - (install "deg to-real" (converter Deg Real)))) + (install "deg to-frac" (converter Deg Frac)))) -(def: real-procs +(def: frac-procs Bundle (|> (D;new text;Hash) - (install "real +" (binary-operation Real Real Real)) - (install "real -" (binary-operation Real Real Real)) - (install "real *" (binary-operation Real Real Real)) - (install "real /" (binary-operation Real Real Real)) - (install "real %" (binary-operation Real Real Real)) - (install "real =" (binary-operation Real Real Bool)) - (install "real <" (binary-operation Real Real Bool)) - (install "real smallest" (special-value Real)) - (install "real min" (special-value Real)) - (install "real max" (special-value Real)) - (install "real not-a-number" (special-value Real)) - (install "real positive-infinity" (special-value Real)) - (install "real negative-infinity" (special-value Real)) - (install "real to-deg" (converter Real Deg)) - (install "real to-int" (converter Real Int)) - (install "real to-text" (converter Real Text)) - (install "real from-text" (converter Text (type (Maybe Real)))))) + (install "frac +" (binary-operation Frac Frac Frac)) + (install "frac -" (binary-operation Frac Frac Frac)) + (install "frac *" (binary-operation Frac Frac Frac)) + (install "frac /" (binary-operation Frac Frac Frac)) + (install "frac %" (binary-operation Frac Frac Frac)) + (install "frac =" (binary-operation Frac Frac Bool)) + (install "frac <" (binary-operation Frac Frac Bool)) + (install "frac smallest" (special-value Frac)) + (install "frac min" (special-value Frac)) + (install "frac max" (special-value Frac)) + (install "frac not-a-number" (special-value Frac)) + (install "frac positive-infinity" (special-value Frac)) + (install "frac negative-infinity" (special-value Frac)) + (install "frac to-deg" (converter Frac Deg)) + (install "frac to-int" (converter Frac Int)) + (install "frac encode" (converter Frac Text)) + (install "frac decode" (converter Text (type (Maybe Frac)))))) (def: text-procs Bundle @@ -246,24 +246,24 @@ (def: math-procs Bundle (|> (D;new text;Hash) - (install "math cos" (unary-operation Real Real)) - (install "math sin" (unary-operation Real Real)) - (install "math tan" (unary-operation Real Real)) - (install "math acos" (unary-operation Real Real)) - (install "math asin" (unary-operation Real Real)) - (install "math atan" (unary-operation Real Real)) - (install "math cosh" (unary-operation Real Real)) - (install "math sinh" (unary-operation Real Real)) - (install "math tanh" (unary-operation Real Real)) - (install "math exp" (unary-operation Real Real)) - (install "math log" (unary-operation Real Real)) - (install "math root2" (unary-operation Real Real)) - (install "math root3" (unary-operation Real Real)) - (install "math ceil" (unary-operation Real Real)) - (install "math floor" (unary-operation Real Real)) - (install "math round" (unary-operation Real Real)) - (install "math atan2" (binary-operation Real Real Real)) - (install "math pow" (binary-operation Real Real Real)) + (install "math cos" (unary-operation Frac Frac)) + (install "math sin" (unary-operation Frac Frac)) + (install "math tan" (unary-operation Frac Frac)) + (install "math acos" (unary-operation Frac Frac)) + (install "math asin" (unary-operation Frac Frac)) + (install "math atan" (unary-operation Frac Frac)) + (install "math cosh" (unary-operation Frac Frac)) + (install "math sinh" (unary-operation Frac Frac)) + (install "math tanh" (unary-operation Frac Frac)) + (install "math exp" (unary-operation Frac Frac)) + (install "math log" (unary-operation Frac Frac)) + (install "math root2" (unary-operation Frac Frac)) + (install "math root3" (unary-operation Frac Frac)) + (install "math ceil" (unary-operation Frac Frac)) + (install "math floor" (unary-operation Frac Frac)) + (install "math round" (unary-operation Frac Frac)) + (install "math atan2" (binary-operation Frac Frac Frac)) + (install "math pow" (binary-operation Frac Frac Frac)) )) (def: (analyse-atom-new proc) @@ -326,7 +326,7 @@ (D;merge nat-procs) (D;merge int-procs) (D;merge deg-procs) - (D;merge real-procs) + (D;merge frac-procs) (D;merge text-procs) (D;merge array-procs) (D;merge math-procs) -- cgit v1.2.3