diff options
author | Eduardo Julian | 2017-09-05 18:36:09 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-09-05 18:36:09 -0400 |
commit | 50cc5fbe7cc8abde05085944393fcec4c791402f (patch) | |
tree | da706b648b3bb5e0485475a81d5b4da242aa04f5 /new-luxc/source/luxc/analyser/procedure | |
parent | 3add4d6996591897020236b5581f6ca21d4c2af8 (diff) |
- Updated new compiler's code to the recent changes in the language.
- WIP: Some other changes/additions to the new compiler.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/analyser/procedure.lux | 6 | ||||
-rw-r--r-- | new-luxc/source/luxc/analyser/procedure/common.lux | 90 |
2 files changed, 48 insertions, 48 deletions
diff --git a/new-luxc/source/luxc/analyser/procedure.lux b/new-luxc/source/luxc/analyser/procedure.lux index d8778844f..06ea7c324 100644 --- a/new-luxc/source/luxc/analyser/procedure.lux +++ b/new-luxc/source/luxc/analyser/procedure.lux @@ -1,10 +1,10 @@ (;module: lux - (lux (control monad) + (lux (control [monad #+ do]) (data [text] text/format (coll ["D" dict]) - maybe)) + [maybe])) (luxc ["&" base] (lang ["la" analysis #+ Analysis])) (. ["&&;" common])) @@ -12,6 +12,6 @@ (def: #export (analyse-procedure analyse proc-name proc-args) (-> &;Analyser Text (List Code) (Lux Analysis)) (default (&;fail (format "Unknown procedure: " (%t proc-name))) - (do Monad<Maybe> + (do maybe;Monad<Maybe> [proc (D;get proc-name &&common;procedures)] (wrap (proc analyse proc-args))))) 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<Lux> - [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<Text>) - (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<Text>) - (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) |