aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source
diff options
context:
space:
mode:
authorEduardo Julian2017-11-01 00:04:43 -0400
committerEduardo Julian2017-11-01 00:04:43 -0400
commit71d7a4c7206155e09f3e1e1d8699561ea6967382 (patch)
tree866b104d1552fe71ff52b0241f7e2fd260ff77bf /new-luxc/source
parent7cc935bd3d2e716bfeb006badeeaa8bb05927d11 (diff)
- Re-organized synthesis.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/eval.lux8
-rw-r--r--new-luxc/source/luxc/generator.lux10
-rw-r--r--new-luxc/source/luxc/generator/eval.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/expression.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/function.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/primitive.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/procedure/common.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/procedure/host.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/runtime.jvm.lux1
-rw-r--r--new-luxc/source/luxc/generator/structure.jvm.lux1
-rw-r--r--new-luxc/source/luxc/lang/synthesis/case.lux (renamed from new-luxc/source/luxc/synthesizer/case.lux)0
-rw-r--r--new-luxc/source/luxc/lang/synthesis/expression.lux (renamed from new-luxc/source/luxc/synthesizer.lux)28
-rw-r--r--new-luxc/source/luxc/lang/synthesis/function.lux (renamed from new-luxc/source/luxc/synthesizer/function.lux)0
-rw-r--r--new-luxc/source/luxc/lang/synthesis/loop.lux (renamed from new-luxc/source/luxc/synthesizer/loop.lux)0
-rw-r--r--new-luxc/source/luxc/lang/synthesis/variable.lux (renamed from new-luxc/source/luxc/synthesizer/variable.lux)0
15 files changed, 23 insertions, 31 deletions
diff --git a/new-luxc/source/luxc/eval.lux b/new-luxc/source/luxc/eval.lux
index fdbf8e781..baac56c64 100644
--- a/new-luxc/source/luxc/eval.lux
+++ b/new-luxc/source/luxc/eval.lux
@@ -2,10 +2,10 @@
lux
(lux (control [monad #+ do])
[meta])
- (luxc (lang (analysis [";A" expression])))
+ (luxc (lang (analysis [";A" expression])
+ (synthesis [";S" expression])))
[../base]
- (.. [synthesizer]
- (generator [";G" expression]
+ (.. (generator [";G" expression]
[eval])))
(def: #export (eval type exprC)
@@ -13,6 +13,6 @@
(do meta;Monad<Meta>
[exprA (../base;with-expected-type type
(expressionA;analyser eval exprC))
- #let [exprS (synthesizer;synthesize exprA)]
+ #let [exprS (expressionS;synthesize exprA)]
exprI (expressionG;generate exprS)]
(eval;eval exprI)))
diff --git a/new-luxc/source/luxc/generator.lux b/new-luxc/source/luxc/generator.lux
index e4d4317fe..e9b6c4d3f 100644
--- a/new-luxc/source/luxc/generator.lux
+++ b/new-luxc/source/luxc/generator.lux
@@ -14,11 +14,11 @@
[";L" host]
["&;" io]
["&;" module]
- ["&;" synthesizer]
["&;" eval]
(lang ["&;" syntax]
(analysis [";A" expression]
- [";A" common]))
+ [";A" common])
+ (synthesis [";S" expression]))
(generator ["&&;" runtime]
["&&;" statement]
["&&;" common]
@@ -41,7 +41,7 @@
[[_ metaA] (&;with-scope
(&;with-expected-type Code
(analyse metaC)))
- metaI (expressionG;generate (&synthesizer;synthesize metaA))
+ metaI (expressionG;generate (expressionS;synthesize metaA))
metaV (&&eval;eval metaI)
[_ valueT valueA] (&;with-scope
(if (meta;type? (:! Code metaV))
@@ -51,7 +51,7 @@
(wrap [Type valueA])))
(commonA;with-unknown-type
(analyse valueC))))
- valueI (expressionG;generate (&synthesizer;synthesize valueA))
+ valueI (expressionG;generate (expressionS;synthesize valueA))
_ (&;with-scope
(&&statement;generate-def def-name valueT valueI metaI (:! Code metaV)))]
(wrap []))
@@ -63,7 +63,7 @@
[[_ programA] (&;with-scope
(&;with-expected-type (type (io;IO Unit))
(analyse programC)))
- programI (expressionG;generate (&synthesizer;synthesize programA))]
+ programI (expressionG;generate (expressionS;synthesize programA))]
(&&statement;generate-program program-args programI))
_
diff --git a/new-luxc/source/luxc/generator/eval.jvm.lux b/new-luxc/source/luxc/generator/eval.jvm.lux
index 86bede8cd..2f0ce1c24 100644
--- a/new-luxc/source/luxc/generator/eval.jvm.lux
+++ b/new-luxc/source/luxc/generator/eval.jvm.lux
@@ -12,7 +12,6 @@
["$i" inst]))
(lang ["la" analysis]
["ls" synthesis])
- ["&;" synthesizer]
(generator ["&;" common])
))
diff --git a/new-luxc/source/luxc/generator/expression.jvm.lux b/new-luxc/source/luxc/generator/expression.jvm.lux
index e0f95b48b..798998510 100644
--- a/new-luxc/source/luxc/generator/expression.jvm.lux
+++ b/new-luxc/source/luxc/generator/expression.jvm.lux
@@ -11,7 +11,6 @@
(host ["$" jvm])
(lang ["ls" synthesis]
[";L" variable #+ Variable Register])
- ["&;" synthesizer]
(generator ["&;" common]
["&;" primitive]
["&;" structure]
diff --git a/new-luxc/source/luxc/generator/function.jvm.lux b/new-luxc/source/luxc/generator/function.jvm.lux
index 70b892d41..310f4d7a0 100644
--- a/new-luxc/source/luxc/generator/function.jvm.lux
+++ b/new-luxc/source/luxc/generator/function.jvm.lux
@@ -13,7 +13,6 @@
(lang ["la" analysis]
["ls" synthesis]
[";L" variable #+ Variable])
- ["&;" synthesizer]
(generator ["&;" common]
["&;" runtime])))
diff --git a/new-luxc/source/luxc/generator/primitive.jvm.lux b/new-luxc/source/luxc/generator/primitive.jvm.lux
index f772383d1..637f46a85 100644
--- a/new-luxc/source/luxc/generator/primitive.jvm.lux
+++ b/new-luxc/source/luxc/generator/primitive.jvm.lux
@@ -10,7 +10,6 @@
["$t" type]))
(lang ["la" analysis]
["ls" synthesis])
- ["&;" synthesizer]
(generator ["&;" common]))
[../runtime])
diff --git a/new-luxc/source/luxc/generator/procedure/common.jvm.lux b/new-luxc/source/luxc/generator/procedure/common.jvm.lux
index a8fa81f81..dffbcb64e 100644
--- a/new-luxc/source/luxc/generator/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/generator/procedure/common.jvm.lux
@@ -17,7 +17,6 @@
["$i" inst]))
(lang ["la" analysis]
["ls" synthesis])
- ["&;" synthesizer]
(generator ["&;" common]
["&;" runtime])))
diff --git a/new-luxc/source/luxc/generator/procedure/host.jvm.lux b/new-luxc/source/luxc/generator/procedure/host.jvm.lux
index 97c8fb87e..9222b2e4a 100644
--- a/new-luxc/source/luxc/generator/procedure/host.jvm.lux
+++ b/new-luxc/source/luxc/generator/procedure/host.jvm.lux
@@ -23,7 +23,6 @@
(lang ["la" analysis]
(analysis (procedure ["&;" host]))
["ls" synthesis])
- ["&;" synthesizer]
(generator ["&;" common]
["&;" runtime]))
["@" ../common])
diff --git a/new-luxc/source/luxc/generator/runtime.jvm.lux b/new-luxc/source/luxc/generator/runtime.jvm.lux
index fd8fbf74a..4b57e802e 100644
--- a/new-luxc/source/luxc/generator/runtime.jvm.lux
+++ b/new-luxc/source/luxc/generator/runtime.jvm.lux
@@ -14,7 +14,6 @@
["$i" inst]))
(lang ["la" analysis]
["ls" synthesis])
- ["&;" synthesizer]
(generator ["&;" common])))
(host;import java.lang.Object)
diff --git a/new-luxc/source/luxc/generator/structure.jvm.lux b/new-luxc/source/luxc/generator/structure.jvm.lux
index b9dced077..96d5767c6 100644
--- a/new-luxc/source/luxc/generator/structure.jvm.lux
+++ b/new-luxc/source/luxc/generator/structure.jvm.lux
@@ -13,7 +13,6 @@
["$i" inst]))
(lang ["la" analysis]
["ls" synthesis])
- ["&;" synthesizer]
(generator ["&;" common]))
[../runtime])
diff --git a/new-luxc/source/luxc/synthesizer/case.lux b/new-luxc/source/luxc/lang/synthesis/case.lux
index 15cb6eca3..15cb6eca3 100644
--- a/new-luxc/source/luxc/synthesizer/case.lux
+++ b/new-luxc/source/luxc/lang/synthesis/case.lux
diff --git a/new-luxc/source/luxc/synthesizer.lux b/new-luxc/source/luxc/lang/synthesis/expression.lux
index c43958890..05b99923b 100644
--- a/new-luxc/source/luxc/synthesizer.lux
+++ b/new-luxc/source/luxc/lang/synthesis/expression.lux
@@ -13,10 +13,10 @@
(luxc ["&" base]
(lang ["la" analysis]
["ls" synthesis]
+ (synthesis [";S" case]
+ [";S" function]
+ [";S" loop])
[";L" variable #+ Variable])
- (synthesizer ["&&;" case]
- ["&&;" function]
- ["&&;" loop])
))
(def: init-env (List Variable) (list))
@@ -24,9 +24,9 @@
(def: (prepare-body inner-arity arity body)
(-> Nat Nat ls;Synthesis ls;Synthesis)
- (if (&&function;nested? inner-arity)
+ (if (functionS;nested? inner-arity)
body
- (&&loop;reify-recursion arity body)))
+ (loopS;reify-recursion arity body)))
(def: (let$ register inputS bodyS)
(-> Nat ls;Synthesis ls;Synthesis ls;Synthesis)
@@ -84,10 +84,10 @@
(function [pattern expr]
(|> (synthesize expr)
(~) ("lux case exec")
- ("lux case seq" (~ (&&case;path pattern)))
+ ("lux case seq" (~ (caseS;path pattern)))
(`))))]
(` ("lux case" (~ inputS)
- (~ (list/fold &&case;weave
+ (~ (list/fold caseS;weave
(transform-branch lastP lastA)
(list/map (product;uncurry transform-branch) prevsPA))))))
@@ -97,19 +97,19 @@
(def: (synthesize-apply synthesize outer-arity num-locals exprA)
(-> (-> la;Analysis ls;Synthesis) ls;Arity Nat la;Analysis ls;Synthesis)
- (let [[funcA argsA] (&&function;unfold-apply exprA)
+ (let [[funcA argsA] (functionS;unfold-apply exprA)
funcS (synthesize funcA)
argsS (list/map synthesize argsA)]
(case funcS
(^multi (^ [_ (#;Form (list [_ (#;Text "lux function")] [_ (#;Nat _arity)] [_ (#;Tuple _env)] _bodyS))])
(and (n.= _arity (list;size argsS))
- (not (&&loop;contains-self-reference? _bodyS)))
+ (not (loopS;contains-self-reference? _bodyS)))
[(s;run _env (p;some s;int)) (#e;Success _env)])
- (let [register-offset (if (&&function;top? outer-arity)
+ (let [register-offset (if (functionS;top? outer-arity)
num-locals
(|> outer-arity n.inc (n.+ num-locals)))]
(` ("lux loop" (~ (code;nat register-offset)) [(~@ argsS)]
- (~ (&&loop;adjust _env register-offset _bodyS)))))
+ (~ (loopS;adjust _env register-offset _bodyS)))))
(^ [_ (#;Form (list& [_ (#;Text "lux call")] funcS' argsS'))])
(call$ funcS' (list/compose argsS' argsS))
@@ -135,11 +135,11 @@
(^code ((~ [_ (#;Int var)])))
(if (variableL;local? var)
(let [register (variableL;local-register var)]
- (if (&&function;nested? outer-arity)
+ (if (functionS;nested? outer-arity)
(if (n.= +0 register)
(call$ (var$ 0) (|> (list;n.range +1 (n.dec outer-arity))
(list/map (|>. variableL;local code;int (~) () (`)))))
- (var$ (&&function;adjust-var outer-arity (variableL;local register))))
+ (var$ (functionS;adjust-var outer-arity (variableL;local register))))
(var$ (variableL;local register))))
(let [register (variableL;captured-register var)]
(var$ (let [var (variableL;captured register)]
@@ -157,7 +157,7 @@
(case env-size
+0 (list)
_ (list/map variableL;captured (list;n.range +0 (n.dec env-size))))))
- resolver' (if (&&function;nested? inner-arity)
+ resolver' (if (functionS;nested? inner-arity)
(list/fold (function [[from to] resolver']
(dict;put from to resolver'))
init-resolver
diff --git a/new-luxc/source/luxc/synthesizer/function.lux b/new-luxc/source/luxc/lang/synthesis/function.lux
index 52aee9a49..52aee9a49 100644
--- a/new-luxc/source/luxc/synthesizer/function.lux
+++ b/new-luxc/source/luxc/lang/synthesis/function.lux
diff --git a/new-luxc/source/luxc/synthesizer/loop.lux b/new-luxc/source/luxc/lang/synthesis/loop.lux
index 0070fcd5d..0070fcd5d 100644
--- a/new-luxc/source/luxc/synthesizer/loop.lux
+++ b/new-luxc/source/luxc/lang/synthesis/loop.lux
diff --git a/new-luxc/source/luxc/synthesizer/variable.lux b/new-luxc/source/luxc/lang/synthesis/variable.lux
index 3ce9f2678..3ce9f2678 100644
--- a/new-luxc/source/luxc/synthesizer/variable.lux
+++ b/new-luxc/source/luxc/lang/synthesis/variable.lux