diff options
author | Eduardo Julian | 2017-11-01 13:36:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-11-01 13:36:15 -0400 |
commit | 88006e957373bbd72ec68897474303964885fc68 (patch) | |
tree | a34f88ea0921f56737c8881345245e11e7c8b546 /new-luxc/source/luxc/lang/translation/case.jvm.lux | |
parent | 012f6bd41e527479dddbccbdab10daa78fd9a0fd (diff) |
- Minor refactorings.
- Fixed some bugs.
- Enabled macro-expansion for statements.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/case.jvm.lux | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/new-luxc/source/luxc/lang/translation/case.jvm.lux b/new-luxc/source/luxc/lang/translation/case.jvm.lux index a9ea4482a..3858627ff 100644 --- a/new-luxc/source/luxc/lang/translation/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/case.jvm.lux @@ -54,13 +54,13 @@ (exception: #export Unrecognized-Path) -(def: (generate-path' generate stack-depth @else @end path) +(def: (translate-path' translate stack-depth @else @end path) (-> (-> ls;Synthesis (Meta $;Inst)) Nat $;Label $;Label ls;Path (Meta $;Inst)) (case path (^ [_ (#;Form (list [_ (#;Text "lux case exec")] bodyS))]) (do meta;Monad<Meta> - [bodyI (generate bodyS)] + [bodyI (translate bodyS)] (wrap (|>. (pop-altI stack-depth) bodyI ($i;GOTO @end)))) @@ -111,7 +111,7 @@ (^template [<special> <method>] (^ [_ (#;Form (list [_ (#;Text <special>)] [_ (#;Nat idx)] subP))]) (do meta;Monad<Meta> - [subI (generate-path' generate stack-depth @else @end subP)] + [subI (translate-path' translate stack-depth @else @end subP)] (wrap (case idx +0 (|>. peekI @@ -139,7 +139,7 @@ (^template [<special> <flag>] (^ [_ (#;Form (list [_ (#;Text <special>)] [_ (#;Nat idx)] subP))]) (do meta;Monad<Meta> - [subI (generate-path' generate stack-depth @else @end subP)] + [subI (translate-path' translate stack-depth @else @end subP)] (wrap (<| $i;with-label (function [@success]) $i;with-label (function [@fail]) (|>. peekI @@ -165,16 +165,16 @@ (^ [_ (#;Form (list [_ (#;Text "lux case seq")] leftP rightP))]) (do meta;Monad<Meta> - [leftI (generate-path' generate stack-depth @else @end leftP) - rightI (generate-path' generate stack-depth @else @end rightP)] + [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> [@alt-else $i;make-label - leftI (generate-path' generate (n.inc stack-depth) @alt-else @end leftP) - rightI (generate-path' generate stack-depth @else @end rightP)] + leftI (translate-path' translate (n.inc stack-depth) @alt-else @end leftP) + rightI (translate-path' translate stack-depth @else @end rightP)] (wrap (|>. $i;DUP leftI ($i;label @alt-else) @@ -184,12 +184,12 @@ _ (_;throw Unrecognized-Path (%code path)))) -(def: (generate-path generate path @end) +(def: (translate-path translate path @end) (-> (-> ls;Synthesis (Meta $;Inst)) ls;Path $;Label (Meta $;Inst)) (do meta;Monad<Meta> [@else $i;make-label - pathI (generate-path' generate +1 @else @end path)] + pathI (translate-path' translate +1 @else @end path)] (wrap (|>. pathI ($i;label @else) $i;POP @@ -200,13 +200,13 @@ $i;NULL ($i;GOTO @end))))) -(def: #export (generate-case generate valueS path) +(def: #export (translate-case translate valueS path) (-> (-> ls;Synthesis (Meta $;Inst)) ls;Synthesis ls;Path (Meta $;Inst)) (do meta;Monad<Meta> [@end $i;make-label - valueI (generate valueS) - pathI (generate-path generate path @end)] + valueI (translate valueS) + pathI (translate-path translate path @end)] (wrap (|>. valueI $i;NULL $i;SWAP @@ -214,12 +214,12 @@ pathI ($i;label @end))))) -(def: #export (generate-let generate register inputS exprS) +(def: #export (translate-let translate register inputS exprS) (-> (-> ls;Synthesis (Meta $;Inst)) Nat ls;Synthesis ls;Synthesis (Meta $;Inst)) (do meta;Monad<Meta> - [inputI (generate inputS) - exprI (generate exprS)] + [inputI (translate inputS) + exprI (translate exprS)] (wrap (|>. inputI ($i;ASTORE register) exprI)))) |