aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/synthesizer.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-05-09 17:48:27 -0400
committerEduardo Julian2017-05-09 17:48:27 -0400
commitdd5220e13b03c8f85972feac535a34ef64525222 (patch)
tree2ac08a118eaa63f11c2397a08eaca74d199f2d1e /new-luxc/source/luxc/synthesizer.lux
parent7b74c1258f345d576b0c798303b0ed28f1734368 (diff)
- Added tests for some kinds of analysis.
- WIP: Porting more code.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/synthesizer.lux39
1 files changed, 36 insertions, 3 deletions
diff --git a/new-luxc/source/luxc/synthesizer.lux b/new-luxc/source/luxc/synthesizer.lux
index 900c16e05..c0aaec6ad 100644
--- a/new-luxc/source/luxc/synthesizer.lux
+++ b/new-luxc/source/luxc/synthesizer.lux
@@ -1,12 +1,45 @@
(;module:
lux
(lux (control monad)
- (data text/format)
+ (data text/format
+ (coll [list "L/" Functor<List>]))
[macro #+ Monad<Lux>])
(luxc ["&" base]
- lang
+ (lang ["la" analysis #+ Analysis]
+ ["ls" synthesis #+ Synthesis])
["&;" analyser]))
(def: #export (synthesize analysis)
(-> Analysis Synthesis)
- (undefined))
+ (case analysis
+ (^template [<from> <to>]
+ [meta (<from> value)]
+ (<to> value))
+ ([#la;Unit #ls;Unit]
+ [#la;Bool #ls;Bool]
+ [#la;Nat #ls;Nat]
+ [#la;Int #ls;Int]
+ [#la;Deg #ls;Deg]
+ [#la;Real #ls;Real]
+ [#la;Char #ls;Char]
+ [#la;Text #ls;Text]
+ [#la;Relative #ls;Relative]
+ [#la;Absolute #ls;Absolute])
+
+ [meta (#la;Tuple values)]
+ (#ls;Tuple (L/map synthesize values))
+
+ [meta (#la;Variant tag last? value)]
+ (#ls;Variant tag last? (synthesize value))
+
+ [meta (#la;Function scope body)]
+ (#ls;Function scope (synthesize body))
+
+ [meta (#la;Call func args)]
+ (#ls;Call (synthesize func) (L/map synthesize args))
+
+ [meta (#la;Procedure name args)]
+ (#ls;Procedure name (L/map synthesize args))
+
+ [meta (#la;Case pattern)]
+ (undefined)))