From 19c589edc2c1dd77550e26d4f5cf78ec772da337 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 31 Oct 2017 22:26:13 -0400 Subject: - Migrated the format of analysis nodes from a custom data-type, to just Code nodes. --- new-luxc/source/luxc/synthesizer/function.lux | 43 +++------------------------ 1 file changed, 4 insertions(+), 39 deletions(-) (limited to 'new-luxc/source/luxc/synthesizer/function.lux') diff --git a/new-luxc/source/luxc/synthesizer/function.lux b/new-luxc/source/luxc/synthesizer/function.lux index 4d9970a3f..52aee9a49 100644 --- a/new-luxc/source/luxc/synthesizer/function.lux +++ b/new-luxc/source/luxc/synthesizer/function.lux @@ -1,31 +1,8 @@ (;module: lux - (lux (data (coll [list "list/" Functor]))) (luxc (lang ["la" analysis] - ["ls" synthesis]))) - -(def: #export (environment scope) - (-> Scope (List ls;Variable)) - (|> scope - (get@ [#;captured #;mappings]) - (list/map (function [[_ _ ref]] - (case ref - (#;Local idx) - (nat-to-int idx) - - (#;Captured idx) - (|> idx n.inc nat-to-int (i.* -1)) - ))))) - -(do-template [ ] - [(def: #export ( var) - (-> ls;Variable Bool) - ( 0 var))] - - [self? i.=] - [local? i.>] - [captured? i.<] - ) + ["ls" synthesis] + [";L" variable #+ Variable]))) (do-template [ ] [(def: #export ( arity) @@ -37,27 +14,15 @@ ) (def: #export (adjust-var outer var) - (-> ls;Arity ls;Variable ls;Variable) + (-> ls;Arity Variable Variable) (|> outer n.dec nat-to-int (i.+ var))) -(def: #export (to-captured idx) - (-> Nat Int) - (|> idx n.inc nat-to-int (i.* -1))) - -(def: #export (captured-idx idx) - (-> Int Nat) - (|> idx (i.* -1) int-to-nat n.dec)) - -(def: #export (to-local idx) - (-> Nat Int) - (nat-to-int idx)) - (def: #export (unfold-apply apply) (-> la;Analysis [la;Analysis (List la;Analysis)]) (loop [apply apply args (list)] (case apply - (#la;Apply arg func) + (^code ("lux apply" (~ arg) (~ func))) (recur func (#;Cons arg args)) _ -- cgit v1.2.3