From f2937706edb6887c5eb1a6a0b6668b1334f5ef3b Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Thu, 11 Apr 2019 22:30:05 -0400 Subject: WIP: Lua compiler. --- .../source/luxc/lang/translation/lua/loop.jvm.lux | 35 ---------------------- 1 file changed, 35 deletions(-) delete mode 100644 new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux (limited to 'new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux deleted file mode 100644 index 4bad74069..000000000 --- a/new-luxc/source/luxc/lang/translation/lua/loop.jvm.lux +++ /dev/null @@ -1,35 +0,0 @@ -(.module: - lux - (lux (control [monad #+ do]) - (data [text] - text/format - (coll [list "list/" Functor])) - [macro]) - (luxc [lang] - (lang ["ls" synthesis] - (host [lua #+ Lua Expression Statement]))) - [//] - (// [".T" reference])) - -(def: #export (translate-loop translate offset initsS+ bodyS) - (-> (-> ls.Synthesis (Meta Expression)) Nat (List ls.Synthesis) ls.Synthesis - (Meta Expression)) - (do macro.Monad - [loop-name (:: @ map (|>> %code lang.normalize-name) - (macro.gensym "loop")) - initsO+ (monad.map @ translate initsS+) - bodyO (//.with-anchor [loop-name offset] - (translate bodyS)) - #let [registersO+ (|> (list.n/range +0 (dec (list.size initsS+))) - (list/map (|>> (n/+ offset) referenceT.variable)))] - _ (//.save (lua.function! loop-name registersO+ - (lua.return! bodyO)))] - (wrap (lua.apply loop-name initsO+)))) - -(def: #export (translate-recur translate argsS+) - (-> (-> ls.Synthesis (Meta Expression)) (List ls.Synthesis) - (Meta Expression)) - (do macro.Monad - [[loop-name offset] //.anchor - argsO+ (monad.map @ translate argsS+)] - (wrap (lua.apply loop-name argsO+)))) -- cgit v1.2.3