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/directive/jvm.lux | 542 ++++++++++----------- lux-jvm/source/luxc/lang/host/jvm.lux | 24 +- lux-jvm/source/luxc/lang/host/jvm/def.lux | 48 +- lux-jvm/source/luxc/lang/host/jvm/inst.lux | 12 +- lux-jvm/source/luxc/lang/synthesis/variable.lux | 33 +- 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 +- lux-jvm/source/program.lux | 34 +- lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux | 46 +- lux-jvm/test/test/luxc/lang/synthesis/loop.lux | 22 +- .../test/test/luxc/lang/synthesis/procedure.lux | 2 +- lux-jvm/test/test/luxc/lang/translation/js.lux | 34 +- lux-jvm/test/test/luxc/lang/translation/jvm.lux | 104 ++-- 21 files changed, 558 insertions(+), 557 deletions(-) (limited to 'lux-jvm') diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux index b81a10c69..36a498cda 100644 --- a/lux-jvm/source/luxc/lang/directive/jvm.lux +++ b/lux-jvm/source/luxc/lang/directive/jvm.lux @@ -72,181 +72,181 @@ (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) - - #/.ICONST_M1 _.ICONST_M1 - #/.ICONST_0 _.ICONST_0 - #/.ICONST_1 _.ICONST_1 - #/.ICONST_2 _.ICONST_2 - #/.ICONST_3 _.ICONST_3 - #/.ICONST_4 _.ICONST_4 - #/.ICONST_5 _.ICONST_5 - - #/.LCONST_0 _.LCONST_0 - #/.LCONST_1 _.LCONST_1 + {/.#SIPUSH constant} (_.SIPUSH constant) + + {/.#ICONST_M1} _.ICONST_M1 + {/.#ICONST_0} _.ICONST_0 + {/.#ICONST_1} _.ICONST_1 + {/.#ICONST_2} _.ICONST_2 + {/.#ICONST_3} _.ICONST_3 + {/.#ICONST_4} _.ICONST_4 + {/.#ICONST_5} _.ICONST_5 + + {/.#LCONST_0} _.LCONST_0 + {/.#LCONST_1} _.LCONST_1 - #/.FCONST_0 _.FCONST_0 - #/.FCONST_1 _.FCONST_1 - #/.FCONST_2 _.FCONST_2 + {/.#FCONST_0} _.FCONST_0 + {/.#FCONST_1} _.FCONST_1 + {/.#FCONST_2} _.FCONST_2 - #/.DCONST_0 _.DCONST_0 - #/.DCONST_1 _.DCONST_1 + {/.#DCONST_0} _.DCONST_0 + {/.#DCONST_1} _.DCONST_1 - #/.ACONST_NULL _.NULL + {/.#ACONST_NULL} _.NULL - {#/.LDC literal} + {/.#LDC literal} (..literal literal) )) (def: (int_arithmetic instruction) (-> /.Int_Arithmetic Inst) (case instruction - #/.IADD _.IADD - #/.ISUB _.ISUB - #/.IMUL _.IMUL - #/.IDIV _.IDIV - #/.IREM _.IREM - #/.INEG _.INEG)) + {/.#IADD} _.IADD + {/.#ISUB} _.ISUB + {/.#IMUL} _.IMUL + {/.#IDIV} _.IDIV + {/.#IREM} _.IREM + {/.#INEG} _.INEG)) (def: (long_arithmetic instruction) (-> /.Long_Arithmetic Inst) (case instruction - #/.LADD _.LADD - #/.LSUB _.LSUB - #/.LMUL _.LMUL - #/.LDIV _.LDIV - #/.LREM _.LREM - #/.LNEG _.LNEG)) + {/.#LADD} _.LADD + {/.#LSUB} _.LSUB + {/.#LMUL} _.LMUL + {/.#LDIV} _.LDIV + {/.#LREM} _.LREM + {/.#LNEG} _.LNEG)) (def: (float_arithmetic instruction) (-> /.Float_Arithmetic Inst) (case instruction - #/.FADD _.FADD - #/.FSUB _.FSUB - #/.FMUL _.FMUL - #/.FDIV _.FDIV - #/.FREM _.FREM - #/.FNEG _.FNEG)) + {/.#FADD} _.FADD + {/.#FSUB} _.FSUB + {/.#FMUL} _.FMUL + {/.#FDIV} _.FDIV + {/.#FREM} _.FREM + {/.#FNEG} _.FNEG)) (def: (double_arithmetic instruction) (-> /.Double_Arithmetic Inst) (case instruction - #/.DADD _.DADD - #/.DSUB _.DSUB - #/.DMUL _.DMUL - #/.DDIV _.DDIV - #/.DREM _.DREM - #/.DNEG _.DNEG)) + {/.#DADD} _.DADD + {/.#DSUB} _.DSUB + {/.#DMUL} _.DMUL + {/.#DDIV} _.DDIV + {/.#DREM} _.DREM + {/.#DNEG} _.DNEG)) (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) (-> /.Int_Bitwise Inst) (case instruction - #/.IOR _.IOR - #/.IXOR _.IXOR - #/.IAND _.IAND - #/.ISHL _.ISHL - #/.ISHR _.ISHR - #/.IUSHR _.IUSHR)) + {/.#IOR} _.IOR + {/.#IXOR} _.IXOR + {/.#IAND} _.IAND + {/.#ISHL} _.ISHL + {/.#ISHR} _.ISHR + {/.#IUSHR} _.IUSHR)) (def: (long_bitwise instruction) (-> /.Long_Bitwise Inst) (case instruction - #/.LOR _.LOR - #/.LXOR _.LXOR - #/.LAND _.LAND - #/.LSHL _.LSHL - #/.LSHR _.LSHR - #/.LUSHR _.LUSHR)) + {/.#LOR} _.LOR + {/.#LXOR} _.LXOR + {/.#LAND} _.LAND + {/.#LSHL} _.LSHL + {/.#LSHR} _.LSHR + {/.#LUSHR} _.LUSHR)) (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) (-> /.Conversion Inst) (case instruction - #/.I2B _.I2B - #/.I2S _.I2S - #/.I2L _.I2L - #/.I2F _.I2F - #/.I2D _.I2D - #/.I2C _.I2C - - #/.L2I _.L2I - #/.L2F _.L2F - #/.L2D _.L2D - - #/.F2I _.F2I - #/.F2L _.F2L - #/.F2D _.F2D + {/.#I2B} _.I2B + {/.#I2S} _.I2S + {/.#I2L} _.I2L + {/.#I2F} _.I2F + {/.#I2D} _.I2D + {/.#I2C} _.I2C + + {/.#L2I} _.L2I + {/.#L2F} _.L2F + {/.#L2D} _.L2D + + {/.#F2I} _.F2I + {/.#F2L} _.F2L + {/.#F2D} _.F2D - #/.D2I _.D2I - #/.D2L _.D2L - #/.D2F _.D2F)) + {/.#D2I} _.D2I + {/.#D2L} _.D2L + {/.#D2F} _.D2F)) (def: (array instruction) (-> /.Array Inst) (case instruction - #/.ARRAYLENGTH _.ARRAYLENGTH + {/.#ARRAYLENGTH} _.ARRAYLENGTH - {#/.NEWARRAY type} (_.NEWARRAY type) - {#/.ANEWARRAY type} (_.ANEWARRAY type) + {/.#NEWARRAY type} (_.NEWARRAY type) + {/.#ANEWARRAY type} (_.ANEWARRAY type) - #/.BALOAD _.BALOAD - #/.BASTORE _.BASTORE + {/.#BALOAD} _.BALOAD + {/.#BASTORE} _.BASTORE - #/.SALOAD _.SALOAD - #/.SASTORE _.SASTORE + {/.#SALOAD} _.SALOAD + {/.#SASTORE} _.SASTORE - #/.IALOAD _.IALOAD - #/.IASTORE _.IASTORE + {/.#IALOAD} _.IALOAD + {/.#IASTORE} _.IASTORE - #/.LALOAD _.LALOAD - #/.LASTORE _.LASTORE + {/.#LALOAD} _.LALOAD + {/.#LASTORE} _.LASTORE - #/.FALOAD _.FALOAD - #/.FASTORE _.FASTORE + {/.#FALOAD} _.FALOAD + {/.#FASTORE} _.FASTORE - #/.DALOAD _.DALOAD - #/.DASTORE _.DASTORE + {/.#DALOAD} _.DALOAD + {/.#DASTORE} _.DASTORE - #/.CALOAD _.CALOAD - #/.CASTORE _.CASTORE + {/.#CALOAD} _.CALOAD + {/.#CASTORE} _.CASTORE - #/.AALOAD _.AALOAD - #/.AASTORE _.AASTORE)) + {/.#AALOAD} _.AALOAD + {/.#AASTORE} _.AASTORE)) (def: (object instruction) (-> /.Object Inst) @@ -254,162 +254,162 @@ (^template [ ] [{ class field_name field_type} ( class field_name field_type)]) - ([#/.GETSTATIC _.GETSTATIC] - [#/.PUTSTATIC _.PUTSTATIC] - [#/.GETFIELD _.GETFIELD] - [#/.PUTFIELD _.PUTFIELD]) + ([/.#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)]) - ([#/.INVOKEINTERFACE _.INVOKEINTERFACE] - [#/.INVOKESPECIAL _.INVOKESPECIAL] - [#/.INVOKESTATIC _.INVOKESTATIC] - [#/.INVOKEVIRTUAL _.INVOKEVIRTUAL]) + ([/.#INVOKEINTERFACE _.INVOKEINTERFACE] + [/.#INVOKESPECIAL _.INVOKESPECIAL] + [/.#INVOKESTATIC _.INVOKESTATIC] + [/.#INVOKEVIRTUAL _.INVOKEVIRTUAL]) )) (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) (case instruction - #/.DUP _.DUP - #/.DUP_X1 _.DUP_X1 - #/.DUP_X2 _.DUP_X2 - #/.DUP2 _.DUP2 - #/.DUP2_X1 _.DUP2_X1 - #/.DUP2_X2 _.DUP2_X2 - #/.SWAP _.SWAP - #/.POP _.POP - #/.POP2 _.POP2)) + {/.#DUP} _.DUP + {/.#DUP_X1} _.DUP_X1 + {/.#DUP_X2} _.DUP_X2 + {/.#DUP2} _.DUP2 + {/.#DUP2_X1} _.DUP2_X1 + {/.#DUP2_X2} _.DUP2_X2 + {/.#SWAP} _.SWAP + {/.#POP} _.POP + {/.#POP2} _.POP2)) (def: (comparison instruction) (-> /.Comparison Inst) (case instruction - #/.LCMP _.LCMP + {/.#LCMP} _.LCMP - #/.FCMPG _.FCMPG - #/.FCMPL _.FCMPL + {/.#FCMPG} _.FCMPG + {/.#FCMPL} _.FCMPL - #/.DCMPG _.DCMPG - #/.DCMPL _.DCMPL)) + {/.#DCMPG} _.DCMPG + {/.#DCMPL} _.DCMPL)) (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) - #/.ATHROW _.ATHROW)) + {/.#Try start end handler exception} (_.try start end handler exception) + {/.#ATHROW} _.ATHROW)) (def: (concurrency instruction) (-> /.Concurrency Inst) (case instruction - #/.MONITORENTER _.MONITORENTER - #/.MONITOREXIT _.MONITOREXIT)) + {/.#MONITORENTER} _.MONITORENTER + {/.#MONITOREXIT} _.MONITOREXIT)) (def: (return instruction) (-> /.Return Inst) (case instruction - #/.RETURN _.RETURN - #/.IRETURN _.IRETURN - #/.LRETURN _.LRETURN - #/.FRETURN _.FRETURN - #/.DRETURN _.DRETURN - #/.ARETURN _.ARETURN)) + {/.#RETURN} _.RETURN + {/.#IRETURN} _.IRETURN + {/.#LRETURN} _.LRETURN + {/.#FRETURN} _.FRETURN + {/.#DRETURN} _.DRETURN + {/.#ARETURN} _.ARETURN)) (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)) + {/.#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)) (type: Mapping (Dictionary /.Label org/objectweb/asm/Label)) @@ -421,10 +421,10 @@ (def: (relabel [mapping label]) (Re_labeler Identity) (case (dictionary.value label mapping) - {#.Some label} + {.#Some label} [mapping label] - #.None + {.#None} (let [label' (org/objectweb/asm/Label::new)] [(dictionary.has label label' mapping) label']))) @@ -435,39 +435,39 @@ [{ label} (let [[mapping label] (..relabel [mapping label])] [mapping { label}])]) - ([#/.IF_ICMPEQ] [#/.IF_ICMPGE] [#/.IF_ICMPGT] [#/.IF_ICMPLE] [#/.IF_ICMPLT] [#/.IF_ICMPNE] - [#/.IFEQ] [#/.IFNE] [#/.IFGE] [#/.IFGT] [#/.IFLE] [#/.IFLT] + ([/.#IF_ICMPEQ] [/.#IF_ICMPGE] [/.#IF_ICMPGT] [/.#IF_ICMPLE] [/.#IF_ICMPLT] [/.#IF_ICMPNE] + [/.#IFEQ] [/.#IFNE] [/.#IFGE] [/.#IFGT] [/.#IFLE] [/.#IFLT] - [#/.IF_ACMPEQ] [#/.IF_ACMPNE] [#/.IFNONNULL] [#/.IFNULL]) + [/.#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] + {/.#ATHROW} + [mapping {/.#ATHROW}] )) (def: (relabel_control [mapping instruction]) @@ -477,41 +477,41 @@ [{ instruction} (let [[mapping instruction] ( [mapping instruction])] [mapping { instruction}])]) - ([#/.GOTO ..relabel] - [#/.Branching ..relabel_branching] - [#/.Exception ..relabel_exception]) + ([/.#GOTO ..relabel] + [/.#Branching ..relabel_branching] + [/.#Exception ..relabel_exception]) (^template [] [{ instruction} [mapping { instruction}]]) - ([#/.Concurrency] [#/.Return]) + ([/.#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] + {/.#NOP} + [mapping {/.#NOP}] (^template [] [{ instruction} [mapping { instruction}]]) - ([#/.Constant] - [#/.Arithmetic] - [#/.Bitwise] - [#/.Conversion] - [#/.Array] - [#/.Object] - [#/.Local] - [#/.Stack] - [#/.Comparison]) + ([/.#Constant] + [/.#Arithmetic] + [/.#Bitwise] + [/.#Conversion] + [/.#Array] + [/.#Object] + [/.#Local] + [/.#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 @@ -819,22 +819,22 @@ (def: (constraint tv) (-> (Type Var) Constraint) - [#/type.name (parser.name tv) - #/type.super_class java/lang/Object - #/type.super_interfaces (list)]) + [/type.#name (parser.name tv) + /type.#super_class java/lang/Object + /type.#super_interfaces (list)]) (def: visibility (-> ffi.Privacy jvm.Visibility) - (|>> (case> #ffi.PublicP #jvm.Public - #ffi.PrivateP #jvm.Private - #ffi.ProtectedP #jvm.Protected - #ffi.DefaultP #jvm.Default))) + (|>> (case> {ffi.#PublicP} {jvm.#Public} + {ffi.#PrivateP} {jvm.#Private} + {ffi.#ProtectedP} {jvm.#Protected} + {ffi.#DefaultP} {jvm.#Default}))) (def: field_config (-> ffi.State jvm.Field_Config) - (|>> (case> #ffi.VolatileS jvm.volatileF - #ffi.FinalS jvm.finalF - #ffi.DefaultS jvm.noneF))) + (|>> (case> {ffi.#VolatileS} jvm.volatileF + {ffi.#FinalS} jvm.finalF + {ffi.#DefaultS} jvm.noneF))) (def: (field_header [name privacy state annotations type]) (-> Field jvm.Def) @@ -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) @@ -936,7 +936,7 @@ {#Override [[parent_name parent_variables] name strict_floating_point? annotations variables self arguments return exceptions body]} - (def.method #jvm.Public + (def.method {jvm.#Public} (if strict_floating_point? jvm.strictM jvm.noneM) @@ -995,16 +995,16 @@ method_definitions))] [class_name (case inheritance - #ffi.DefaultI - (def.class #jvm.V1_6 #jvm.Public jvm.noneC class_name constraints super_class super_interfaces + {ffi.#DefaultI} + (def.class {jvm.#V1_6} {jvm.#Public} jvm.noneC class_name constraints super_class super_interfaces definitions) - #ffi.FinalI - (def.class #jvm.V1_6 #jvm.Public jvm.finalC class_name constraints super_class super_interfaces + {ffi.#FinalI} + (def.class {jvm.#V1_6} {jvm.#Public} jvm.finalC class_name constraints super_class super_interfaces definitions) - #ffi.AbstractI - (def.abstract #jvm.V1_6 #jvm.Public jvm.noneC class_name constraints super_class super_interfaces + {ffi.#AbstractI} + (def.abstract {jvm.#V1_6} {jvm.#Public} jvm.noneC class_name constraints super_class super_interfaces definitions))])) (def: (constructor_method_analysis archive [class_name class_tvars] 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) @@ -1129,19 +1129,19 @@ (-> Archive Declaration (List (Type Class)) (Method Code) (Operation (Method Analysis))) (case method {#Constructor method} - (\ phase.monad each (|>> #Constructor) + (\ phase.monad each (|>> {#Constructor}) (constructor_method_analysis archive declaration method)) {#Override method} - (\ phase.monad each (|>> #Override) + (\ phase.monad each (|>> {#Override}) (override_method_analysis archive declaration supers method)) {#Virtual method} - (\ phase.monad each (|>> #Virtual) + (\ phase.monad each (|>> {#Virtual}) (virtual_method_analysis archive declaration method)) {#Static method} - (\ phase.monad each (|>> #Static) + (\ phase.monad each (|>> {#Static}) (static_method_analysis archive method)) {#Abstract method} @@ -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 @@ -1239,19 +1239,19 @@ (-> Archive (Method Analysis) (Operation (Method Synthesis))) (case method {#Constructor method} - (\ phase.monad each (|>> #Constructor) + (\ phase.monad each (|>> {#Constructor}) (constructor_method_synthesis archive method)) {#Override method} - (\ phase.monad each (|>> #Override) + (\ phase.monad each (|>> {#Override}) (override_method_synthesis archive method)) {#Virtual method} - (\ phase.monad each (|>> #Virtual) + (\ phase.monad each (|>> {#Virtual}) (virtual_method_synthesis archive method)) {#Static method} - (\ phase.monad each (|>> #Static) + (\ phase.monad each (|>> {#Static}) (static_method_synthesis archive method)) {#Abstract method} @@ -1303,7 +1303,7 @@ (do ! [bodyG (generate archive (//G.hidden_method_body (list.size arguments) bodyS)) .let [argumentsT (list\each product.right arguments)]] - (in (def.method #jvm.Public + (in (def.method {jvm.#Public} (if strict_floating_point? jvm.strictM jvm.noneM) @@ -1387,13 +1387,13 @@ {#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 + {.#Some [(/type.class parent_name parent_variables) method_name strict_floating_point? (list) variables self arguments return exceptions body]} _ - #.None)) + {.#None})) (def: (jvm::class class_loader) (-> java/lang/ClassLoader ..Handler) @@ -1435,7 +1435,7 @@ methodsS (monad.each ! (method_synthesis archive) methodsA) methodsG (monad.each ! (method_generation archive super_class) methodsS) .let [directive [class_name - (def.class #jvm.V1_6 #jvm.Public jvm.noneC class_name + (def.class {jvm.#V1_6} {jvm.#Public} jvm.noneC class_name (list\each ..constraint type_variables) super_class super_interfaces @@ -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)))))])) @@ -1460,19 +1460,19 @@ (function (_ extension_name phase archive [[class_name type_variables] supers annotations method_declarations]) (do [! phase.monad] [.let [directive [class_name - (def.interface #jvm.V1_6 #jvm.Public jvm.noneC class_name + (def.interface {jvm.#V1_6} {jvm.#Public} jvm.noneC class_name (list\each ..constraint type_variables) supers (|> method_declarations (list\each (function (_ (^slots [#name #annotations #type_variables #exceptions #arguments #return])) - (def.abstract_method #jvm.Public jvm.noneM name + (def.abstract_method {jvm.#Public} jvm.noneM name (/type.method [type_variables arguments return exceptions])))) def.fuse))]]] (directive.lifted_generation (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.lux b/lux-jvm/source/luxc/lang/host/jvm.lux index a7eb07777..3bb609324 100644 --- a/lux-jvm/source/luxc/lang/host/jvm.lux +++ b/lux-jvm/source/luxc/lang/host/jvm.lux @@ -47,21 +47,21 @@ (type: .public Visibility (Variant - #Public - #Protected - #Private - #Default)) + {#Public} + {#Protected} + {#Private} + {#Default})) (type: .public Version (Variant - #V1_1 - #V1_2 - #V1_3 - #V1_4 - #V1_5 - #V1_6 - #V1_7 - #V1_8)) + {#V1_1} + {#V1_2} + {#V1_3} + {#V1_4} + {#V1_5} + {#V1_6} + {#V1_7} + {#V1_8})) (type: .public ByteCode Binary) diff --git a/lux-jvm/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux index ecafc00d2..4aa88ff9a 100644 --- a/lux-jvm/source/luxc/lang/host/jvm/def.lux +++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux @@ -90,43 +90,43 @@ (def: (version_flag version) (-> //.Version Int) (case version - #//.V1_1 (org/objectweb/asm/Opcodes::V1_1) - #//.V1_2 (org/objectweb/asm/Opcodes::V1_2) - #//.V1_3 (org/objectweb/asm/Opcodes::V1_3) - #//.V1_4 (org/objectweb/asm/Opcodes::V1_4) - #//.V1_5 (org/objectweb/asm/Opcodes::V1_5) - #//.V1_6 (org/objectweb/asm/Opcodes::V1_6) - #//.V1_7 (org/objectweb/asm/Opcodes::V1_7) - #//.V1_8 (org/objectweb/asm/Opcodes::V1_8))) + {//.#V1_1} (org/objectweb/asm/Opcodes::V1_1) + {//.#V1_2} (org/objectweb/asm/Opcodes::V1_2) + {//.#V1_3} (org/objectweb/asm/Opcodes::V1_3) + {//.#V1_4} (org/objectweb/asm/Opcodes::V1_4) + {//.#V1_5} (org/objectweb/asm/Opcodes::V1_5) + {//.#V1_6} (org/objectweb/asm/Opcodes::V1_6) + {//.#V1_7} (org/objectweb/asm/Opcodes::V1_7) + {//.#V1_8} (org/objectweb/asm/Opcodes::V1_8))) (def: (visibility_flag visibility) (-> //.Visibility Int) (case visibility - #//.Public (org/objectweb/asm/Opcodes::ACC_PUBLIC) - #//.Protected (org/objectweb/asm/Opcodes::ACC_PROTECTED) - #//.Private (org/objectweb/asm/Opcodes::ACC_PRIVATE) - #//.Default +0)) + {//.#Public} (org/objectweb/asm/Opcodes::ACC_PUBLIC) + {//.#Protected} (org/objectweb/asm/Opcodes::ACC_PROTECTED) + {//.#Private} (org/objectweb/asm/Opcodes::ACC_PRIVATE) + {//.#Default} +0)) (def: (class_flags config) (-> //.Class_Config Int) ($_ i.+ - (if (value@ #//.finalC config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0))) + (if (value@ //.#finalC config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0))) (def: (method_flags config) (-> //.Method_Config Int) ($_ i.+ - (if (value@ #//.staticM config) (org/objectweb/asm/Opcodes::ACC_STATIC) +0) - (if (value@ #//.finalM config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0) - (if (value@ #//.synchronizedM config) (org/objectweb/asm/Opcodes::ACC_SYNCHRONIZED) +0) - (if (value@ #//.strictM config) (org/objectweb/asm/Opcodes::ACC_STRICT) +0))) + (if (value@ //.#staticM config) (org/objectweb/asm/Opcodes::ACC_STATIC) +0) + (if (value@ //.#finalM config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0) + (if (value@ //.#synchronizedM config) (org/objectweb/asm/Opcodes::ACC_SYNCHRONIZED) +0) + (if (value@ //.#strictM config) (org/objectweb/asm/Opcodes::ACC_STRICT) +0))) (def: (field_flags config) (-> //.Field_Config Int) ($_ i.+ - (if (value@ #//.staticF config) (org/objectweb/asm/Opcodes::ACC_STATIC) +0) - (if (value@ #//.finalF config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0) - (if (value@ #//.transientF config) (org/objectweb/asm/Opcodes::ACC_TRANSIENT) +0) - (if (value@ #//.volatileF config) (org/objectweb/asm/Opcodes::ACC_VOLATILE) +0))) + (if (value@ //.#staticF config) (org/objectweb/asm/Opcodes::ACC_STATIC) +0) + (if (value@ //.#finalF config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0) + (if (value@ //.#transientF config) (org/objectweb/asm/Opcodes::ACC_TRANSIENT) +0) + (if (value@ //.#volatileF config) (org/objectweb/asm/Opcodes::ACC_VOLATILE) +0))) (def: param_signature (-> (Type Class) Text) @@ -293,11 +293,11 @@ (def: .public (fuse defs) (-> (List //.Def) //.Def) (case defs - #.End + {.#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 bbeffb023..64113cd68 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 [ ] @@ -459,11 +459,11 @@ (def: .public (fuse insts) (-> (List Inst) Inst) (case insts - #.End + {.#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 685eaae92..f580ceec7 100644 --- a/lux-jvm/source/luxc/lang/synthesis/variable.lux +++ b/lux-jvm/source/luxc/lang/synthesis/variable.lux @@ -11,10 +11,11 @@ (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 +24,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 +50,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 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]) diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux index ea4503d63..0fc2e7912 100644 --- a/lux-jvm/source/program.lux +++ b/lux-jvm/source/program.lux @@ -210,7 +210,7 @@ (def: (phase_wrapper archive) (-> Archive (generation.Operation _.Anchor _.Inst _.Definition phase.Wrapper)) (do phase.monad - [instanceG (function.function' {#.Some [0 (.nat -1)]} expression.translate archive [(list) 4 ..how_to_wrap_a_phase]) + [instanceG (function.function' {.#Some [0 (.nat -1)]} expression.translate archive [(list) 4 ..how_to_wrap_a_phase]) phase_wrapper (generation.evaluate! [0 (.nat -2)] instanceG)] (in (function (_ phase) (<| try.trusted @@ -234,14 +234,14 @@ [... host jvm/host.host [loader host] jvm.host] (in [loader - [#platform.&file_system (file.async file.default) - #platform.host host - ... #platform.phase jvm.generate - #platform.phase expression.translate - ... #platform.runtime runtime.generate - #platform.runtime runtime.translate - #platform.phase_wrapper ..phase_wrapper - #platform.write product.right]]))) + [platform.#&file_system (file.async file.default) + platform.#host host + ... platform.#phase jvm.generate + platform.#phase expression.translate + ... platform.#runtime runtime.generate + platform.#runtime runtime.translate + platform.#phase_wrapper ..phase_wrapper + platform.#write product.right]]))) (def: (extender phase_wrapper) (-> phase.Wrapper Extender) @@ -277,16 +277,16 @@ (async.future (\ world/program.default exit +0))) (program: [service /cli.service] - (let [static [#/static.host @.jvm - #/static.host_module_extension ".jvm" - #/static.target (/cli.target service) - #/static.artifact_extension ".class"]] + (let [static [/static.#host @.jvm + /static.#host_module_extension ".jvm" + /static.#target (/cli.target service) + /static.#artifact_extension ".class"]] (exec (do async.monad [[loader platform] (async.future ..platform) - _ (/.compiler [#/static.host @.jvm - #/static.host_module_extension ".jvm" - #/static.target (/cli.target service) - #/static.artifact_extension ".class"] + _ (/.compiler [/static.#host @.jvm + /static.#host_module_extension ".jvm" + /static.#target (/cli.target service) + /static.#artifact_extension ".class"] ..expander (analysis.bundle loader) (io.io platform) diff --git a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux index 81328faec..6585d1f49 100644 --- a/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux +++ b/lux-jvm/test/test/luxc/lang/analysis/host.jvm.lux @@ -42,10 +42,10 @@ (_primitive.analyse (` ((~ (code.text procedure)) (~+ params))))))) (analysis.with-current-module "") (macro.result (initL.compiler [])) - (case> {#e.Success _} + (case> {e.#Success _} - {#e.Error error} + {e.#Error error} )))] [success #1 #0] @@ -63,10 +63,10 @@ (_primitive.analyse syntax)))) (analysis.with-current-module "") (macro.result (initL.compiler [])) - (case> {#e.Success _} + (case> {e.#Success _} - {#e.Error error} + {e.#Error error} )))] [success' #1 #0] @@ -281,14 +281,14 @@ size (|> r.nat (:: @ each cap)) idx (|> r.nat (:: @ each (n/% size))) level (|> r.nat (:: @ each cap)) - #let [unboxedT {#.Primitive unboxed (list)} - arrayT {#.Primitive "#Array" (list unboxedT)} + #let [unboxedT {.#Primitive unboxed (list)} + arrayT {.#Primitive "#Array" (list unboxedT)} arrayC (`' ("lux check" (+0 "#Array" (+1 (+0 (~ (code.text unboxed)) (+0)) (+0))) ("jvm array new" (~ (code.nat size))))) - boxedT {#.Primitive boxed (list)} + boxedT {.#Primitive boxed (list)} boxedTC (` (+0 (~ (code.text boxed)) (+0))) multi-arrayT (list/mix (function (_ _ innerT) - (|> innerT (list) {#.Primitive "#Array"})) + (|> innerT (list) {.#Primitive "#Array"})) boxedT (list.n/range +1 level))]] ($_ seq @@ -335,7 +335,7 @@ [!unboxed !boxed] (|> array-type (r.filter (function (_ [!unboxed !boxed]) (not (text/= boxed !boxed))))) - #let [boxedT {#.Primitive boxed (list)} + #let [boxedT {.#Primitive boxed (list)} boxedC (`' ("lux check" (+0 (~ (code.text boxed)) (+0)) ("jvm object null"))) !boxedC (`' ("lux check" (+0 (~ (code.text !boxed)) (+0)) @@ -354,12 +354,12 @@ (test "jvm object null" (success "jvm object null" (list) - {#.Primitive boxed (list)})) + {.#Primitive boxed (list)})) (test "jvm object null (no primitives)" (or (text/= "java.lang.Object" boxed) (failure "jvm object null" (list) - {#.Primitive unboxed (list)}))) + {.#Primitive unboxed (list)}))) (test "jvm object null?" (success "jvm object null?" (list boxedC) @@ -381,7 +381,7 @@ (test "jvm object class" (success "jvm object class" (list (code.text boxed)) - {#.Primitive "java.lang.Class" (list boxedT)})) + {.#Primitive "java.lang.Class" (list boxedT)})) (test "jvm object instance?" (success "jvm object instance?" (list (code.text boxed) @@ -406,12 +406,12 @@ (success "jvm member static get" (list (code.text "java.lang.System") (code.text "out")) - {#.Primitive "java.io.PrintStream" (list)})) + {.#Primitive "java.io.PrintStream" (list)})) (test "jvm member static get (inheritance out)" (success "jvm member static get" (list (code.text "java.lang.System") (code.text "out")) - {#.Primitive "java.lang.Object" (list)})) + {.#Primitive "java.lang.Object" (list)})) (test "jvm member static put" (success "jvm member static put" (list (code.text "java.awt.datatransfer.DataFlavor") @@ -444,14 +444,14 @@ (code.text "id") (`' ("lux check" (+0 "org.omg.CORBA.ValueMember" (+0)) ("jvm object null")))) - {#.Primitive "java.lang.String" (list)})) + {.#Primitive "java.lang.String" (list)})) (test "jvm member virtual get (inheritance out)" (success "jvm member virtual get" (list (code.text "org.omg.CORBA.ValueMember") (code.text "id") (`' ("lux check" (+0 "org.omg.CORBA.ValueMember" (+0)) ("jvm object null")))) - {#.Primitive "java.lang.Object" (list)})) + {.#Primitive "java.lang.Object" (list)})) (test "jvm member virtual put" (success "jvm member virtual put" (list (code.text "org.omg.CORBA.ValueMember") @@ -488,14 +488,14 @@ (success "jvm member static get" (list (code.text "java.util.GregorianCalendar") (code.text "AD")) - {#.Primitive "java.lang.Integer" (list)})) + {.#Primitive "java.lang.Integer" (list)})) (test "jvm member virtual get" (success "jvm member virtual get" (list (code.text "javax.accessibility.AccessibleAttributeSequence") (code.text "startIndex") (`' ("lux check" (+0 "javax.accessibility.AccessibleAttributeSequence" (+0)) ("jvm object null")))) - {#.Primitive "java.lang.Integer" (list)})) + {.#Primitive "java.lang.Integer" (list)})) (test "jvm member virtual put" (success "jvm member virtual put" (list (code.text "javax.accessibility.AccessibleAttributeSequence") @@ -522,28 +522,28 @@ (success' (` ("jvm member invoke static" "java.lang.Long" "decode" ["java.lang.String" (~ stringC)])) - {#.Primitive "java.lang.Long" (list)})) + {.#Primitive "java.lang.Long" (list)})) (test "jvm member invoke virtual" (success' (` ("jvm object cast" ("jvm member invoke virtual" "java.lang.Object" "equals" ("jvm object cast" (~ longC)) ["java.lang.Object" ("jvm object cast" (~ longC))]))) - {#.Primitive "java.lang.Boolean" (list)})) + {.#Primitive "java.lang.Boolean" (list)})) (test "jvm member invoke special" (success' (` ("jvm object cast" ("jvm member invoke special" "java.lang.Long" "equals" ("jvm object cast" (~ longC)) ["java.lang.Object" ("jvm object cast" (~ longC))]))) - {#.Primitive "java.lang.Boolean" (list)})) + {.#Primitive "java.lang.Boolean" (list)})) (test "jvm member invoke interface" (success' (` ("jvm object cast" ("jvm member invoke interface" "java.util.Collection" "add" ("jvm object cast" (~ objectC)) ["java.lang.Object" ("jvm object cast" (~ longC))]))) - {#.Primitive "java.lang.Boolean" (list)})) + {.#Primitive "java.lang.Boolean" (list)})) (test "jvm member invoke constructor" (success' (` ("jvm member invoke constructor" "java.util.ArrayList" ["int" ("jvm object cast" (~ intC))])) - (All (_ a) {#.Primitive "java.util.ArrayList" (list a)}))) + (All (_ a) {.#Primitive "java.util.ArrayList" (list a)}))) ))) diff --git a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux index b923a4e90..ec5be459a 100644 --- a/lux-jvm/test/test/luxc/lang/synthesis/loop.lux +++ b/lux-jvm/test/test/luxc/lang/synthesis/loop.lux @@ -21,29 +21,29 @@ (-> ls.Arity ls.Synthesis Bit) (loop [exprS exprS] (case exprS - (^ [_ {#.Form (list [_ {#.Text "lux case"}] inputS pathS)}]) + (^ [_ {.#Form (list [_ {.#Text "lux case"}] inputS pathS)}]) (loop [pathS pathS] (case pathS - (^ [_ {#.Form (list [_ {#.Text "lux case alt"}] leftS rightS)}]) + (^ [_ {.#Form (list [_ {.#Text "lux case alt"}] leftS rightS)}]) (or (recur leftS) (recur rightS)) - (^ [_ {#.Form (list [_ {#.Text "lux case seq"}] leftS rightS)}]) + (^ [_ {.#Form (list [_ {.#Text "lux case seq"}] leftS rightS)}]) (recur rightS) - (^ [_ {#.Form (list [_ {#.Text "lux case exec"}] bodyS)}]) + (^ [_ {.#Form (list [_ {.#Text "lux case exec"}] bodyS)}]) (does-recursion? arity bodyS) _ #0)) - (^ [_ {#.Form (list& [_ {#.Text "lux recur"}] argsS)}]) + (^ [_ {.#Form (list& [_ {.#Text "lux recur"}] argsS)}]) (n/= arity (list.size argsS)) - (^ [_ {#.Form (list [_ {#.Text "lux let"}] register inputS bodyS)}]) + (^ [_ {.#Form (list [_ {.#Text "lux let"}] register inputS bodyS)}]) (recur bodyS) - (^ [_ {#.Form (list [_ {#.Text "lux if"}] inputS thenS elseS)}]) + (^ [_ {.#Form (list [_ {.#Text "lux if"}] inputS thenS elseS)}]) (or (recur thenS) (recur elseS)) @@ -132,7 +132,7 @@ (test "Can accurately identify (and then reify) tail recursion." (case (expressionS.synthesize extensionL.no-syntheses analysis) - (^ [_ {#.Form (list [_ {#.Text "lux function"}] [_ {#.Nat _arity}] [_ {#.Tuple _env}] _body)}]) + (^ [_ {.#Form (list [_ {.#Text "lux function"}] [_ {.#Nat _arity}] [_ {.#Tuple _env}] _body)}]) (|> _body (does-recursion? arity) (bit/= prediction) @@ -149,12 +149,12 @@ (test "Can reify loops." (case (expressionS.synthesize extensionL.no-syntheses (la.apply (list.repeat arity (' [])) analysis)) - (^ [_ {#.Form (list [_ {#.Text "lux loop"}] [_ {#.Nat in_register}] [_ {#.Tuple _inits}] _body)}]) + (^ [_ {.#Form (list [_ {.#Text "lux loop"}] [_ {.#Nat in_register}] [_ {.#Tuple _inits}] _body)}]) (and (n/= arity (list.size _inits)) (not (loopS.contains-self-reference? _body))) - (^ [_ {#.Form (list& [_ {#.Text "lux call"}] - [_ {#.Form (list [_ {#.Text "lux function"}] _arity _env _bodyS)}] + (^ [_ {.#Form (list& [_ {.#Text "lux call"}] + [_ {.#Form (list [_ {.#Text "lux function"}] _arity _env _bodyS)}] argsS)}]) (loopS.contains-self-reference? _bodyS) diff --git a/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux index 0d73b1038..00e096014 100644 --- a/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux +++ b/lux-jvm/test/test/luxc/lang/synthesis/procedure.lux @@ -24,7 +24,7 @@ (test "Can synthesize procedure calls." (|> (expressionS.synthesize extensionL.no-syntheses (la.procedure nameA argsA)) - (case> (^ [_ {#.Form (list& [_ {#.Text procedure}] argsS)}]) + (case> (^ [_ {.#Form (list& [_ {.#Text procedure}] argsS)}]) (and (text/= nameA procedure) (list.every? (product.uncurried corresponds?) (list.zip2 argsA argsS))) diff --git a/lux-jvm/test/test/luxc/lang/translation/js.lux b/lux-jvm/test/test/luxc/lang/translation/js.lux index 69bcd7ecd..31c92517c 100644 --- a/lux-jvm/test/test/luxc/lang/translation/js.lux +++ b/lux-jvm/test/test/luxc/lang/translation/js.lux @@ -22,7 +22,7 @@ (def: (test-primitive-identity synthesis) (-> Synthesis Bit) (|> (run-js (` ("lux is" (~ synthesis) (~ synthesis)))) - (case> {#e.Success valueV} + (case> {e.#Success valueV} (:coerce Bit valueV) _ @@ -33,10 +33,10 @@ (template [
 <=>]
   [(def: ( angle)
      (->  Check)
-     (|>> (case> {#e.Success valueV}
+     (|>> (case> {e.#Success valueV}
                  (<=> (
 angle) (:coerce  valueV))
                  
-                 {#e.Error error}
+                 {e.#Error error}
                  #0)))]
 
   [sin-check    Frac math.sin f/=]
@@ -73,16 +73,16 @@
         ($_ seq
             (test "Cannot get non-existing fields from objects."
                   (|> (run-js (` ("js object get" (~ field) (~ empty-object))))
-                      (case> (^multi {#e.Success valueV}
-                                     [(:coerce (Maybe Int) valueV) #.None])
+                      (case> (^multi {e.#Success valueV}
+                                     [(:coerce (Maybe Int) valueV) {.#None}])
                              #1
 
                              _
                              #0)))
             (test "Can get fields from objects."
                   (|> (run-js (` ("js object get" (~ field) (~ object))))
-                      (case> (^multi {#e.Success valueV}
-                                     [(:coerce (Maybe Int) valueV) {#.Some valueV}])
+                      (case> (^multi {e.#Success valueV}
+                                     [(:coerce (Maybe Int) valueV) {.#Some valueV}])
                              (i/= value (:coerce Int valueV))
 
                              _
@@ -90,8 +90,8 @@
             (test "Can delete fields from objects."
                   (|> (run-js (let [post-delete (` ("js object delete" (~ field) (~ object)))]
                                 (` ("js object get" (~ field) (~ post-delete)))))
-                      (case> (^multi {#e.Success valueV}
-                                     [(:coerce (Maybe Int) valueV) #.None])
+                      (case> (^multi {e.#Success valueV}
+                                     [(:coerce (Maybe Int) valueV) {.#None}])
                              #1
 
                              _
@@ -99,10 +99,10 @@
             (test "Can instance new objects."
                   (let [base (` ("js object new" ("js global" "Number") (~ (code.text (%f frac-value)))))]
                     (|> (run-js (` ("lux frac +" (~ base) 0.0)))
-                        (case> {#e.Success valueV}
+                        (case> {e.#Success valueV}
                                (f/= frac-value (:coerce Frac valueV))
 
-                               {#e.Error error}
+                               {e.#Error error}
                                #0))))
             (test "Can call methods on objects."
                   (|> (run-js (` ("js object call" ("js global" "Math") "sin" (~ (code.text (%f frac-value))))))
@@ -124,9 +124,9 @@
                       (length-check length)))
             (test "Can get an element from an array."
                   (|> (run-js (` ("js array read" (~ (code.nat idx)) (~ arrayS))))
-                      (case> (^multi {#e.Success elemV}
+                      (case> (^multi {e.#Success elemV}
                                      [[(list.nth idx elems) (:coerce (Maybe Nat) elemV)]
-                                      [{#.Some reference} {#.Some sample}]])
+                                      [{.#Some reference} {.#Some sample}]])
                              (n/= reference sample)
 
                              _
@@ -136,9 +136,9 @@
                         overwriteS (code.nat overwrite)]
                     (|> (run-js (` ("js array read" (~ idxS)
                                     ("js array write" (~ idxS) (~ overwriteS) (~ arrayS)))))
-                        (case> (^multi {#e.Success elemV}
+                        (case> (^multi {e.#Success elemV}
                                        [(:coerce (Maybe Nat) elemV)
-                                        {#.Some sample}])
+                                        {.#Some sample}])
                                (n/= overwrite sample)
 
                                _
@@ -149,9 +149,9 @@
                     (and (|> (run-js (` ("js array length" (~ deleteS))))
                              (length-check length))
                          (|> (run-js (` ("js array read" (~ idxS) (~ deleteS))))
-                             (case> (^multi {#e.Success elemV}
+                             (case> (^multi {e.#Success elemV}
                                             [(:coerce (Maybe Nat) elemV)
-                                             #.None])
+                                             {.#None}])
                                     #1
 
                                     _
diff --git a/lux-jvm/test/test/luxc/lang/translation/jvm.lux b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
index 86c8253e4..c63c736d3 100644
--- a/lux-jvm/test/test/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/test/test/luxc/lang/translation/jvm.lux
@@ -36,10 +36,10 @@
                                                  (evalT.eval sampleI))
                                                (lang.with-current-module "")
                                                (macro.result (io.run! init-jvm))
-                                               (case> {#e.Success valueT}
+                                               (case> {e.#Success valueT}
                                                       (  (:coerce  valueT))
 
-                                                      {#e.Error error}
+                                                      {e.#Error error}
                                                       #0)))]
 
                                     ["jvm convert double-to-float" "jvm convert float-to-double" code.frac frac-sample Frac f/=]
@@ -68,10 +68,10 @@
                                    (evalT.eval sampleI))
                                  (lang.with-current-module "")
                                  (macro.result (io.run! init-jvm))
-                                 (case> {#e.Success valueT}
+                                 (case> {e.#Success valueT}
                                         (  (:coerce  valueT))
 
-                                        {#e.Error error}
+                                        {e.#Error error}
                                         #0)))]
 
                       ["jvm convert long-to-int"   "jvm convert int-to-char"  "jvm convert char-to-long"  code.int int-sample Int i/=]
@@ -95,10 +95,10 @@
                                    (evalT.eval sampleI))
                                  (lang.with-current-module "")
                                  (macro.result (io.run! init-jvm))
-                                 (case> {#e.Success valueT}
+                                 (case> {e.#Success valueT}
                                         (  (:coerce  valueT))
 
-                                        {#e.Error error}
+                                        {e.#Error error}
                                         #0)))]
 
                       ["jvm convert long-to-int" "jvm convert int-to-char" "jvm convert char-to-byte" "jvm convert byte-to-long" code.int int-sample Int i/=]
@@ -136,11 +136,11 @@
                                                     (evalT.eval sampleI))
                                                   (lang.with-current-module "")
                                                   (macro.result (io.run! init-jvm))
-                                                  (case> {#e.Success valueT}
+                                                  (case> {e.#Success valueT}
                                                          ( ( param subject)
                                                                  (:coerce  valueT))
 
-                                                         {#e.Error error}
+                                                         {e.#Error error}
                                                          #0)))]
 
                                        [(format "jvm "  " +") <+>]
@@ -175,11 +175,11 @@
                                       (evalT.eval sampleI))
                                     (lang.with-current-module "")
                                     (macro.result (io.run! init-jvm))
-                                    (case> {#e.Success valueT}
+                                    (case> {e.#Success valueT}
                                            (n/= ( param subject)
                                                 (:coerce Nat valueT))
 
-                                           {#e.Error error}
+                                           {e.#Error error}
                                            #0)))]
 
                          [(format "jvm "  " and") bit.and]
@@ -209,11 +209,11 @@
                                       (evalT.eval sampleI))
                                     (lang.with-current-module "")
                                     (macro.result (io.run! init-jvm))
-                                    (case> {#e.Success valueT}
+                                    (case> {e.#Success valueT}
                                            ( ( shift ( subject))
                                                    (:coerce  valueT))
 
-                                           {#e.Error error}
+                                           {e.#Error error}
                                            #0)))]
 
                          [(format "jvm "  " shl") bit.left-shift Nat n/= id code.nat]
@@ -241,11 +241,11 @@
                                                     (evalT.eval sampleI))
                                                   (lang.with-current-module "")
                                                   (macro.result (io.run! init-jvm))
-                                                  (case> {#e.Success valueT}
+                                                  (case> {e.#Success valueT}
                                                          (bit/= ( param subject)
                                                                 (:coerce Bit valueT))
 
-                                                         {#e.Error error}
+                                                         {e.#Error error}
                                                          #0)))]
 
                                        [(format "jvm "  " =") <=>]
@@ -297,10 +297,10 @@
                                                  (evalT.eval sampleI))
                                                (lang.with-current-module "")
                                                (macro.result (io.run! init-jvm))
-                                               (case> {#e.Success outputZ}
+                                               (case> {e.#Success outputZ}
                                                       (  (:coerce  outputZ))
 
-                                                      {#e.Error error}
+                                                      {e.#Error error}
                                                       #0)))]
 
                                     ["boolean" Bit valueZ bit/= (code.bit valueZ)
@@ -345,10 +345,10 @@
                                                  (evalT.eval sampleI))
                                                (lang.with-current-module "")
                                                (macro.result (io.run! init-jvm))
-                                               (case> {#e.Success outputT}
+                                               (case> {e.#Success outputT}
                                                       (  (:coerce  outputT))
 
-                                                      {#e.Error error}
+                                                      {e.#Error error}
                                                       #0)))]
 
                                     ["char" Int valueC i/=
@@ -373,10 +373,10 @@
                                          (evalT.eval sampleI))
                                        (lang.with-current-module "")
                                        (macro.result (io.run! init-jvm))
-                                       (case> {#e.Success outputT}
+                                       (case> {e.#Success outputT}
                                               (f/= valueD (:coerce Frac outputT))
 
-                                              {#e.Error error}
+                                              {e.#Error error}
                                               #0)))
                              (test "jvm array length"
                                    (|> (do macro.Monad
@@ -384,10 +384,10 @@
                                          (evalT.eval sampleI))
                                        (lang.with-current-module "")
                                        (macro.result (io.run! init-jvm))
-                                       (case> {#e.Success outputT}
+                                       (case> {e.#Success outputT}
                                               (n/= size (:coerce Nat outputT))
 
-                                              {#e.Error error}
+                                              {e.#Error error}
                                               #0)))
                              )))))
 
@@ -435,10 +435,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (:coerce Bit outputT)
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm object null?"
                   (|> (do macro.Monad
@@ -446,10 +446,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (not (:coerce Bit outputT))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm object synchronized"
                   (|> (do macro.Monad
@@ -457,10 +457,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (i/= sample (:coerce Int outputT))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm object throw"
                   (|> (do macro.Monad
@@ -472,15 +472,15 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (case (:coerce (e.Error Any) outputT)
-                               {#e.Error error}
+                               {e.#Error error}
                                (text.contains? exception-message error)
 
-                               {#e.Success outputT}
+                               {e.#Success outputT}
                                #0)
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm object class"
                   (|> (do macro.Monad
@@ -488,10 +488,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (|> outputT (:coerce Class) (Class::getName []) (text/= class))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm object instance?"
                   (|> (do macro.Monad
@@ -499,10 +499,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (:coerce Bit outputT)
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             ))))
 
@@ -531,10 +531,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (i/= GregorianCalendar::AD (:coerce Int outputT))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm member static put"
                   (|> (do macro.Monad
@@ -543,10 +543,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (same? hostL.unit (:coerce Text outputT))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm member virtual get"
                   (|> (do macro.Monad
@@ -554,10 +554,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (text/= sample-string (:coerce Text outputT))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm member virtual put"
                   (|> (do macro.Monad
@@ -567,10 +567,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (text/= other-sample-string (:coerce Text outputT))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             ))))
 
@@ -596,10 +596,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (i/= sample (:coerce Int outputT))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm member invoke virtual"
                   (|> (do macro.Monad
@@ -609,10 +609,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (:coerce Bit outputT)
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm member invoke interface"
                   (|> (do macro.Monad
@@ -622,10 +622,10 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (:coerce Bit outputT)
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             (test "jvm member invoke constructor"
                   (|> (do macro.Monad
@@ -633,9 +633,9 @@
                         (evalT.eval sampleI))
                       (lang.with-current-module "")
                       (macro.result (io.run! init-jvm))
-                      (case> {#e.Success outputT}
+                      (case> {e.#Success outputT}
                              (host.instance? ArrayList (:coerce Object outputT))
 
-                             {#e.Error error}
+                             {e.#Error error}
                              #0)))
             ))))
-- 
cgit v1.2.3