From 2b105c8694b87a63bd151cd0966c9d5dcfaae672 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 19 Feb 2019 22:52:52 -0400 Subject: Moved looping machinery over. --- .../source/luxc/lang/translation/js/loop.jvm.lux | 35 ---------------------- 1 file changed, 35 deletions(-) delete mode 100644 new-luxc/source/luxc/lang/translation/js/loop.jvm.lux (limited to 'new-luxc/source') diff --git a/new-luxc/source/luxc/lang/translation/js/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/js/loop.jvm.lux deleted file mode 100644 index c63cb2d32..000000000 --- a/new-luxc/source/luxc/lang/translation/js/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 [js #+ JS 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")) - initsJS+ (monad.map @ translate initsS+) - bodyJS (//.with-anchor [loop-name offset] - (translate bodyS)) - #let [registersJS+ (|> (list.n/range +0 (dec (list.size initsS+))) - (list/map (|>> (n/+ offset) referenceT.variable)))]] - (wrap (format "(function " loop-name "(" (text.join-with "," registersJS+) ") {" - "return " bodyJS ";" - "})(" (text.join-with "," initsJS+) ")")))) - -(def: #export (translate-recur translate argsS+) - (-> (-> ls.Synthesis (Meta Expression)) (List ls.Synthesis) - (Meta Expression)) - (do macro.Monad - [[loop-name offset] //.anchor - argsJS+ (monad.map @ translate argsS+)] - (wrap (format loop-name "(" (text.join-with "," argsJS+) ")")))) -- cgit v1.2.3