diff options
author | Eduardo Julian | 2017-11-15 23:22:30 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-15 23:22:30 -0400 |
commit | 190b512a822fefbb9c66271feb189cc6ccebaf85 (patch) | |
tree | 6d317f54649be741c67e03c71a8b6006b83f00ec /new-luxc/source/luxc/lang/translation/case.jvm.lux | |
parent | f11c10f72d003555d76c9803954e2bd8b347362d (diff) |
- Re-named "lux/meta" to to "lux/macro".
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/case.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/case.jvm.lux | 142 |
1 files changed, 71 insertions, 71 deletions
diff --git a/new-luxc/source/luxc/lang/translation/case.jvm.lux b/new-luxc/source/luxc/lang/translation/case.jvm.lux index e3052c77d..cf2cdb7f1 100644 --- a/new-luxc/source/luxc/lang/translation/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/case.jvm.lux @@ -3,7 +3,7 @@ (lux (control [monad #+ do] ["ex" exception #+ exception:]) (data text/format) - [meta "meta/" Monad<Meta>]) + [macro "macro/" Monad<Meta>]) (luxc ["_" lang] (lang [";L" host] (host ["$" jvm] @@ -59,111 +59,111 @@ Nat $;Label $;Label ls;Path (Meta $;Inst)) (case path (^ [_ (#;Form (list [_ (#;Text "lux case exec")] bodyS))]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [bodyI (translate bodyS)] (wrap (|>. (pop-altI stack-depth) bodyI ($i;GOTO @end)))) (^ [_ (#;Form (list [_ (#;Text "lux case pop")]))]) - (meta/wrap popI) + (macro/wrap popI) (^ [_ (#;Form (list [_ (#;Text "lux case bind")] [_ (#;Nat register)]))]) - (meta/wrap (|>. peekI - ($i;ASTORE register))) + (macro/wrap (|>. peekI + ($i;ASTORE register))) [_ (#;Bool value)] - (meta/wrap (let [jumpI (if value $i;IFEQ $i;IFNE)] - (|>. peekI - ($i;unwrap #$;Boolean) - (jumpI @else)))) + (macro/wrap (let [jumpI (if value $i;IFEQ $i;IFNE)] + (|>. peekI + ($i;unwrap #$;Boolean) + (jumpI @else)))) (^template [<tag> <prep>] [_ (<tag> value)] - (meta/wrap (|>. peekI - ($i;unwrap #$;Long) - ($i;long (|> value <prep>)) - $i;LCMP - ($i;IFNE @else)))) + (macro/wrap (|>. peekI + ($i;unwrap #$;Long) + ($i;long (|> value <prep>)) + $i;LCMP + ($i;IFNE @else)))) ([#;Nat (:! Int)] [#;Int (: Int)] [#;Deg (:! Int)]) [_ (#;Frac value)] - (meta/wrap (|>. peekI - ($i;unwrap #$;Double) - ($i;double value) - $i;DCMPL - ($i;IFNE @else))) + (macro/wrap (|>. peekI + ($i;unwrap #$;Double) + ($i;double value) + $i;DCMPL + ($i;IFNE @else))) [_ (#;Text value)] - (meta/wrap (|>. peekI - ($i;string value) - ($i;INVOKEVIRTUAL "java.lang.Object" - "equals" - ($t;method (list $Object) - (#;Some $t;boolean) - (list)) - false) - ($i;IFEQ @else))) + (macro/wrap (|>. peekI + ($i;string value) + ($i;INVOKEVIRTUAL "java.lang.Object" + "equals" + ($t;method (list $Object) + (#;Some $t;boolean) + (list)) + false) + ($i;IFEQ @else))) (^template [<special> <method>] (^ [_ (#;Form (list [_ (#;Text <special>)] [_ (#;Nat idx)]))]) - (meta/wrap (case idx - +0 - (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) - ($i;int 0) - $i;AALOAD - pushI) - - _ - (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) - ($i;int (nat-to-int idx)) - ($i;INVOKESTATIC hostL;runtime-class - <method> - ($t;method (list ../runtime;$Tuple $t;int) - (#;Some $Object) - (list)) - false) - pushI)))) + (macro/wrap (case idx + +0 + (|>. peekI + ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) + ($i;int 0) + $i;AALOAD + pushI) + + _ + (|>. peekI + ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) + ($i;int (nat-to-int idx)) + ($i;INVOKESTATIC hostL;runtime-class + <method> + ($t;method (list ../runtime;$Tuple $t;int) + (#;Some $Object) + (list)) + false) + pushI)))) (["lux case tuple left" "pm_left"] ["lux case tuple right" "pm_right"]) (^template [<special> <flag>] (^ [_ (#;Form (list [_ (#;Text <special>)] [_ (#;Nat idx)]))]) - (meta/wrap (<| $i;with-label (function [@success]) - $i;with-label (function [@fail]) - (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Variant)) - ($i;int (nat-to-int idx)) - <flag> - ($i;INVOKESTATIC hostL;runtime-class "pm_variant" - ($t;method (list ../runtime;$Variant ../runtime;$Tag ../runtime;$Flag) - (#;Some ../runtime;$Datum) - (list)) - false) - $i;DUP - ($i;IFNULL @fail) - ($i;GOTO @success) - ($i;label @fail) - $i;POP - ($i;GOTO @else) - ($i;label @success) - pushI)))) + (macro/wrap (<| $i;with-label (function [@success]) + $i;with-label (function [@fail]) + (|>. peekI + ($i;CHECKCAST ($t;descriptor ../runtime;$Variant)) + ($i;int (nat-to-int idx)) + <flag> + ($i;INVOKESTATIC hostL;runtime-class "pm_variant" + ($t;method (list ../runtime;$Variant ../runtime;$Tag ../runtime;$Flag) + (#;Some ../runtime;$Datum) + (list)) + false) + $i;DUP + ($i;IFNULL @fail) + ($i;GOTO @success) + ($i;label @fail) + $i;POP + ($i;GOTO @else) + ($i;label @success) + pushI)))) (["lux case variant left" $i;NULL] ["lux case variant right" ($i;string "")]) (^ [_ (#;Form (list [_ (#;Text "lux case seq")] leftP rightP))]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [leftI (translate-path' translate stack-depth @else @end leftP) rightI (translate-path' translate stack-depth @else @end rightP)] (wrap (|>. leftI rightI))) (^ [_ (#;Form (list [_ (#;Text "lux case alt")] leftP rightP))]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [@alt-else $i;make-label leftI (translate-path' translate (n.inc stack-depth) @alt-else @end leftP) rightI (translate-path' translate stack-depth @else @end rightP)] @@ -179,7 +179,7 @@ (def: (translate-path translate path @end) (-> (-> ls;Synthesis (Meta $;Inst)) ls;Path $;Label (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [@else $i;make-label pathI (translate-path' translate +1 @else @end path)] (wrap (|>. pathI @@ -208,7 +208,7 @@ (def: #export (translate-case translate valueS path) (-> (-> ls;Synthesis (Meta $;Inst)) ls;Synthesis ls;Path (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [@end $i;make-label valueI (translate valueS) pathI (translate-path translate path @end)] @@ -222,7 +222,7 @@ (def: #export (translate-let translate register inputS exprS) (-> (-> ls;Synthesis (Meta $;Inst)) Nat ls;Synthesis ls;Synthesis (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [inputI (translate inputS) exprI (translate exprS)] (wrap (|>. inputI |