aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/source/luxc/lang/translation
diff options
context:
space:
mode:
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation')
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/case.lux102
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux22
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/primitive.lux20
3 files changed, 72 insertions, 72 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
index eea77aaf0..68d9b4347 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
@@ -118,27 +118,27 @@
elseG))))
(^template [<tag> <unwrap> <dup> <pop> <test> <comparison> <if>]
- (<tag> cons)
- (do {@ phase.monad}
- [forkG (: (Operation Inst)
- (monad.fold @ (function (_ [test thenP] elseG)
- (do @
- [thenG (path' stack-depth @else @end phase archive thenP)]
- (wrap (<| _.with-label (function (_ @else))
- (|>> <dup>
- (<test> test)
- <comparison>
- (<if> @else)
- <pop>
- thenG
- (_.label @else)
- elseG)))))
- (|>> <pop>
- (_.GOTO @else))
- (#.Cons cons)))]
- (wrap (|>> peekI
- <unwrap>
- forkG))))
+ [(<tag> cons)
+ (do {@ phase.monad}
+ [forkG (: (Operation Inst)
+ (monad.fold @ (function (_ [test thenP] elseG)
+ (do @
+ [thenG (path' stack-depth @else @end phase archive thenP)]
+ (wrap (<| _.with-label (function (_ @else))
+ (|>> <dup>
+ (<test> test)
+ <comparison>
+ (<if> @else)
+ <pop>
+ thenG
+ (_.label @else)
+ elseG)))))
+ (|>> <pop>
+ (_.GOTO @else))
+ (#.Cons cons)))]
+ (wrap (|>> peekI
+ <unwrap>
+ 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
@@ -153,41 +153,41 @@
(_.GOTO @end))))
(^template [<pattern> <right?>]
- (^ (<pattern> lefts))
- (operation@wrap (<| _.with-label (function (_ @success))
- _.with-label (function (_ @fail))
- (|>> peekI
- (_.CHECKCAST //.$Variant)
- (structure.tagI lefts <right?>)
- (structure.flagI <right?>)
- (_.INVOKESTATIC //.$Runtime "pm_variant" (type.method [(list //.$Variant runtime.$Tag runtime.$Flag) runtime.$Value (list)]))
- _.DUP
- (_.IFNULL @fail)
- (_.GOTO @success)
- (_.label @fail)
- _.POP
- (_.GOTO @else)
- (_.label @success)
- pushI))))
+ [(^ (<pattern> lefts))
+ (operation@wrap (<| _.with-label (function (_ @success))
+ _.with-label (function (_ @fail))
+ (|>> peekI
+ (_.CHECKCAST //.$Variant)
+ (structure.tagI lefts <right?>)
+ (structure.flagI <right?>)
+ (_.INVOKESTATIC //.$Runtime "pm_variant" (type.method [(list //.$Variant runtime.$Tag runtime.$Flag) runtime.$Value (list)]))
+ _.DUP
+ (_.IFNULL @fail)
+ (_.GOTO @success)
+ (_.label @fail)
+ _.POP
+ (_.GOTO @else)
+ (_.label @success)
+ pushI)))])
([synthesis.side/left false]
[synthesis.side/right true])
## Extra optimization
(^template [<path> <projection>]
- (^ (<path> lefts))
- (operation@wrap (|>> peekI
- (<projection> lefts)
- pushI))
-
- (^ (synthesis.path/seq
- (<path> lefts)
- (synthesis.!bind-top register thenP)))
- (do phase.monad
- [then! (path' stack-depth @else @end phase archive thenP)]
- (wrap (|>> peekI
- (<projection> lefts)
- (_.ASTORE register)
- then!))))
+ [(^ (<path> lefts))
+ (operation@wrap (|>> peekI
+ (<projection> lefts)
+ pushI))
+
+ (^ (synthesis.path/seq
+ (<path> lefts)
+ (synthesis.!bind-top register thenP)))
+ (do phase.monad
+ [then! (path' stack-depth @else @end phase archive thenP)]
+ (wrap (|>> peekI
+ (<projection> lefts)
+ (_.ASTORE register)
+ then!)))])
([synthesis.member/left ..left-projection]
[synthesis.member/right ..right-projection])
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
index 26db95ac1..86b814bad 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -822,14 +822,14 @@
(synthesis.path/then (normalize bodyS))
(^template [<tag>]
- (^ (<tag> leftP rightP))
- (<tag> (recur leftP) (recur rightP)))
+ [(^ (<tag> leftP rightP))
+ (<tag> (recur leftP) (recur rightP))])
([#synthesis.Alt]
[#synthesis.Seq])
(^template [<tag>]
- (^ (<tag> value))
- path)
+ [(^ (<tag> value))
+ path])
([#synthesis.Pop]
[#synthesis.Bind]
[#synthesis.Access])
@@ -838,11 +838,11 @@
(#synthesis.Bit-Fork when (recur then) (maybe@map recur else))
(^template [<tag>]
- (<tag> [[test then] elses])
- (<tag> [[test (recur then)]
- (list@map (function (_ [else-test else-then])
- [else-test (recur else-then)])
- elses)]))
+ [(<tag> [[test then] elses])
+ (<tag> [[test (recur then)]
+ (list@map (function (_ [else-test else-then])
+ [else-test (recur else-then)])
+ elses)])])
([#synthesis.I64-Fork]
[#synthesis.F64-Fork]
[#synthesis.Text-Fork])
@@ -853,8 +853,8 @@
(function (recur body)
(case body
(^template [<tag>]
- (^ (<tag> value))
- body)
+ [(^ (<tag> value))
+ body])
([#synthesis.Primitive]
[synthesis.constant])
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux
index d8ab2cbee..2e0aba43e 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux
@@ -34,14 +34,14 @@
(-> (I64 Any) (Operation Inst))
(case (.int value)
(^template [<int> <instruction>]
- <int>
- (operation@wrap (|>> <instruction> (_.wrap type.long))))
+ [<int>
+ (operation@wrap (|>> <instruction> (_.wrap type.long)))])
([+0 _.LCONST_0]
[+1 _.LCONST_1])
(^template [<int> <instruction>]
- <int>
- (operation@wrap (|>> <instruction> _.I2L (_.wrap type.long))))
+ [<int>
+ (operation@wrap (|>> <instruction> _.I2L (_.wrap type.long)))])
([-1 _.ICONST_M1]
## [+0 _.ICONST_0]
## [+1 _.ICONST_1]
@@ -74,18 +74,18 @@
(-> Frac (Operation Inst))
(case value
(^template [<int> <instruction>]
- <int>
- (operation@wrap (|>> <instruction> (_.wrap type.double))))
+ [<int>
+ (operation@wrap (|>> <instruction> (_.wrap type.double)))])
([+1.0 _.DCONST_1])
(^template [<int> <instruction>]
- <int>
- (operation@wrap (|>> <instruction> _.F2D (_.wrap type.double))))
+ [<int>
+ (operation@wrap (|>> <instruction> _.F2D (_.wrap type.double)))])
([+2.0 _.FCONST_2])
(^template [<int> <instruction>]
- <int>
- (operation@wrap (|>> <instruction> _.I2D (_.wrap type.double))))
+ [<int>
+ (operation@wrap (|>> <instruction> _.I2D (_.wrap type.double)))])
([-1.0 _.ICONST_M1]
## [+0.0 _.ICONST_0]
## [+1.0 _.ICONST_1]