diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/synthesis/expression.lux (renamed from new-luxc/source/luxc/synthesizer.lux) | 28 |
1 files changed, 14 insertions, 14 deletions
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 |