From 5ce3411d68cf11daa0ff3e5171afced429696480 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 26 Mar 2019 19:22:42 -0400 Subject: WIP: Moved Python code-generation machinery over to stdlib. --- .../luxc/lang/translation/python/loop.jvm.lux | 36 ---------------------- 1 file changed, 36 deletions(-) delete mode 100644 new-luxc/source/luxc/lang/translation/python/loop.jvm.lux (limited to 'new-luxc/source/luxc/lang/translation/python/loop.jvm.lux') diff --git a/new-luxc/source/luxc/lang/translation/python/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/python/loop.jvm.lux deleted file mode 100644 index f6e3ca4c3..000000000 --- a/new-luxc/source/luxc/lang/translation/python/loop.jvm.lux +++ /dev/null @@ -1,36 +0,0 @@ -(.module: - lux - (lux (control [monad #+ do]) - (data [text] - text/format - (coll [list "list/" Functor])) - [macro]) - (luxc [lang] - (lang ["ls" synthesis] - (host [python #+ 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 (|> (macro.gensym "loop") - (:: @ map (|>> %code lang.normalize-name))) - initsO+ (monad.map @ translate initsS+) - bodyO (//.with-anchor [loop-name offset] - (translate bodyS)) - #let [$loop-name (python.var loop-name) - @loop-name (@@ $loop-name)] - _ (//.save (python.def! $loop-name (|> (list.n/range +0 (dec (list.size initsS+))) - (list/map (|>> (n/+ offset) referenceT.variable))) - (python.return! bodyO)))] - (wrap (python.apply initsO+ @loop-name)))) - -(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 (python.apply argsO+ (python.global loop-name))))) -- cgit v1.2.3