aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/loop.jvm.lux
diff options
context:
space:
mode:
authorEduardo Julian2017-11-29 22:49:56 -0400
committerEduardo Julian2017-11-29 22:49:56 -0400
commit4433c9bcd6c6cac44c018aad2e21a5b4d7cc4896 (patch)
tree0c166db6e01b41dfadd01801b5242967f2363b7d /new-luxc/source/luxc/lang/translation/loop.jvm.lux
parent77c113a3455cdbc4bb485a94f67f392480cdcfbf (diff)
- Adapted main codebase to the latest syntatic changes.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/loop.jvm.lux72
1 files changed, 36 insertions, 36 deletions
diff --git a/new-luxc/source/luxc/lang/translation/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/loop.jvm.lux
index 77d43a0e5..8920dc936 100644
--- a/new-luxc/source/luxc/lang/translation/loop.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/loop.jvm.lux
@@ -1,4 +1,4 @@
-(;module:
+(.module:
lux
(lux (control [monad #+ do])
(data [text]
@@ -6,23 +6,23 @@
(coll [list "list/" Functor<List> Monoid<List>]))
[macro])
(luxc ["&" lang]
- (lang [";L" host]
+ (lang [".L" host]
(host ["$" jvm]
(jvm ["$t" type]
["$d" def]
["$i" inst]))
["la" analysis]
["ls" synthesis]
- (translation [";T" common]
- [";T" runtime]
- [";T" reference])
- [";L" variable #+ Variable Register])))
+ (translation [".T" common]
+ [".T" runtime]
+ [".T" reference])
+ [".L" variable #+ Variable Register])))
(def: (constant? register changeS)
- (-> Register ls;Synthesis Bool)
+ (-> Register ls.Synthesis Bool)
(case changeS
- (^multi (^code ((~ [_ (#;Int var)])))
- (i.= (variableL;local register)
+ (^multi (^code ((~ [_ (#.Int var)])))
+ (i/= (variableL.local register)
var))
true
@@ -30,12 +30,12 @@
false))
(def: #export (translate-recur translate argsS)
- (-> (-> ls;Synthesis (Meta $;Inst))
- (List ls;Synthesis)
- (Meta $;Inst))
- (do macro;Monad<Meta>
- [[@begin offset] hostL;anchor
- #let [pairs (list;zip2 (list;n.range offset (|> (list;size argsS) n.dec (n.+ offset)))
+ (-> (-> ls.Synthesis (Meta $.Inst))
+ (List ls.Synthesis)
+ (Meta $.Inst))
+ (do macro.Monad<Meta>
+ [[@begin offset] hostL.anchor
+ #let [pairs (list.zip2 (list.n/range offset (|> (list.size argsS) n/dec (n/+ offset)))
argsS)]
## It may look weird that first I compile the values separately,
## and then I compile the stores/allocations.
@@ -45,36 +45,36 @@
## and stores separately, then by the time Y is evaluated, it
## will refer to the new value of X, instead of the old value, as
## must be the case.
- valuesI+ (monad;map @ (function [[register argS]]
- (: (Meta $;Inst)
+ valuesI+ (monad.map @ (function [[register argS]]
+ (: (Meta $.Inst)
(if (constant? register argS)
(wrap id)
(translate argS))))
pairs)
#let [storesI+ (list/map (function [[register argS]]
- (: $;Inst
+ (: $.Inst
(if (constant? register argS)
id
- ($i;ASTORE register))))
- (list;reverse pairs))]]
- (wrap (|>. ($i;fuse valuesI+)
- ($i;fuse storesI+)
- ($i;GOTO @begin)))))
+ ($i.ASTORE register))))
+ (list.reverse pairs))]]
+ (wrap (|>> ($i.fuse valuesI+)
+ ($i.fuse storesI+)
+ ($i.GOTO @begin)))))
(def: #export (translate-loop translate offset initsS+ bodyS)
- (-> (-> ls;Synthesis (Meta $;Inst))
- Nat (List ls;Synthesis) ls;Synthesis
- (Meta $;Inst))
- (do macro;Monad<Meta>
- [@begin $i;make-label
- initsI+ (monad;map @ translate initsS+)
- bodyI (hostL;with-anchor [@begin offset]
+ (-> (-> ls.Synthesis (Meta $.Inst))
+ Nat (List ls.Synthesis) ls.Synthesis
+ (Meta $.Inst))
+ (do macro.Monad<Meta>
+ [@begin $i.make-label
+ initsI+ (monad.map @ translate initsS+)
+ bodyI (hostL.with-anchor [@begin offset]
(translate bodyS))
- #let [initializationI (|> (list;enumerate initsI+)
+ #let [initializationI (|> (list.enumerate initsI+)
(list/map (function [[register initI]]
- (|>. initI
- ($i;ASTORE (n.+ offset register)))))
- $i;fuse)]]
- (wrap (|>. initializationI
- ($i;label @begin)
+ (|>> initI
+ ($i.ASTORE (n/+ offset register)))))
+ $i.fuse)]]
+ (wrap (|>> initializationI
+ ($i.label @begin)
bodyI))))