From cd71a864ad5be13ed6ec6d046e0a2cb1087bdf94 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 10 Sep 2021 01:21:23 -0400 Subject: Migrated variants to the new syntax. --- lux-jvm/source/luxc/lang/directive/jvm.lux | 290 ++++++++++----------- lux-jvm/source/luxc/lang/host/jvm/def.lux | 4 +- lux-jvm/source/luxc/lang/host/jvm/inst.lux | 10 +- lux-jvm/source/luxc/lang/synthesis/variable.lux | 32 +-- lux-jvm/source/luxc/lang/translation/jvm.lux | 12 +- lux-jvm/source/luxc/lang/translation/jvm/case.lux | 20 +- .../source/luxc/lang/translation/jvm/common.lux | 40 +-- .../luxc/lang/translation/jvm/expression.lux | 2 +- .../luxc/lang/translation/jvm/extension/common.lux | 4 +- .../luxc/lang/translation/jvm/extension/host.lux | 88 +++---- .../source/luxc/lang/translation/jvm/function.lux | 4 +- .../source/luxc/lang/translation/jvm/reference.lux | 4 +- 12 files changed, 255 insertions(+), 255 deletions(-) (limited to 'lux-jvm/source/luxc') diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index b41e0b75f..b81a10c69 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -72,19 +72,19 @@ (def: (literal literal) (-> /.Literal Inst) (case literal - (#/.Boolean value) (_.boolean value) - (#/.Int value) (_.int value) - (#/.Long value) (_.long value) - (#/.Double value) (_.double value) - (#/.Char value) (_.char value) - (#/.String value) (_.string value))) + {#/.Boolean value} (_.boolean value) + {#/.Int value} (_.int value) + {#/.Long value} (_.long value) + {#/.Double value} (_.double value) + {#/.Char value} (_.char value) + {#/.String value} (_.string value))) (def: (constant instruction) (-> /.Constant Inst) (case instruction - (#/.BIPUSH constant) (_.BIPUSH constant) + {#/.BIPUSH constant} (_.BIPUSH constant) - (#/.SIPUSH constant) (_.SIPUSH constant) + {#/.SIPUSH constant} (_.SIPUSH constant) #/.ICONST_M1 _.ICONST_M1 #/.ICONST_0 _.ICONST_0 @@ -106,7 +106,7 @@ #/.ACONST_NULL _.NULL - (#/.LDC literal) + {#/.LDC literal} (..literal literal) )) @@ -153,16 +153,16 @@ (def: (arithmetic instruction) (-> /.Arithmetic Inst) (case instruction - (#/.Int_Arithmetic int_arithmetic) + {#/.Int_Arithmetic int_arithmetic} (..int_arithmetic int_arithmetic) - (#/.Long_Arithmetic long_arithmetic) + {#/.Long_Arithmetic long_arithmetic} (..long_arithmetic long_arithmetic) - (#/.Float_Arithmetic float_arithmetic) + {#/.Float_Arithmetic float_arithmetic} (..float_arithmetic float_arithmetic) - (#/.Double_Arithmetic double_arithmetic) + {#/.Double_Arithmetic double_arithmetic} (..double_arithmetic double_arithmetic))) (def: (int_bitwise instruction) @@ -188,10 +188,10 @@ (def: (bitwise instruction) (-> /.Bitwise Inst) (case instruction - (#/.Int_Bitwise int_bitwise) + {#/.Int_Bitwise int_bitwise} (..int_bitwise int_bitwise) - (#/.Long_Bitwise long_bitwise) + {#/.Long_Bitwise long_bitwise} (..long_bitwise long_bitwise))) (def: (conversion instruction) @@ -221,8 +221,8 @@ (case instruction #/.ARRAYLENGTH _.ARRAYLENGTH - (#/.NEWARRAY type) (_.NEWARRAY type) - (#/.ANEWARRAY type) (_.ANEWARRAY type) + {#/.NEWARRAY type} (_.NEWARRAY type) + {#/.ANEWARRAY type} (_.ANEWARRAY type) #/.BALOAD _.BALOAD #/.BASTORE _.BASTORE @@ -252,20 +252,20 @@ (-> /.Object Inst) (case instruction (^template [ ] - [( class field_name field_type) + [{ class field_name field_type} ( class field_name field_type)]) ([#/.GETSTATIC _.GETSTATIC] [#/.PUTSTATIC _.PUTSTATIC] [#/.GETFIELD _.GETFIELD] [#/.PUTFIELD _.PUTFIELD]) - (#/.NEW type) (_.NEW type) + {#/.NEW type} (_.NEW type) - (#/.INSTANCEOF type) (_.INSTANCEOF type) - (#/.CHECKCAST type) (_.CHECKCAST type) + {#/.INSTANCEOF type} (_.INSTANCEOF type) + {#/.CHECKCAST type} (_.CHECKCAST type) (^template [ ] - [( class method_name method_type) + [{ class method_name method_type} ( class method_name method_type)]) ([#/.INVOKEINTERFACE _.INVOKEINTERFACE] [#/.INVOKESPECIAL _.INVOKESPECIAL] @@ -276,42 +276,42 @@ (def: (local_int instruction) (-> /.Local_Int Inst) (case instruction - (#/.ILOAD register) (_.ILOAD register) - (#/.ISTORE register) (_.ISTORE register))) + {#/.ILOAD register} (_.ILOAD register) + {#/.ISTORE register} (_.ISTORE register))) (def: (local_long instruction) (-> /.Local_Long Inst) (case instruction - (#/.LLOAD register) (_.LLOAD register) - (#/.LSTORE register) (_.LSTORE register))) + {#/.LLOAD register} (_.LLOAD register) + {#/.LSTORE register} (_.LSTORE register))) (def: (local_float instruction) (-> /.Local_Float Inst) (case instruction - (#/.FLOAD register) (_.FLOAD register) - (#/.FSTORE register) (_.FSTORE register))) + {#/.FLOAD register} (_.FLOAD register) + {#/.FSTORE register} (_.FSTORE register))) (def: (local_double instruction) (-> /.Local_Double Inst) (case instruction - (#/.DLOAD register) (_.DLOAD register) - (#/.DSTORE register) (_.DSTORE register))) + {#/.DLOAD register} (_.DLOAD register) + {#/.DSTORE register} (_.DSTORE register))) (def: (local_object instruction) (-> /.Local_Object Inst) (case instruction - (#/.ALOAD register) (_.ALOAD register) - (#/.ASTORE register) (_.ASTORE register))) + {#/.ALOAD register} (_.ALOAD register) + {#/.ASTORE register} (_.ASTORE register))) (def: (local instruction) (-> /.Local Inst) (case instruction - (#/.Local_Int instruction) (..local_int instruction) - (#/.IINC register) (_.IINC register) - (#/.Local_Long instruction) (..local_long instruction) - (#/.Local_Float instruction) (..local_float instruction) - (#/.Local_Double instruction) (..local_double instruction) - (#/.Local_Object instruction) (..local_object instruction))) + {#/.Local_Int instruction} (..local_int instruction) + {#/.IINC register} (_.IINC register) + {#/.Local_Long instruction} (..local_long instruction) + {#/.Local_Float instruction} (..local_float instruction) + {#/.Local_Double instruction} (..local_double instruction) + {#/.Local_Object instruction} (..local_object instruction))) (def: (stack instruction) (-> /.Stack Inst) @@ -340,34 +340,34 @@ (def: (branching instruction) (-> (/.Branching org/objectweb/asm/Label) Inst) (case instruction - (#/.IF_ICMPEQ label) (_.IF_ICMPEQ label) - (#/.IF_ICMPGE label) (_.IF_ICMPGE label) - (#/.IF_ICMPGT label) (_.IF_ICMPGT label) - (#/.IF_ICMPLE label) (_.IF_ICMPLE label) - (#/.IF_ICMPLT label) (_.IF_ICMPLT label) - (#/.IF_ICMPNE label) (_.IF_ICMPNE label) - (#/.IFEQ label) (_.IFEQ label) - (#/.IFGE label) (_.IFGE label) - (#/.IFGT label) (_.IFGT label) - (#/.IFLE label) (_.IFLE label) - (#/.IFLT label) (_.IFLT label) - (#/.IFNE label) (_.IFNE label) - - (#/.TABLESWITCH min max default labels) + {#/.IF_ICMPEQ label} (_.IF_ICMPEQ label) + {#/.IF_ICMPGE label} (_.IF_ICMPGE label) + {#/.IF_ICMPGT label} (_.IF_ICMPGT label) + {#/.IF_ICMPLE label} (_.IF_ICMPLE label) + {#/.IF_ICMPLT label} (_.IF_ICMPLT label) + {#/.IF_ICMPNE label} (_.IF_ICMPNE label) + {#/.IFEQ label} (_.IFEQ label) + {#/.IFGE label} (_.IFGE label) + {#/.IFGT label} (_.IFGT label) + {#/.IFLE label} (_.IFLE label) + {#/.IFLT label} (_.IFLT label) + {#/.IFNE label} (_.IFNE label) + + {#/.TABLESWITCH min max default labels} (_.TABLESWITCH min max default labels) - (#/.LOOKUPSWITCH default keys+labels) + {#/.LOOKUPSWITCH default keys+labels} (_.LOOKUPSWITCH default keys+labels) - (#/.IF_ACMPEQ label) (_.IF_ACMPEQ label) - (#/.IF_ACMPNE label) (_.IF_ACMPNE label) - (#/.IFNONNULL label) (_.IFNONNULL label) - (#/.IFNULL label) (_.IFNULL label))) + {#/.IF_ACMPEQ label} (_.IF_ACMPEQ label) + {#/.IF_ACMPNE label} (_.IF_ACMPNE label) + {#/.IFNONNULL label} (_.IFNONNULL label) + {#/.IFNULL label} (_.IFNULL label))) (def: (exception instruction) (-> (/.Exception org/objectweb/asm/Label) Inst) (case instruction - (#/.Try start end handler exception) (_.try start end handler exception) + {#/.Try start end handler exception} (_.try start end handler exception) #/.ATHROW _.ATHROW)) (def: (concurrency instruction) @@ -389,27 +389,27 @@ (def: (control instruction) (-> (/.Control org/objectweb/asm/Label) Inst) (case instruction - (#/.GOTO label) (_.GOTO label) - (#/.Branching instruction) (..branching instruction) - (#/.Exception instruction) (..exception instruction) - (#/.Concurrency instruction) (..concurrency instruction) - (#/.Return instruction) (..return instruction))) + {#/.GOTO label} (_.GOTO label) + {#/.Branching instruction} (..branching instruction) + {#/.Exception instruction} (..exception instruction) + {#/.Concurrency instruction} (..concurrency instruction) + {#/.Return instruction} (..return instruction))) (def: (instruction instruction) (-> (/.Instruction Inst org/objectweb/asm/Label) Inst) (case instruction #/.NOP _.NOP - (#/.Constant instruction) (..constant instruction) - (#/.Arithmetic instruction) (..arithmetic instruction) - (#/.Bitwise instruction) (..bitwise instruction) - (#/.Conversion instruction) (..conversion instruction) - (#/.Array instruction) (..array instruction) - (#/.Object instruction) (..object instruction) - (#/.Local instruction) (..local instruction) - (#/.Stack instruction) (..stack instruction) - (#/.Comparison instruction) (..comparison instruction) - (#/.Control instruction) (..control instruction) - (#/.Embedded embedded) embedded)) + {#/.Constant instruction} (..constant instruction) + {#/.Arithmetic instruction} (..arithmetic instruction) + {#/.Bitwise instruction} (..bitwise instruction) + {#/.Conversion instruction} (..conversion instruction) + {#/.Array instruction} (..array instruction) + {#/.Object instruction} (..object instruction) + {#/.Local instruction} (..local instruction) + {#/.Stack instruction} (..stack instruction) + {#/.Comparison instruction} (..comparison instruction) + {#/.Control instruction} (..control instruction) + {#/.Embedded embedded} embedded)) (type: Mapping (Dictionary /.Label org/objectweb/asm/Label)) @@ -421,7 +421,7 @@ (def: (relabel [mapping label]) (Re_labeler Identity) (case (dictionary.value label mapping) - (#.Some label) + {#.Some label} [mapping label] #.None @@ -432,39 +432,39 @@ (Re_labeler /.Branching) (case instruction (^template [] - [( label) + [{ label} (let [[mapping label] (..relabel [mapping label])] - [mapping ( label)])]) + [mapping { label}])]) ([#/.IF_ICMPEQ] [#/.IF_ICMPGE] [#/.IF_ICMPGT] [#/.IF_ICMPLE] [#/.IF_ICMPLT] [#/.IF_ICMPNE] [#/.IFEQ] [#/.IFNE] [#/.IFGE] [#/.IFGT] [#/.IFLE] [#/.IFLT] [#/.IF_ACMPEQ] [#/.IF_ACMPNE] [#/.IFNONNULL] [#/.IFNULL]) - (#/.TABLESWITCH min max default labels) + {#/.TABLESWITCH min max default labels} (let [[mapping default] (..relabel [mapping default]) [mapping labels] (list\mix (function (_ input [mapping output]) (let [[mapping input] (..relabel [mapping input])] [mapping (list& input output)])) [mapping (list)] labels)] - [mapping (#/.TABLESWITCH min max default (list.reversed labels))]) + [mapping {#/.TABLESWITCH min max default (list.reversed labels)}]) - (#/.LOOKUPSWITCH default keys+labels) + {#/.LOOKUPSWITCH default keys+labels} (let [[mapping default] (..relabel [mapping default]) [mapping keys+labels] (list\mix (function (_ [expected input] [mapping output]) (let [[mapping input] (..relabel [mapping input])] [mapping (list& [expected input] output)])) [mapping (list)] keys+labels)] - [mapping (#/.LOOKUPSWITCH default (list.reversed keys+labels))]) + [mapping {#/.LOOKUPSWITCH default (list.reversed keys+labels)}]) )) (def: (relabel_exception [mapping instruction]) (Re_labeler /.Exception) (case instruction - (#/.Try start end handler exception) + {#/.Try start end handler exception} (let [[mapping start] (..relabel [mapping start]) [mapping end] (..relabel [mapping end]) [mapping handler] (..relabel [mapping handler])] - [mapping (#/.Try start end handler exception)]) + [mapping {#/.Try start end handler exception}]) #/.ATHROW [mapping #/.ATHROW] @@ -474,31 +474,31 @@ (Re_labeler /.Control) (case instruction (^template [ ] - [( instruction) + [{ instruction} (let [[mapping instruction] ( [mapping instruction])] - [mapping ( instruction)])]) + [mapping { instruction}])]) ([#/.GOTO ..relabel] [#/.Branching ..relabel_branching] [#/.Exception ..relabel_exception]) (^template [] - [( instruction) - [mapping ( instruction)]]) + [{ instruction} + [mapping { instruction}]]) ([#/.Concurrency] [#/.Return]) )) (def: (relabel_instruction [mapping instruction]) (Re_labeler (/.Instruction Inst)) (case instruction - (#/.Embedded embedded) - [mapping (#/.Embedded embedded)] + {#/.Embedded embedded} + [mapping {#/.Embedded embedded}] #/.NOP [mapping #/.NOP] (^template [] - [( instruction) - [mapping ( instruction)]]) + [{ instruction} + [mapping { instruction}]]) ([#/.Constant] [#/.Arithmetic] [#/.Bitwise] @@ -509,9 +509,9 @@ [#/.Stack] [#/.Comparison]) - (#/.Control instruction) + {#/.Control instruction} (let [[mapping instruction] (..relabel_control [mapping instruction])] - [mapping (#/.Control instruction)]))) + [mapping {#/.Control instruction}]))) (def: (relabel_bytecode [mapping bytecode]) (Re_labeler (/.Bytecode Inst)) @@ -587,10 +587,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 %.code input])))) (type: Declaration @@ -716,11 +716,11 @@ (type: (Method a) (Variant - (#Constructor (Constructor a)) - (#Override (Override a)) - (#Virtual (Virtual a)) - (#Static (Static a)) - (#Abstract Abstract))) + {#Constructor (Constructor a)} + {#Override (Override a)} + {#Virtual (Virtual a)} + {#Static (Static a)} + {#Abstract Abstract})) (def: constructor (Parser (Constructor Code)) @@ -843,10 +843,10 @@ (def: (header_value valueT) (-> (Type Value) Inst) (case (/type.primitive? valueT) - (#.Left classT) + {#.Left classT} _.NULL - (#.Right primitiveT) + {#.Right primitiveT} (cond (or (\ /type.equivalence = /type.boolean primitiveT) (\ /type.equivalence = /type.byte primitiveT) (\ /type.equivalence = /type.short primitiveT) @@ -866,16 +866,16 @@ (def: (header_return returnT) (-> (Type Return) Inst) (case (/type.void? returnT) - (#.Right returnT) + {#.Right returnT} _.RETURN - (#.Left valueT) + {#.Left valueT} (case (/type.primitive? valueT) - (#.Left classT) + {#.Left classT} (|>> (header_value classT) _.ARETURN) - (#.Right primitiveT) + {#.Right primitiveT} (cond (or (\ /type.equivalence = /type.boolean primitiveT) (\ /type.equivalence = /type.byte primitiveT) (\ /type.equivalence = /type.short primitiveT) @@ -911,9 +911,9 @@ (def: (method_header super_class method) (-> (Type Class) (Method Code) jvm.Def) (case method - (#Constructor [privacy strict_floating_point? annotations variables exceptions + {#Constructor [privacy strict_floating_point? annotations variables exceptions self arguments constructor_arguments - body]) + body]} (let [[super_name super_vars] (parser.read_class super_class) init_constructor_arguments (|> constructor_arguments (list\each (|>> product.left ..header_value)) @@ -933,9 +933,9 @@ (_.INVOKESPECIAL super_class ..constructor_name super_constructorT) _.RETURN))) - (#Override [[parent_name parent_variables] name strict_floating_point? annotations variables + {#Override [[parent_name parent_variables] name strict_floating_point? annotations variables self arguments return exceptions - body]) + body]} (def.method #jvm.Public (if strict_floating_point? jvm.strictM @@ -944,9 +944,9 @@ (/type.method [variables (list\each product.right arguments) return exceptions]) (..header_return return)) - (#Virtual [name privacy final? strict_floating_point? annotations variables + {#Virtual [name privacy final? strict_floating_point? annotations variables self arguments return exceptions - body]) + body]} (def.method (..visibility privacy) (|> jvm.noneM (jvm.++M (if strict_floating_point? @@ -959,9 +959,9 @@ (/type.method [variables (list\each product.right arguments) return exceptions]) (..header_return return)) - (#Static [name privacy strict_floating_point? annotations variables + {#Static [name privacy strict_floating_point? annotations variables arguments return exceptions - body]) + body]} (def.method (..visibility privacy) (|> jvm.staticM (jvm.++M (if strict_floating_point? @@ -971,7 +971,7 @@ (/type.method [variables (list\each product.right arguments) return exceptions]) (..header_return return)) - (#Abstract method) + {#Abstract method} (..abstract_method_generation method) )) @@ -1033,7 +1033,7 @@ arguments) returnT (//A.boxed_reflection_return mapping /type.void) [_scope bodyA] (|> arguments' - (#.Item [self selfT]) + {#.Item [self selfT]} list.reversed (list\mix scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) @@ -1063,7 +1063,7 @@ arguments) returnT (//A.boxed_reflection_return mapping returnJ) [_scope bodyA] (|> arguments' - (#.Item [self selfT]) + {#.Item [self selfT]} list.reversed (list\mix scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) @@ -1091,7 +1091,7 @@ arguments) returnT (//A.boxed_reflection_return mapping returnJ) [_scope bodyA] (|> arguments' - (#.Item [self selfT]) + {#.Item [self selfT]} list.reversed (list\mix scopeA.with_local (analyse archive bodyC)) (typeA.with_type returnT) @@ -1128,24 +1128,24 @@ (def: (method_analysis archive declaration supers method) (-> Archive Declaration (List (Type Class)) (Method Code) (Operation (Method Analysis))) (case method - (#Constructor method) + {#Constructor method} (\ phase.monad each (|>> #Constructor) (constructor_method_analysis archive declaration method)) - (#Override method) + {#Override method} (\ phase.monad each (|>> #Override) (override_method_analysis archive declaration supers method)) - (#Virtual method) + {#Virtual method} (\ phase.monad each (|>> #Virtual) (virtual_method_analysis archive declaration method)) - (#Static method) + {#Static method} (\ phase.monad each (|>> #Static) (static_method_analysis archive method)) - (#Abstract method) - (\ phase.monad in (#Abstract method)) + {#Abstract method} + (\ phase.monad in {#Abstract method}) )) (template: (method_body ) @@ -1168,7 +1168,7 @@ (\ ! each (|>> [typeJ]) (synthesise archive termA))) constructor_argumentsA) - bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] + bodyS (synthesise archive {#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)})] (in [privacy strict_floating_point? annotations method_tvars exceptions self arguments constructor_argumentsS (case bodyS @@ -1187,7 +1187,7 @@ synthesise directive.synthesis] (directive.lifted_synthesis (do ! - [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] + [bodyS (synthesise archive {#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)})] (in [[super_name super_tvars] method_name strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ (case bodyS @@ -1206,7 +1206,7 @@ synthesise directive.synthesis] (directive.lifted_synthesis (do ! - [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] + [bodyS (synthesise archive {#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)})] (in [name privacy final? strict_floating_point? annotations method_tvars self arguments returnJ exceptionsJ (case bodyS @@ -1225,7 +1225,7 @@ synthesise directive.synthesis] (directive.lifted_synthesis (do ! - [bodyS (synthesise archive (#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)))] + [bodyS (synthesise archive {#analysis.Function (list) (//A.hide_method_body (list.size arguments) bodyA)})] (in [name privacy strict_floating_point? annotations method_tvars arguments returnJ exceptionsJ (case bodyS @@ -1238,24 +1238,24 @@ (def: (method_synthesis archive method) (-> Archive (Method Analysis) (Operation (Method Synthesis))) (case method - (#Constructor method) + {#Constructor method} (\ phase.monad each (|>> #Constructor) (constructor_method_synthesis archive method)) - (#Override method) + {#Override method} (\ phase.monad each (|>> #Override) (override_method_synthesis archive method)) - (#Virtual method) + {#Virtual method} (\ phase.monad each (|>> #Virtual) (virtual_method_synthesis archive method)) - (#Static method) + {#Static method} (\ phase.monad each (|>> #Static) (static_method_synthesis archive method)) - (#Abstract method) - (\ phase.monad in (#Abstract method)) + {#Abstract method} + (\ phase.monad in {#Abstract method}) )) (def: (constructor_method_generation archive super_class method) @@ -1363,19 +1363,19 @@ (def: (method_generation archive super_class method) (-> Archive (Type Class) (Method Synthesis) (Operation jvm.Def)) (case method - (#Constructor method) + {#Constructor method} (..constructor_method_generation archive super_class method) - (#Override method) + {#Override method} (..override_method_generation archive method) - (#Virtual method) + {#Virtual method} (..virtual_method_generation archive method) - (#Static method) + {#Static method} (..static_method_generation archive method) - (#Abstract method) + {#Abstract method} (\ phase.monad in (..abstract_method_generation method)) )) @@ -1384,13 +1384,13 @@ (def: (convert_overriden_method method) (-> (Method Code) (Maybe (//A.Overriden_Method Code))) (case method - (#Override [[parent_name parent_variables] method_name strict_floating_point? annotations variables + {#Override [[parent_name parent_variables] method_name strict_floating_point? annotations variables self arguments return exceptions - body]) - (#.Some [(/type.class parent_name parent_variables) method_name + body]} + {#.Some [(/type.class parent_name parent_variables) method_name strict_floating_point? (list) variables self arguments return exceptions - body]) + body]} _ #.None)) @@ -1445,7 +1445,7 @@ (do ! [artifact_id (generation.learn_custom class_name) _ (generation.execute! directive) - _ (generation.save! artifact_id (#.Some class_name) directive) + _ (generation.save! artifact_id {#.Some class_name} directive) _ (generation.log! (format "JVM Class " (%.text class_name)))] (in directive.no_requirements)))))])) @@ -1472,7 +1472,7 @@ (do ! [artifact_id (generation.learn_custom class_name) _ (generation.execute! directive) - _ (generation.save! artifact_id (#.Some class_name) directive) + _ (generation.save! artifact_id {#.Some class_name} directive) _ (generation.log! (format "JVM Interface " (%.text class_name)))] (in directive.no_requirements)))))])) diff --git a/lux-jvm/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux index 36aed2d61..ecafc00d2 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/def.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux @@ -296,8 +296,8 @@ #.End function.identity - (#.Item singleton #.End) + {#.Item singleton #.End} singleton - (#.Item head tail) + {#.Item head tail} (function.composite (fuse tail) head))) diff --git a/lux-jvm/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux index 2255774f8..bbeffb023 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/inst.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux @@ -152,7 +152,7 @@ (def: .public make_label (All (_ s) (Operation s org/objectweb/asm/Label)) (function (_ state) - (#try.Success [state (org/objectweb/asm/Label::new)]))) + {#try.Success [state (org/objectweb/asm/Label::new)]})) (def: .public (with_label action) (All (_ a) (-> (-> org/objectweb/asm/Label a) a)) @@ -414,10 +414,10 @@ (def: .public (array elementT) (-> (Type Value) Inst) (case (type.primitive? elementT) - (#.Left elementT) + {#.Left elementT} (ANEWARRAY elementT) - (#.Right elementT) + {#.Right elementT} (NEWARRAY elementT))) (template [ ] @@ -462,8 +462,8 @@ #.End function.identity - (#.Item singleton #.End) + {#.Item singleton #.End} singleton - (#.Item head tail) + {#.Item head tail} (function.composite (fuse tail) head))) diff --git a/lux-jvm/source/luxc/lang/synthesis/variable.lux b/lux-jvm/source/luxc/lang/synthesis/variable.lux index 12594e154..685eaae92 100644 --- a/lux-jvm/source/luxc/lang/synthesis/variable.lux +++ b/lux-jvm/source/luxc/lang/synthesis/variable.lux @@ -11,10 +11,10 @@ (def: (bound-vars path) (-> ls.Path (List Variable)) (case path - (#ls.BindP register) + {#ls.BindP register} (list (.int register)) - (^or (#ls.SeqP pre post) (#ls.AltP pre post)) + (^or {#ls.SeqP pre post} {#ls.AltP pre post}) (list/composite (bound-vars pre) (bound-vars post)) _ @@ -23,13 +23,13 @@ (def: (path-bodies path) (-> ls.Path (List ls.Synthesis)) (case path - (#ls.ExecP body) + {#ls.ExecP body} (list body) - (#ls.SeqP pre post) + {#ls.SeqP pre post} (path-bodies post) - (#ls.AltP pre post) + {#ls.AltP pre post} (list/composite (path-bodies pre) (path-bodies post)) _ @@ -49,40 +49,40 @@ (let [tracker (loop [exprS exprS tracker (list/mix s.has init-tracker bound)] (case exprS - (#ls.Variable var) + {#ls.Variable var} (if (non-arg? current-arity var) (s.lacks var tracker) tracker) - (#ls.Variant tag last? memberS) + {#ls.Variant tag last? memberS} (recur memberS tracker) - (#ls.Tuple membersS) + {#ls.Tuple membersS} (list/mix recur tracker membersS) - (#ls.Call funcS argsS) + {#ls.Call funcS argsS} (list/mix recur (recur funcS tracker) argsS) - (^or (#ls.Recur argsS) - (#ls.Procedure name argsS)) + (^or {#ls.Recur argsS} + {#ls.Procedure name argsS}) (list/mix recur tracker argsS) - (#ls.Let offset inputS outputS) + {#ls.Let offset inputS outputS} (|> tracker (recur inputS) (recur outputS)) - (#ls.If testS thenS elseS) + {#ls.If testS thenS elseS} (|> tracker (recur testS) (recur thenS) (recur elseS)) - (#ls.Loop offset initsS bodyS) + {#ls.Loop offset initsS bodyS} (recur bodyS (list/mix recur tracker initsS)) - (#ls.Case inputS outputPS) + {#ls.Case inputS outputPS} (let [tracker' (list/mix s.has (recur inputS tracker) (bound-vars outputPS))] (list/mix recur tracker' (path-bodies outputPS))) - (#ls.Function arity env bodyS) + {#ls.Function arity env bodyS} (list/mix s.lacks tracker env) _ diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux index db7b5b3fa..6a641f0ee 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) + {#try.Success field} (case (java/lang/reflect/Field::get #.None field) - (#try.Success ?value) + {#try.Success ?value} (case ?value - (#.Some value) - (#try.Success value) + {#.Some value} + {#try.Success value} #.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 ".") 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 [ ] - [( cons) + [{ cons} (do [@ phase.monad] [forkG (: (Operation Inst) (monad.mix @ (function (_ [test thenP] elseG) @@ -146,7 +146,7 @@ elseG))))) (|>> (_.GOTO @else)) - (#.Item cons)))] + {#.Item cons}))] (in (|>> peekI 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 (.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 (.then parser.array .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 [] - [(^ ( leftP rightP)) - ( (recur leftP) (recur rightP))]) + [(^ { leftP rightP}) + { (recur leftP) (recur rightP)}]) ([#synthesis.Alt] [#synthesis.Seq]) (^template [] - [(^ ( value)) + [(^ { 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 [] - [( [[test then] elses]) - ( [[test (recur then)] + [{ [[test then] elses]} + { [[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 [] - [(^ ( 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 ) [[(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 _.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 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) -- cgit v1.2.3