aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/source/luxc/lang/translation/jvm
diff options
context:
space:
mode:
authorEduardo Julian2021-09-10 01:21:23 -0400
committerEduardo Julian2021-09-10 01:21:23 -0400
commitcd71a864ad5be13ed6ec6d046e0a2cb1087bdf94 (patch)
treeaf6366578f98f1a8e551f4da9f3ad230fd63a4dd /lux-jvm/source/luxc/lang/translation/jvm
parentef77466323f85a3d1b65b46a3deb93652ef22085 (diff)
Migrated variants to the new syntax.
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation/jvm')
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/case.lux20
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/common.lux40
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/expression.lux2
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux4
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux88
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/function.lux4
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/reference.lux4
7 files changed, 81 insertions, 81 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
index a6d0a725f..0959130a3 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
@@ -106,15 +106,15 @@
#synthesis.Pop
(operation@in ..popI)
- (#synthesis.Bind register)
+ {#synthesis.Bind register}
(operation@in (|>> 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)
elseG (.case elseP
- (#.Some elseP)
+ {#.Some elseP}
(path' stack_depth @else @end phase archive elseP)
#.None
@@ -129,7 +129,7 @@
elseG))))
(^template [<tag> <unwrap> <dup> <pop> <test> <comparison> <if>]
- [(<tag> cons)
+ [{<tag> cons}
(do [@ phase.monad]
[forkG (: (Operation Inst)
(monad.mix @ (function (_ [test thenP] elseG)
@@ -146,7 +146,7 @@
elseG)))))
(|>> <pop>
(_.GOTO @else))
- (#.Item cons)))]
+ {#.Item cons}))]
(in (|>> peekI
<unwrap>
forkG)))])
@@ -156,7 +156,7 @@
(_.INVOKEVIRTUAL (type.class "java.lang.Object" (list)) "equals" ..equalsJT)
_.IFEQ])
- (#synthesis.Then bodyS)
+ {#synthesis.Then bodyS}
(do phase.monad
[bodyI (phase archive bodyS)]
(in (|>> (pop_altI stack_depth)
@@ -202,14 +202,14 @@
([synthesis.member/left ..left_projection]
[synthesis.member/right ..right_projection])
- (#synthesis.Seq leftP rightP)
+ {#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)]
(in (|>> leftI
rightI)))
- (#synthesis.Alt leftP rightP)
+ {#synthesis.Alt leftP rightP}
(do phase.monad
[@alt_else _.make_label
leftI (path' (++ stack_depth) @alt_else @end phase archive leftP)
@@ -268,10 +268,10 @@
[recordG (phase archive recordS)]
(in (list@mix (function (_ step so_far)
(.let [next (.case step
- (#.Left lefts)
+ {#.Left lefts}
(..left_projection lefts)
- (#.Right lefts)
+ {#.Right lefts}
(..right_projection lefts))]
(|>> so_far next)))
recordG
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/common.lux
index 8db12bd7e..2dade7a97 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/common.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/common.lux
@@ -32,21 +32,21 @@
... (All (_ a) (-> (Meta a) (Meta [Artifacts a])))
... (function (_ state)
... (case (action (revised@ #.host
-... (|>> (:coerce Host)
-... (with@ #artifacts (dictionary.new text.hash))
-... (:coerce Nothing))
-... state))
-... (#try.Success [state' output])
-... (#try.Success [(revised@ #.host
-... (|>> (:coerce Host)
-... (with@ #artifacts (|> (value@ #.host state) (:coerce Host) (value@ #artifacts)))
-... (:coerce Nothing))
-... state')
-... [(|> state' (value@ #.host) (:coerce Host) (value@ #artifacts))
-... output]])
+... (|>> (:coerce Host)
+... (with@ #artifacts (dictionary.new text.hash))
+... (:coerce Nothing))
+... state))
+... {#try.Success [state' output]}
+... {#try.Success [(revised@ #.host
+... (|>> (:coerce Host)
+... (with@ #artifacts (|> (value@ #.host state) (:coerce Host) (value@ #artifacts)))
+... (:coerce Nothing))
+... state')
+... [(|> state' (value@ #.host) (:coerce Host) (value@ #artifacts))
+... output]]}
-... (#try.Failure error)
-... (#try.Failure error))))
+... {#try.Failure error}
+... {#try.Failure error})))
... (def: .public (load-definition state)
... (-> Lux (-> Name Binary (Try Any)))
@@ -60,14 +60,14 @@
... (case (do try.monad
... [field (Class::getField [..value-field] class)]
... (Field::get [#.None] field))
-... (#try.Success (#.Some def-value))
+... {#try.Success {#.Some def-value}}
... (wrap def-value)
-... (#try.Success #.None)
+... {#try.Success #.None}
... (phase.throw invalid-definition-value (%name def-name))
-... (#try.Failure error)
+... {#try.Failure error}
... (phase.throw cannot-load-definition
-... (format "Definition: " (%name def-name) "\n"
-... "Error:\n"
-... error))))))))
+... (format "Definition: " (%name def-name) "\n"
+... "Error:\n"
+... error))))))))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/expression.lux b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux
index 087ebfaff..a460ad96b 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/expression.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux
@@ -72,5 +72,5 @@
(^ (synthesis.function/abstraction data))
(function.function translate archive data)
- (#synthesis.Extension extension)
+ {#synthesis.Extension extension}
(extension.apply archive translate extension)))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
index e3ac4141b..8d92a68eb 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
@@ -48,10 +48,10 @@
Handler))
(function (_ extension_name phase archive input)
(case (<s>.result parser input)
- (#try.Success input')
+ {#try.Success input'}
(handler extension_name phase archive input')
- (#try.Failure error)
+ {#try.Failure error}
(phase.except extension.invalid_syntax [extension_name %synthesis input]))))
(import: java/lang/Double
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 131ff0968..8535c3b35 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -96,9 +96,9 @@
(do <>.monad
[arrayJT (<text>.then parser.array <synthesis>.text)]
(case (parser.array? arrayJT)
- (#.Some elementJT)
+ {#.Some elementJT}
(case (parser.object? elementJT)
- (#.Some elementJT)
+ {#.Some elementJT}
(in elementJT)
#.None
@@ -629,7 +629,7 @@
(do phase.monad
[]
(case (dictionary.value unboxed ..primitives)
- (#.Some primitive)
+ {#.Some primitive}
(in (_.GETSTATIC (type.class class (list)) field primitive))
#.None
@@ -644,7 +644,7 @@
[valueI (generate archive valueS)
.let [$class (type.class class (list))]]
(case (dictionary.value unboxed ..primitives)
- (#.Some primitive)
+ {#.Some primitive}
(in (|>> valueI
(_.PUTSTATIC $class field primitive)
(_.string synthesis.unit)))
@@ -664,7 +664,7 @@
[objectI (generate archive objectS)
.let [$class (type.class class (list))
getI (case (dictionary.value unboxed ..primitives)
- (#.Some primitive)
+ {#.Some primitive}
(_.GETFIELD $class field primitive)
#.None
@@ -683,7 +683,7 @@
objectI (generate archive objectS)
.let [$class (type.class class (list))
putI (case (dictionary.value unboxed ..primitives)
- (#.Some primitive)
+ {#.Some primitive}
(_.PUTFIELD $class field primitive)
#.None
@@ -709,10 +709,10 @@
(do phase.monad
[valueI (generate archive valueS)]
(case (type.primitive? valueT)
- (#.Right valueT)
+ {#.Right valueT}
(in [valueT valueI])
- (#.Left valueT)
+ {#.Left valueT}
(in [valueT (|>> valueI
(_.CHECKCAST valueT))]))))
@@ -722,10 +722,10 @@
(def: (prepare_output outputT)
(-> (Type Return) Inst)
(case (type.void? outputT)
- (#.Right outputT)
+ {#.Right outputT}
..voidI
- (#.Left outputT)
+ {#.Left outputT}
function.identity))
(def: invoke::static
@@ -814,26 +814,26 @@
[0 _] body
[1 _] body
- [2 (#synthesis.Control (#synthesis.Branch (#synthesis.Let _ 2 hidden)))]
+ [2 {#synthesis.Control {#synthesis.Branch {#synthesis.Let _ 2 hidden}}}]
hidden
- [_ (#synthesis.Control (#synthesis.Branch (#synthesis.Case _ path)))]
+ [_ {#synthesis.Control {#synthesis.Branch {#synthesis.Case _ path}}}]
(loop [path path]
(case path
(^or #synthesis.Pop
- (#synthesis.Access _)
- (#synthesis.Bind _)
- (#synthesis.Bit_Fork _)
- (#synthesis.I64_Fork _)
- (#synthesis.F64_Fork _)
- (#synthesis.Text_Fork _)
- (#synthesis.Alt _))
+ {#synthesis.Access _}
+ {#synthesis.Bind _}
+ {#synthesis.Bit_Fork _}
+ {#synthesis.I64_Fork _}
+ {#synthesis.F64_Fork _}
+ {#synthesis.Text_Fork _}
+ {#synthesis.Alt _})
body
- (#synthesis.Seq _ next)
+ {#synthesis.Seq _ next}
(recur next)
- (#synthesis.Then hidden)
+ {#synthesis.Then hidden}
hidden))
_
@@ -873,27 +873,27 @@
(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))
+ [(^ {<tag> value})
path])
([#synthesis.Pop]
[#synthesis.Bind]
[#synthesis.Access])
- (#synthesis.Bit_Fork when then else)
- (#synthesis.Bit_Fork when (recur then) (maybe\each recur else))
+ {#synthesis.Bit_Fork when then else}
+ {#synthesis.Bit_Fork when (recur then) (maybe\each recur else)}
(^template [<tag>]
- [(<tag> [[test then] elses])
- (<tag> [[test (recur then)]
+ [{<tag> [[test then] elses]}
+ {<tag> [[test (recur then)]
(list\each (function (_ [else_test else_then])
[else_test (recur else_then)])
- elses)])])
+ elses)]}])
([#synthesis.I64_Fork]
[#synthesis.F64_Fork]
[#synthesis.Text_Fork])
@@ -903,11 +903,11 @@
(-> (Dictionary Synthesis Variable) Synthesis Synthesis)
(function (recur body)
(case body
- (^template [<tag>]
- [(^ (<tag> value))
- body])
- ([#synthesis.Primitive]
- [synthesis.constant])
+ (^ {#synthesis.Primitive value})
+ body
+
+ (^ {synthesis.constant value})
+ body
(^ (synthesis.variant [lefts right? sub]))
(synthesis.variant [lefts right? (recur sub)])
@@ -957,8 +957,8 @@
(^ (synthesis.function/apply [functionS inputsS+]))
(synthesis.function/apply [(recur functionS) (list\each recur inputsS+)])
- (#synthesis.Extension [name inputsS+])
- (#synthesis.Extension [name (list\each recur inputsS+)]))))
+ {#synthesis.Extension [name inputsS+]}
+ {#synthesis.Extension [name (list\each recur inputsS+)]})))
(def: $Object
(type.class "java.lang.Object" (list)))
@@ -999,14 +999,14 @@
(def: (prepare_argument lux_register argumentT jvm_register)
(-> Register (Type Value) Register [Register Inst])
(case (type.primitive? argumentT)
- (#.Left argumentT)
+ {#.Left argumentT}
[(n.+ 1 jvm_register)
(if (n.= lux_register jvm_register)
(|>>)
(|>> (_.ALOAD jvm_register)
(_.ASTORE lux_register)))]
- (#.Right argumentT)
+ {#.Right argumentT}
(template.let [(wrap_primitive <shift> <load> <type>)
[[(n.+ <shift> jvm_register)
(|>> (<load> jvm_register)
@@ -1040,21 +1040,21 @@
(def: .public (returnI returnT)
(-> (Type Return) Inst)
(case (type.void? returnT)
- (#.Right returnT)
+ {#.Right returnT}
_.RETURN
- (#.Left returnT)
+ {#.Left returnT}
(case (type.primitive? returnT)
- (#.Left returnT)
+ {#.Left returnT}
(case (type.class? returnT)
- (#.Some class_name)
+ {#.Some class_name}
(|>> (_.CHECKCAST returnT)
_.ARETURN)
#.None
_.ARETURN)
- (#.Right returnT)
+ {#.Right returnT}
(template.let [(unwrap_primitive <return> <type>)
[(|>> (_.unwrap <type>)
<return>)]]
@@ -1102,7 +1102,7 @@
... Give them names as "foreign" variables.
list.enumeration
(list\each (function (_ [id capture])
- [capture (#variable.Foreign id)]))
+ [capture {#variable.Foreign id}]))
(dictionary.of_list synthesis.hash))
normalized_methods (list\each (function (_ [environment
[ownerT name
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux
index 2a202fbcd..7630191e9 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux
@@ -308,7 +308,7 @@
(do [! phase.monad]
[@begin _.make_label
[function_context bodyI] (case forced_context
- (#.Some function_context)
+ {#.Some function_context}
(do !
[without_context (generation.with_anchor [@begin 1]
(generate archive bodyS))]
@@ -331,7 +331,7 @@
#.None
(generation.save! (product.right function_context) #.None directive)
- (#.Some function_context)
+ {#.Some function_context}
(in []))]
(in instanceI)))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
index 9b0feeb78..3c76f44c0 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
@@ -53,10 +53,10 @@
(def: .public (variable archive variable)
(-> Archive Variable (Operation Inst))
(case variable
- (#variable.Local variable)
+ {#variable.Local variable}
(operation@in (local variable))
- (#variable.Foreign variable)
+ {#variable.Foreign variable}
(foreign archive variable)))
(def: .public (constant archive name)