From 4433c9bcd6c6cac44c018aad2e21a5b4d7cc4896 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 29 Nov 2017 22:49:56 -0400 Subject: - Adapted main codebase to the latest syntatic changes. --- new-luxc/source/luxc/lang/synthesis/loop.lux | 118 +++++++++++++-------------- 1 file changed, 59 insertions(+), 59 deletions(-) (limited to 'new-luxc/source/luxc/lang/synthesis/loop.lux') diff --git a/new-luxc/source/luxc/lang/synthesis/loop.lux b/new-luxc/source/luxc/lang/synthesis/loop.lux index a5da743d5..0510e2377 100644 --- a/new-luxc/source/luxc/lang/synthesis/loop.lux +++ b/new-luxc/source/luxc/lang/synthesis/loop.lux @@ -1,4 +1,4 @@ -(;module: +(.module: lux (lux (control [monad #+ do] ["p" parser]) @@ -7,101 +7,101 @@ (macro [code] [syntax])) (luxc (lang ["ls" synthesis] - [";L" variable #+ Variable Register]))) + [".L" variable #+ Variable Register]))) (def: #export (contains-self-reference? exprS) - (-> ls;Synthesis Bool) + (-> ls.Synthesis Bool) (case exprS - (^ [_ (#;Form (list [_ (#;Nat tag)] [_ (#;Bool last?)] memberS))]) + (^ [_ (#.Form (list [_ (#.Nat tag)] [_ (#.Bool last?)] memberS))]) (contains-self-reference? memberS) - [_ (#;Tuple membersS)] - (list;any? contains-self-reference? membersS) + [_ (#.Tuple membersS)] + (list.any? contains-self-reference? membersS) - (^ [_ (#;Form (list [_ (#;Int var)]))]) - (variableL;self? var) + (^ [_ (#.Form (list [_ (#.Int var)]))]) + (variableL.self? var) - (^ [_ (#;Form (list [_ (#;Text "lux case")] inputS pathS))]) + (^ [_ (#.Form (list [_ (#.Text "lux case")] inputS pathS))]) (or (contains-self-reference? inputS) (loop [pathS pathS] (case pathS - (^or (^ [_ (#;Form (list [_ (#;Text "lux case alt")] leftS rightS))]) - (^ [_ (#;Form (list [_ (#;Text "lux case seq")] leftS rightS))])) + (^or (^ [_ (#.Form (list [_ (#.Text "lux case alt")] leftS rightS))]) + (^ [_ (#.Form (list [_ (#.Text "lux case seq")] leftS rightS))])) (or (recur leftS) (recur rightS)) - (^ [_ (#;Form (list [_ (#;Text "lux case exec")] bodyS))]) + (^ [_ (#.Form (list [_ (#.Text "lux case exec")] bodyS))]) (contains-self-reference? bodyS) _ false))) - (^ [_ (#;Form (list [_ (#;Text "lux function")] arity [_ (#;Tuple environment)] bodyS))]) - (list;any? (function [captured] + (^ [_ (#.Form (list [_ (#.Text "lux function")] arity [_ (#.Tuple environment)] bodyS))]) + (list.any? (function [captured] (case captured - (^ [_ (#;Form (list [_ (#;Int var)]))]) - (variableL;self? var) + (^ [_ (#.Form (list [_ (#.Int var)]))]) + (variableL.self? var) _ false)) environment) - (^ [_ (#;Form (list& [_ (#;Text "lux call")] funcS argsS))]) + (^ [_ (#.Form (list& [_ (#.Text "lux call")] funcS argsS))]) (or (contains-self-reference? funcS) - (list;any? contains-self-reference? argsS)) + (list.any? contains-self-reference? argsS)) - (^ [_ (#;Form (list [_ (#;Text "lux let")] register inputS bodyS))]) + (^ [_ (#.Form (list [_ (#.Text "lux let")] register inputS bodyS))]) (or (contains-self-reference? inputS) (contains-self-reference? bodyS)) - (^ [_ (#;Form (list [_ (#;Text "lux if")] inputS thenS elseS))]) + (^ [_ (#.Form (list [_ (#.Text "lux if")] inputS thenS elseS))]) (or (contains-self-reference? inputS) (contains-self-reference? thenS) (contains-self-reference? elseS)) - (^ [_ (#;Form (list [_ (#;Text "lux loop")] offset [_ (#;Tuple initsS)] bodyS))]) - (or (list;any? contains-self-reference? initsS) + (^ [_ (#.Form (list [_ (#.Text "lux loop")] offset [_ (#.Tuple initsS)] bodyS))]) + (or (list.any? contains-self-reference? initsS) (contains-self-reference? bodyS)) - (^or (^ [_ (#;Form (list& [_ (#;Text "lux recur")] argsS))]) - (^ [_ (#;Form (list& [_ (#;Text procedure)] argsS))])) - (list;any? contains-self-reference? argsS) + (^or (^ [_ (#.Form (list& [_ (#.Text "lux recur")] argsS))]) + (^ [_ (#.Form (list& [_ (#.Text procedure)] argsS))])) + (list.any? contains-self-reference? argsS) _ false )) (def: #export (reify-recursion arity exprS) - (-> Nat ls;Synthesis ls;Synthesis) + (-> Nat ls.Synthesis ls.Synthesis) (loop [exprS exprS] (case exprS - (^ [_ (#;Form (list [_ (#;Text "lux case")] inputS pathS))]) + (^ [_ (#.Form (list [_ (#.Text "lux case")] inputS pathS))]) (` ("lux case" (~ inputS) (~ (let [reify-recursion' recur] (loop [pathS pathS] (case pathS - (^ [_ (#;Form (list [_ (#;Text "lux case alt")] leftS rightS))]) + (^ [_ (#.Form (list [_ (#.Text "lux case alt")] leftS rightS))]) (` ("lux case alt" (~ (recur leftS)) (~ (recur rightS)))) - (^ [_ (#;Form (list [_ (#;Text "lux case seq")] leftS rightS))]) + (^ [_ (#.Form (list [_ (#.Text "lux case seq")] leftS rightS))]) (` ("lux case seq" (~ leftS) (~ (recur rightS)))) - (^ [_ (#;Form (list [_ (#;Text "lux case exec")] bodyS))]) + (^ [_ (#.Form (list [_ (#.Text "lux case exec")] bodyS))]) (` ("lux case exec" (~ (reify-recursion' bodyS)))) _ pathS)))))) - (^multi (^ [_ (#;Form (list& [_ (#;Text "lux call")] - [_ (#;Form (list [_ (#;Int 0)]))] + (^multi (^ [_ (#.Form (list& [_ (#.Text "lux call")] + [_ (#.Form (list [_ (#.Int 0)]))] argsS))]) - (n.= arity (list;size argsS))) + (n/= arity (list.size argsS))) (` ("lux recur" (~@ argsS))) - (^ [_ (#;Form (list [_ (#;Text "lux let")] register inputS bodyS))]) + (^ [_ (#.Form (list [_ (#.Text "lux let")] register inputS bodyS))]) (` ("lux let" (~ register) (~ inputS) (~ (recur bodyS)))) - (^ [_ (#;Form (list [_ (#;Text "lux if")] inputS thenS elseS))]) + (^ [_ (#.Form (list [_ (#.Text "lux if")] inputS thenS elseS))]) (` ("lux if" (~ inputS) (~ (recur thenS)) (~ (recur elseS)))) _ @@ -109,15 +109,15 @@ ))) (def: #export (adjust env offset exprS) - (-> (List Variable) Register ls;Synthesis ls;Synthesis) + (-> (List Variable) Register ls.Synthesis ls.Synthesis) (let [resolve-captured (: (-> Variable Variable) (function [var] - (let [idx (|> var (i.* -1) int-to-nat n.dec)] - (|> env (list;nth idx) maybe;assume))))] + (let [idx (|> var (i/* -1) int-to-nat n/dec)] + (|> env (list.nth idx) maybe.assume))))] (loop [exprS exprS] (case exprS - (^code ((~ [_ (#;Nat tag)]) (~ last?) (~ valueS))) - (` ((~ (code;nat tag)) (~ last?) (~ (recur valueS)))) + (^code ((~ [_ (#.Nat tag)]) (~ last?) (~ valueS))) + (` ((~ (code.nat tag)) (~ last?) (~ (recur valueS)))) (^code [(~@ members)]) (` [(~@ (list/map recur members))]) @@ -128,15 +128,15 @@ (loop [pathS pathS] (case pathS (^template [] - (^ [_ (#;Form (list [_ (#;Text )] leftS rightS))]) + (^ [_ (#.Form (list [_ (#.Text )] leftS rightS))]) (` ( (~ (recur leftS)) (~ (recur rightS))))) (["lux case alt"] ["lux case seq"]) - (^code ("lux case bind" (~ [_ (#;Nat register)]))) - (` ("lux case bind" (~ (code;nat (n.+ offset register))))) + (^code ("lux case bind" (~ [_ (#.Nat register)]))) + (` ("lux case bind" (~ (code.nat (n/+ offset register))))) - (^ [_ (#;Form (list [_ (#;Text "lux case exec")] bodyS))]) + (^ [_ (#.Form (list [_ (#.Text "lux case exec")] bodyS))]) (` ("lux case exec" (~ (adjust' bodyS)))) _ @@ -146,42 +146,42 @@ (` ("lux function" (~ arity) [(~@ (list/map (function [_var] (case _var - (^ [_ (#;Form (list [_ (#;Int var)]))]) - (` ((~ (code;int (resolve-captured var))))) + (^ [_ (#.Form (list [_ (#.Int var)]))]) + (` ((~ (code.int (resolve-captured var))))) _ _var)) environment))] (~ bodyS))) - (^ [_ (#;Form (list& [_ (#;Text "lux call")] funcS argsS))]) + (^ [_ (#.Form (list& [_ (#.Text "lux call")] funcS argsS))]) (` ("lux call" (~ (recur funcS)) (~@ (list/map recur argsS)))) - (^ [_ (#;Form (list& [_ (#;Text "lux recur")] argsS))]) + (^ [_ (#.Form (list& [_ (#.Text "lux recur")] argsS))]) (` ("lux recur" (~@ (list/map recur argsS)))) - (^code ("lux let" (~ [_ (#;Nat register)]) (~ inputS) (~ bodyS))) - (` ("lux let" (~ (code;nat (n.+ offset register))) + (^code ("lux let" (~ [_ (#.Nat register)]) (~ inputS) (~ bodyS))) + (` ("lux let" (~ (code.nat (n/+ offset register))) (~ (recur inputS)) (~ (recur bodyS)))) - (^ [_ (#;Form (list [_ (#;Text "lux if")] inputS thenS elseS))]) + (^ [_ (#.Form (list [_ (#.Text "lux if")] inputS thenS elseS))]) (` ("lux if" (~ (recur inputS)) (~ (recur thenS)) (~ (recur elseS)))) - (^ [_ (#;Form (list [_ (#;Text "lux loop")] [_ (#;Nat loop-offset)] [_ (#;Tuple initsS)] bodyS))]) - (` ("lux loop" (~ (code;nat (n.+ offset loop-offset))) + (^ [_ (#.Form (list [_ (#.Text "lux loop")] [_ (#.Nat loop-offset)] [_ (#.Tuple initsS)] bodyS))]) + (` ("lux loop" (~ (code.nat (n/+ offset loop-offset))) [(~@ (list/map recur initsS))] (~ (recur bodyS)))) - (^ [_ (#;Form (list [_ (#;Int var)]))]) - (if (variableL;captured? var) - (` ((~ (code;int (resolve-captured var))))) - (` ((~ (code;int (|> offset nat-to-int (i.+ var))))))) + (^ [_ (#.Form (list [_ (#.Int var)]))]) + (if (variableL.captured? var) + (` ((~ (code.int (resolve-captured var))))) + (` ((~ (code.int (|> offset nat-to-int (i/+ var))))))) - (^ [_ (#;Form (list& [_ (#;Text procedure)] argsS))]) - (` ((~ (code;text procedure)) (~@ (list/map recur argsS)))) + (^ [_ (#.Form (list& [_ (#.Text procedure)] argsS))]) + (` ((~ (code.text procedure)) (~@ (list/map recur argsS)))) _ exprS -- cgit v1.2.3