diff options
author | Eduardo Julian | 2017-11-01 00:04:43 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-01 00:04:43 -0400 |
commit | 71d7a4c7206155e09f3e1e1d8699561ea6967382 (patch) | |
tree | 866b104d1552fe71ff52b0241f7e2fd260ff77bf /new-luxc/source/luxc/synthesizer | |
parent | 7cc935bd3d2e716bfeb006badeeaa8bb05927d11 (diff) |
- Re-organized synthesis.
Diffstat (limited to '')
-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 |
5 files changed, 14 insertions, 14 deletions
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 |