aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/synthesis/variable.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/synthesis/variable.lux')
-rw-r--r--new-luxc/source/luxc/lang/synthesis/variable.lux64
1 files changed, 32 insertions, 32 deletions
diff --git a/new-luxc/source/luxc/lang/synthesis/variable.lux b/new-luxc/source/luxc/lang/synthesis/variable.lux
index 3ce9f2678..b1988018d 100644
--- a/new-luxc/source/luxc/lang/synthesis/variable.lux
+++ b/new-luxc/source/luxc/lang/synthesis/variable.lux
@@ -1,96 +1,96 @@
-(;module:
+(.module:
lux
(lux (data [number]
(coll [list "list/" Fold<List> Monoid<List>]
["s" set])))
(luxc (lang ["la" analysis]
["ls" synthesis]
- [";L" variable #+ Variable])))
+ [".L" variable #+ Variable])))
(def: (bound-vars path)
- (-> ls;Path (List Variable))
+ (-> ls.Path (List Variable))
(case path
- (#ls;BindP register)
+ (#ls.BindP register)
(list (nat-to-int register))
- (^or (#ls;SeqP pre post) (#ls;AltP pre post))
+ (^or (#ls.SeqP pre post) (#ls.AltP pre post))
(list/compose (bound-vars pre) (bound-vars post))
_
(list)))
(def: (path-bodies path)
- (-> ls;Path (List ls;Synthesis))
+ (-> ls.Path (List ls.Synthesis))
(case path
- (#ls;ExecP body)
+ (#ls.ExecP body)
(list body)
- (#ls;SeqP pre post)
+ (#ls.SeqP pre post)
(path-bodies post)
- (#ls;AltP pre post)
+ (#ls.AltP pre post)
(list/compose (path-bodies pre) (path-bodies post))
_
(list)))
(def: (non-arg? arity var)
- (-> ls;Arity Variable Bool)
- (and (variableL;local? var)
- (n.> arity (int-to-nat var))))
+ (-> ls.Arity Variable Bool)
+ (and (variableL.local? var)
+ (n/> arity (int-to-nat var))))
-(type: Tracker (s;Set Variable))
+(type: Tracker (s.Set Variable))
-(def: init-tracker Tracker (s;new number;Hash<Int>))
+(def: init-tracker Tracker (s.new number.Hash<Int>))
(def: (unused-vars current-arity bound exprS)
- (-> ls;Arity (List Variable) ls;Synthesis (List Variable))
+ (-> ls.Arity (List Variable) ls.Synthesis (List Variable))
(let [tracker (loop [exprS exprS
- tracker (list/fold s;add init-tracker bound)]
+ tracker (list/fold s.add init-tracker bound)]
(case exprS
- (#ls;Variable var)
+ (#ls.Variable var)
(if (non-arg? current-arity var)
- (s;remove var tracker)
+ (s.remove var tracker)
tracker)
- (#ls;Variant tag last? memberS)
+ (#ls.Variant tag last? memberS)
(recur memberS tracker)
- (#ls;Tuple membersS)
+ (#ls.Tuple membersS)
(list/fold recur tracker membersS)
- (#ls;Call funcS argsS)
+ (#ls.Call funcS argsS)
(list/fold recur (recur funcS tracker) argsS)
- (^or (#ls;Recur argsS)
- (#ls;Procedure name argsS))
+ (^or (#ls.Recur argsS)
+ (#ls.Procedure name argsS))
(list/fold recur tracker argsS)
- (#ls;Let offset inputS outputS)
+ (#ls.Let offset inputS outputS)
(|> tracker (recur inputS) (recur outputS))
- (#ls;If testS thenS elseS)
+ (#ls.If testS thenS elseS)
(|> tracker (recur testS) (recur thenS) (recur elseS))
- (#ls;Loop offset initsS bodyS)
+ (#ls.Loop offset initsS bodyS)
(recur bodyS (list/fold recur tracker initsS))
- (#ls;Case inputS outputPS)
- (let [tracker' (list/fold s;add
+ (#ls.Case inputS outputPS)
+ (let [tracker' (list/fold s.add
(recur inputS tracker)
(bound-vars outputPS))]
(list/fold recur tracker' (path-bodies outputPS)))
- (#ls;Function arity env bodyS)
- (list/fold s;remove tracker env)
+ (#ls.Function arity env bodyS)
+ (list/fold s.remove tracker env)
_
tracker
))]
- (s;to-list tracker)))
+ (s.to-list tracker)))
## (def: (optimize-register-use current-arity [pathS bodyS])
-## (-> ls;Arity [ls;Path ls;Synthesis] [ls;Path ls;Synthesis])
+## (-> ls.Arity [ls.Path ls.Synthesis] [ls.Path ls.Synthesis])
## (let [bound (bound-vars pathS)
## unused (unused-vars current-arity bound bodyS)
## adjusted (adjust-vars unused bound)]