From 832a9361b632331e82a64c07baa560487ca8abde Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Tue, 29 Dec 2020 00:38:21 -0400 Subject: Moved "lux/data/number" to "lux/math/number". --- lux-jvm/source/luxc/lang/translation/jvm/case.lux | 72 +++++++++++------------ 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation/jvm/case.lux') diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index 68d9b4347..b9d6ec6d1 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -33,15 +33,15 @@ ["." runtime] ["." structure]]) -(def: (pop-altI stack-depth) +(def: (pop_altI stack_depth) (-> Nat Inst) - (.case stack-depth + (.case stack_depth 0 function.identity 1 _.POP 2 _.POP2 _ ## (n.> 2) (|>> _.POP2 - (pop-altI (n.- 2 stack-depth))))) + (pop_altI (n.- 2 stack_depth))))) (def: peekI Inst @@ -69,7 +69,7 @@ 5 _.ICONST_5 _ (_.int (.int value)))) -(def: (left-projection lefts) +(def: (left_projection lefts) (-> Nat Inst) (.let [[indexI accessI] (.case lefts 0 @@ -83,13 +83,13 @@ indexI accessI))) -(def: (right-projection lefts) +(def: (right_projection lefts) (-> Nat Inst) (|>> (_.CHECKCAST //.$Tuple) (leftsI lefts) (_.INVOKESTATIC //.$Runtime "tuple_right" (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)])))) -(def: (path' stack-depth @else @end phase archive path) +(def: (path' stack_depth @else @end phase archive path) (-> Nat Label Label Phase Archive Path (Operation Inst)) (.case path #synthesis.Pop @@ -99,17 +99,17 @@ (operation@wrap (|>> peekI (_.ASTORE register))) - (#synthesis.Bit-Fork when thenP elseP) + (#synthesis.Bit_Fork when thenP elseP) (do phase.monad - [thenG (path' stack-depth @else @end phase archive thenP) + [thenG (path' stack_depth @else @end phase archive thenP) elseG (.case elseP (#.Some elseP) - (path' stack-depth @else @end phase archive elseP) + (path' stack_depth @else @end phase archive elseP) #.None (wrap (_.GOTO @else))) #let [ifI (.if when _.IFEQ _.IFNE)]] - (wrap (<| _.with-label (function (_ @else)) + (wrap (<| _.with_label (function (_ @else)) (|>> peekI (_.unwrap type.boolean) (ifI @else) @@ -123,8 +123,8 @@ [forkG (: (Operation Inst) (monad.fold @ (function (_ [test thenP] elseG) (do @ - [thenG (path' stack-depth @else @end phase archive thenP)] - (wrap (<| _.with-label (function (_ @else)) + [thenG (path' stack_depth @else @end phase archive thenP)] + (wrap (<| _.with_label (function (_ @else)) (|>> ( test) @@ -139,23 +139,23 @@ (wrap (|>> peekI forkG)))]) - ([#synthesis.I64-Fork (_.unwrap type.long) _.DUP2 _.POP2 (|>> .int _.long) _.LCMP _.IFNE] - [#synthesis.F64-Fork (_.unwrap type.double) _.DUP2 _.POP2 _.double _.DCMPL _.IFNE] - [#synthesis.Text-Fork (|>) _.DUP _.POP _.string + ([#synthesis.I64_Fork (_.unwrap type.long) _.DUP2 _.POP2 (|>> .int _.long) _.LCMP _.IFNE] + [#synthesis.F64_Fork (_.unwrap type.double) _.DUP2 _.POP2 _.double _.DCMPL _.IFNE] + [#synthesis.Text_Fork (|>) _.DUP _.POP _.string (_.INVOKEVIRTUAL (type.class "java.lang.Object" (list)) "equals" (type.method [(list //.$Value) type.boolean (list)])) _.IFEQ]) (#synthesis.Then bodyS) (do phase.monad [bodyI (phase archive bodyS)] - (wrap (|>> (pop-altI stack-depth) + (wrap (|>> (pop_altI stack_depth) bodyI (_.GOTO @end)))) (^template [ ] [(^ ( lefts)) - (operation@wrap (<| _.with-label (function (_ @success)) - _.with-label (function (_ @fail)) + (operation@wrap (<| _.with_label (function (_ @success)) + _.with_label (function (_ @fail)) (|>> peekI (_.CHECKCAST //.$Variant) (structure.tagI lefts ) @@ -181,31 +181,31 @@ (^ (synthesis.path/seq ( lefts) - (synthesis.!bind-top register thenP))) + (synthesis.!bind_top register thenP))) (do phase.monad - [then! (path' stack-depth @else @end phase archive thenP)] + [then! (path' stack_depth @else @end phase archive thenP)] (wrap (|>> peekI ( lefts) (_.ASTORE register) then!)))]) - ([synthesis.member/left ..left-projection] - [synthesis.member/right ..right-projection]) + ([synthesis.member/left ..left_projection] + [synthesis.member/right ..right_projection]) (#synthesis.Seq leftP rightP) (do phase.monad - [leftI (path' stack-depth @else @end phase archive leftP) - rightI (path' stack-depth @else @end phase archive rightP)] + [leftI (path' stack_depth @else @end phase archive leftP) + rightI (path' stack_depth @else @end phase archive rightP)] (wrap (|>> leftI rightI))) (#synthesis.Alt leftP rightP) (do phase.monad - [@alt-else _.make-label - leftI (path' (inc stack-depth) @alt-else @end phase archive leftP) - rightI (path' stack-depth @else @end phase archive rightP)] + [@alt_else _.make_label + leftI (path' (inc stack_depth) @alt_else @end phase archive leftP) + rightI (path' stack_depth @else @end phase archive rightP)] (wrap (|>> _.DUP leftI - (_.label @alt-else) + (_.label @alt_else) _.POP rightI))) )) @@ -213,7 +213,7 @@ (def: (path @end phase archive path) (-> Label Phase Archive Path (Operation Inst)) (do phase.monad - [@else _.make-label + [@else _.make_label pathI (..path' 1 @else @end phase archive path)] (wrap (|>> pathI (_.label @else) @@ -228,8 +228,8 @@ [testI (phase archive testS) thenI (phase archive thenS) elseI (phase archive elseS)] - (wrap (<| _.with-label (function (_ @else)) - _.with-label (function (_ @end)) + (wrap (<| _.with_label (function (_ @else)) + _.with_label (function (_ @end)) (|>> testI (_.unwrap type.boolean) (_.IFEQ @else) @@ -252,21 +252,21 @@ (Generator [(List synthesis.Member) Synthesis]) (do phase.monad [recordG (phase archive recordS)] - (wrap (list@fold (function (_ step so-far) + (wrap (list@fold (function (_ step so_far) (.let [next (.case step (#.Left lefts) - (..left-projection lefts) + (..left_projection lefts) (#.Right lefts) - (..right-projection lefts))] - (|>> so-far next))) + (..right_projection lefts))] + (|>> so_far next))) recordG (list.reverse path))))) (def: #export (case phase archive [valueS path]) (Generator [Synthesis Path]) (do phase.monad - [@end _.make-label + [@end _.make_label valueI (phase archive valueS) pathI (..path @end phase archive path)] (wrap (|>> _.NULL -- cgit v1.2.3