From dda05bca0956af5e5b3875c4cc36e61aa04772e4 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 12 Sep 2021 00:07:08 -0400 Subject: Made the "#" character great again! --- lux-jvm/source/luxc/lang/translation/jvm.lux | 24 ++--- lux-jvm/source/luxc/lang/translation/jvm/case.lux | 28 +++--- .../source/luxc/lang/translation/jvm/common.lux | 22 ++--- .../luxc/lang/translation/jvm/expression.lux | 2 +- .../luxc/lang/translation/jvm/extension/common.lux | 4 +- .../luxc/lang/translation/jvm/extension/host.lux | 104 ++++++++++----------- .../source/luxc/lang/translation/jvm/function.lux | 12 +-- .../source/luxc/lang/translation/jvm/program.lux | 6 +- .../source/luxc/lang/translation/jvm/reference.lux | 4 +- .../source/luxc/lang/translation/jvm/runtime.lux | 8 +- 10 files changed, 107 insertions(+), 107 deletions(-) (limited to 'lux-jvm/source/luxc/lang/translation') diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index 6a641f0ee..a44bc67e3 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm.lux @@ -83,20 +83,20 @@ (def: (class_value class_name class) (-> Text (java/lang/Class java/lang/Object) (Try Any)) (case (java/lang/Class::getField ..value_field class) - {#try.Success field} - (case (java/lang/reflect/Field::get #.None field) - {#try.Success ?value} + {try.#Success field} + (case (java/lang/reflect/Field::get {.#None} field) + {try.#Success ?value} (case ?value - {#.Some value} - {#try.Success value} + {.#Some value} + {try.#Success value} - #.None + {.#None} (exception.except ..invalid_value class_name)) - {#try.Failure error} + {try.#Failure error} (exception.except ..cannot_load [class_name error])) - {#try.Failure error} + {try.#Failure error} (exception.except ..invalid_field [class_name ..value_field error]))) (def: class_path_separator ".") @@ -116,14 +116,14 @@ (-> Library java/lang/ClassLoader generation.Context Inst (Try [Any Definition])) (let [eval_class (..class_name context) bytecode_name (..bytecode_name eval_class) - bytecode (def.class #jvm.V1_6 - #jvm.Public jvm.noneC + bytecode (def.class {jvm.#V1_6} + {jvm.#Public} jvm.noneC bytecode_name (list) $Value (list) - (|>> (def.field #jvm.Public ($_ jvm.++F jvm.finalF jvm.staticF) + (|>> (def.field {jvm.#Public} ($_ jvm.++F jvm.finalF jvm.staticF) ..value_field ..$Value) - (def.method #jvm.Public ($_ jvm.++M jvm.staticM jvm.strictM) + (def.method {jvm.#Public} ($_ jvm.++M jvm.staticM jvm.strictM) "" (type.method [(list) (list) type.void (list)]) (|>> valueI diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux index 0959130a3..04a9571a9 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux @@ -103,21 +103,21 @@ (def: (path' stack_depth @else @end phase archive path) (-> Nat Label Label Phase Archive Path (Operation Inst)) (.case path - #synthesis.Pop + {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 + {.#None} (in (_.GOTO @else))) .let [ifI (.if when _.IFEQ _.IFNE)]] (in (<| _.with_label (function (_ @else)) @@ -146,17 +146,17 @@ elseG))))) (|>> (_.GOTO @else)) - {#.Item cons}))] + {.#Item cons}))] (in (|>> 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" ..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 2dade7a97..456a20694 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/common.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/common.lux @@ -31,22 +31,22 @@ ... (def: .public (with-artifacts action) ... (All (_ a) (-> (Meta a) (Meta [Artifacts a]))) ... (function (_ state) -... (case (action (revised@ #.host +... (case (action (revised@ .#host ... (|>> (:coerce Host) ... (with@ #artifacts (dictionary.new text.hash)) ... (:coerce Nothing)) ... state)) -... {#try.Success [state' output]} -... {#try.Success [(revised@ #.host +... {try.#Success [state' output]} +... {try.#Success [(revised@ .#host ... (|>> (:coerce Host) -... (with@ #artifacts (|> (value@ #.host state) (:coerce Host) (value@ #artifacts))) +... (with@ #artifacts (|> (value@ .#host state) (:coerce Host) (value@ #artifacts))) ... (:coerce Nothing)) ... state') -... [(|> state' (value@ #.host) (:coerce Host) (value@ #artifacts)) +... [(|> 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))) @@ -59,14 +59,14 @@ ... class (..load-class class-name)] ... (case (do try.monad ... [field (Class::getField [..value-field] class)] -... (Field::get [#.None] field)) -... {#try.Success {#.Some def-value}} +... (Field::get [{.#None}] field)) +... {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" diff --git a/lux-jvm/source/luxc/lang/translation/jvm/expression.lux b/lux-jvm/source/luxc/lang/translation/jvm/expression.lux index a460ad96b..55e81812d 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 8d92a68eb..78048379c 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 (.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 5eda6443d..930e219a5 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux @@ -96,15 +96,15 @@ (do <>.monad [arrayJT (.then parser.array .text)] (case (parser.array? arrayJT) - {#.Some elementJT} + {.#Some elementJT} (case (parser.object? elementJT) - {#.Some elementJT} + {.#Some elementJT} (in elementJT) - #.None + {.#None} (<>.failure (exception.error ..not_an_object_array [arrayJT]))) - #.None + {.#None} (undefined)))) (template [ ] @@ -629,10 +629,10 @@ (do phase.monad [] (case (dictionary.value unboxed ..primitives) - {#.Some primitive} + {.#Some primitive} (in (_.GETSTATIC (type.class class (list)) field primitive)) - #.None + {.#None} (in (_.GETSTATIC (type.class class (list)) field (type.class unboxed (list)))))))])) (def: put::static @@ -644,12 +644,12 @@ [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))) - #.None + {.#None} (in (|>> valueI (_.CHECKCAST $class) (_.PUTSTATIC $class field $class) @@ -664,10 +664,10 @@ [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 + {.#None} (_.GETFIELD $class field (type.class unboxed (list))))]] (in (|>> objectI (_.CHECKCAST $class) @@ -683,10 +683,10 @@ 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 + {.#None} (let [$unboxed (type.class unboxed (list))] (|>> (_.CHECKCAST $unboxed) (_.PUTFIELD $class field $unboxed))))]] @@ -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 _}) + (^or {synthesis.#Pop} + {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)) _ @@ -875,18 +875,18 @@ (^template [] [(^ { leftP rightP}) { (recur leftP) (recur rightP)}]) - ([#synthesis.Alt] - [#synthesis.Seq]) + ([synthesis.#Alt] + [synthesis.#Seq]) (^template [] - [(^ { value}) + [(^ { _}) path]) - ([#synthesis.Pop] - [#synthesis.Bind] - [#synthesis.Access]) + ([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 [] [{ [[test then] elses]} @@ -894,16 +894,16 @@ (list\each (function (_ [else_test else_then]) [else_test (recur else_then)]) elses)]}]) - ([#synthesis.I64_Fork] - [#synthesis.F64_Fork] - [#synthesis.Text_Fork]) + ([synthesis.#I64_Fork] + [synthesis.#F64_Fork] + [synthesis.#Text_Fork]) ))) (def: (normalize_method_body mapping) (-> (Dictionary Synthesis Variable) Synthesis Synthesis) (function (recur body) (case body - (^ {#synthesis.Primitive value}) + (^ {synthesis.#Primitive value}) body (^ (synthesis.constant value)) @@ -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 ) [[(n.+ jvm_register) (|>> ( 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 + {.#None} _.ARETURN) - {#.Right returnT} + {.#Right returnT} (template.let [(unwrap_primitive ) [(|>> (_.unwrap ) )]] @@ -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 @@ -1150,7 +1150,7 @@ (..with_anonymous_init class total_environment super_class inputsTI) method_definitions))]] _ (generation.execute! directive) - _ (generation.save! artifact_id #.None directive)] + _ (generation.save! artifact_id {.#None} directive)] (..anonymous_instance generate archive class total_environment)))])) (def: class_bundle diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux index 7630191e9..458683ec2 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux @@ -308,14 +308,14 @@ (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))] (in [function_context without_context])) - #.None + {.#None} (generation.with_new_context archive (generation.with_anchor [@begin 1] (generate archive bodyS)))) @@ -328,16 +328,16 @@ functionD)]] _ (generation.execute! directive) _ (case forced_context - #.None - (generation.save! (product.right function_context) #.None directive) + {.#None} + (generation.save! (product.right function_context) {.#None} directive) - {#.Some function_context} + {.#Some function_context} (in []))] (in instanceI))) (def: .public function (Generator Abstraction) - (..function' #.None)) + (..function' {.#None})) (def: .public (call generate archive [functionS argsS]) (Generator Apply) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/program.lux b/lux-jvm/source/luxc/lang/translation/jvm/program.lux index 1db9028d1..266938286 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/program.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/program.lux @@ -79,12 +79,12 @@ (list)]) class (artifact_name context)] [class - ($d.class #_.V1_6 - #_.Public _.finalC + ($d.class {_.#V1_6} + {_.#Public} _.finalC class (list) ..^Object (list) - (|>> ($d.method #_.Public _.staticM "main" main_type + (|>> ($d.method {_.#Public} _.staticM "main" main_type (|>> programI prepare_input_listI feed_inputsI diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux index 3c76f44c0..1c1beda17 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) diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux index 8deac8430..995d82e47 100644 --- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux +++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux @@ -364,8 +364,8 @@ directive [runtime_class bytecode]] (do phase.monad [_ (generation.execute! directive) - _ (generation.save! ..runtime_id #.None directive)] - (in [..runtime_id #.None bytecode])))) + _ (generation.save! ..runtime_id {.#None} directive)] + (in [..runtime_id {.#None} bytecode])))) (def: function_id 1) @@ -401,8 +401,8 @@ directive [function_class bytecode]] (do phase.monad [_ (generation.execute! directive) - _ (generation.save! ..function_id #.None directive)] - (in [..function_id #.None bytecode])))) + _ (generation.save! ..function_id {.#None} directive)] + (in [..function_id {.#None} bytecode])))) (def: .public translate (Operation [Registry Output]) -- cgit v1.2.3