aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm
diff options
context:
space:
mode:
Diffstat (limited to 'lux-jvm')
-rw-r--r--lux-jvm/source/luxc/lang/directive/jvm.lux140
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm.lux34
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm/def.lux156
-rw-r--r--lux-jvm/source/luxc/lang/host/jvm/inst.lux144
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm.lux92
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/case.lux72
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux106
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux400
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/function.lux228
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/loop.lux4
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/program.lux28
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/reference.lux14
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/runtime.lux224
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/structure.lux4
-rw-r--r--lux-jvm/source/program.lux56
15 files changed, 851 insertions, 851 deletions
diff --git a/lux-jvm/source/luxc/lang/directive/jvm.lux b/lux-jvm/source/luxc/lang/directive/jvm.lux
index 8f1fab5e2..f73182c03 100644
--- a/lux-jvm/source/luxc/lang/directive/jvm.lux
+++ b/lux-jvm/source/luxc/lang/directive/jvm.lux
@@ -82,8 +82,8 @@
(..literal literal)
))
-(def: (int-arithmetic instruction)
- (-> /.Int-Arithmetic Inst)
+(def: (int_arithmetic instruction)
+ (-> /.Int_Arithmetic Inst)
(case instruction
#/.IADD _.IADD
#/.ISUB _.ISUB
@@ -92,8 +92,8 @@
#/.IREM _.IREM
#/.INEG _.INEG))
-(def: (long-arithmetic instruction)
- (-> /.Long-Arithmetic Inst)
+(def: (long_arithmetic instruction)
+ (-> /.Long_Arithmetic Inst)
(case instruction
#/.LADD _.LADD
#/.LSUB _.LSUB
@@ -102,8 +102,8 @@
#/.LREM _.LREM
#/.LNEG _.LNEG))
-(def: (float-arithmetic instruction)
- (-> /.Float-Arithmetic Inst)
+(def: (float_arithmetic instruction)
+ (-> /.Float_Arithmetic Inst)
(case instruction
#/.FADD _.FADD
#/.FSUB _.FSUB
@@ -112,8 +112,8 @@
#/.FREM _.FREM
#/.FNEG _.FNEG))
-(def: (double-arithmetic instruction)
- (-> /.Double-Arithmetic Inst)
+(def: (double_arithmetic instruction)
+ (-> /.Double_Arithmetic Inst)
(case instruction
#/.DADD _.DADD
#/.DSUB _.DSUB
@@ -125,20 +125,20 @@
(def: (arithmetic instruction)
(-> /.Arithmetic Inst)
(case instruction
- (#/.Int-Arithmetic int-arithmetic)
- (..int-arithmetic int-arithmetic)
+ (#/.Int_Arithmetic int_arithmetic)
+ (..int_arithmetic int_arithmetic)
- (#/.Long-Arithmetic long-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)
+ (..float_arithmetic float_arithmetic)
- (#/.Double-Arithmetic double-arithmetic)
- (..double-arithmetic double-arithmetic)))
+ (#/.Double_Arithmetic double_arithmetic)
+ (..double_arithmetic double_arithmetic)))
-(def: (int-bitwise instruction)
- (-> /.Int-Bitwise Inst)
+(def: (int_bitwise instruction)
+ (-> /.Int_Bitwise Inst)
(case instruction
#/.IOR _.IOR
#/.IXOR _.IXOR
@@ -147,8 +147,8 @@
#/.ISHR _.ISHR
#/.IUSHR _.IUSHR))
-(def: (long-bitwise instruction)
- (-> /.Long-Bitwise Inst)
+(def: (long_bitwise instruction)
+ (-> /.Long_Bitwise Inst)
(case instruction
#/.LOR _.LOR
#/.LXOR _.LXOR
@@ -160,11 +160,11 @@
(def: (bitwise instruction)
(-> /.Bitwise Inst)
(case instruction
- (#/.Int-Bitwise int-bitwise)
- (..int-bitwise int-bitwise)
+ (#/.Int_Bitwise int_bitwise)
+ (..int_bitwise int_bitwise)
- (#/.Long-Bitwise long-bitwise)
- (..long-bitwise long-bitwise)))
+ (#/.Long_Bitwise long_bitwise)
+ (..long_bitwise long_bitwise)))
(def: (conversion instruction)
(-> /.Conversion Inst)
@@ -224,8 +224,8 @@
(-> /.Object Inst)
(case instruction
(^template [<tag> <inst>]
- [(<tag> class field-name field-type)
- (<inst> class field-name field-type)])
+ [(<tag> class field_name field_type)
+ (<inst> class field_name field_type)])
([#/.GETSTATIC _.GETSTATIC]
[#/.PUTSTATIC _.PUTSTATIC]
[#/.GETFIELD _.GETFIELD]
@@ -237,40 +237,40 @@
(#/.CHECKCAST type) (_.CHECKCAST type)
(^template [<tag> <inst>]
- [(<tag> class method-name method-type)
- (<inst> class method-name method-type)])
+ [(<tag> class method_name method_type)
+ (<inst> class method_name method_type)])
([#/.INVOKEINTERFACE _.INVOKEINTERFACE]
[#/.INVOKESPECIAL _.INVOKESPECIAL]
[#/.INVOKESTATIC _.INVOKESTATIC]
[#/.INVOKEVIRTUAL _.INVOKEVIRTUAL])
))
-(def: (local-int instruction)
- (-> /.Local-Int Inst)
+(def: (local_int instruction)
+ (-> /.Local_Int Inst)
(case instruction
(#/.ILOAD register) (_.ILOAD register)
(#/.ISTORE register) (_.ISTORE register)))
-(def: (local-long instruction)
- (-> /.Local-Long Inst)
+(def: (local_long instruction)
+ (-> /.Local_Long Inst)
(case instruction
(#/.LLOAD register) (_.LLOAD register)
(#/.LSTORE register) (_.LSTORE register)))
-(def: (local-float instruction)
- (-> /.Local-Float Inst)
+(def: (local_float instruction)
+ (-> /.Local_Float Inst)
(case instruction
(#/.FLOAD register) (_.FLOAD register)
(#/.FSTORE register) (_.FSTORE register)))
-(def: (local-double instruction)
- (-> /.Local-Double Inst)
+(def: (local_double instruction)
+ (-> /.Local_Double Inst)
(case instruction
(#/.DLOAD register) (_.DLOAD register)
(#/.DSTORE register) (_.DSTORE register)))
-(def: (local-object instruction)
- (-> /.Local-Object Inst)
+(def: (local_object instruction)
+ (-> /.Local_Object Inst)
(case instruction
(#/.ALOAD register) (_.ALOAD register)
(#/.ASTORE register) (_.ASTORE register)))
@@ -278,12 +278,12 @@
(def: (local instruction)
(-> /.Local Inst)
(case instruction
- (#/.Local-Int instruction) (..local-int 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_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)
@@ -385,12 +385,12 @@
(type: Mapping
(Dictionary /.Label org/objectweb/asm/Label))
-(type: (Re-labeler context)
+(type: (Re_labeler context)
(-> [Mapping (context /.Label)]
[Mapping (context org/objectweb/asm/Label)]))
(def: (relabel [mapping label])
- (Re-labeler Identity)
+ (Re_labeler Identity)
(case (dictionary.get label mapping)
(#.Some label)
[mapping label]
@@ -399,8 +399,8 @@
(let [label' (org/objectweb/asm/Label::new)]
[(dictionary.put label label' mapping) label'])))
-(def: (relabel-branching [mapping instruction])
- (Re-labeler /.Branching)
+(def: (relabel_branching [mapping instruction])
+ (Re_labeler /.Branching)
(case instruction
(^template [<tag>]
[(<tag> label)
@@ -428,8 +428,8 @@
[mapping (#/.LOOKUPSWITCH default (list.reverse keys+labels))])
))
-(def: (relabel-exception [mapping instruction])
- (Re-labeler /.Exception)
+(def: (relabel_exception [mapping instruction])
+ (Re_labeler /.Exception)
(case instruction
(#/.Try start end handler exception)
(let [[mapping start] (..relabel [mapping start])
@@ -441,16 +441,16 @@
[mapping #/.ATHROW]
))
-(def: (relabel-control [mapping instruction])
- (Re-labeler /.Control)
+(def: (relabel_control [mapping instruction])
+ (Re_labeler /.Control)
(case instruction
(^template [<tag> <relabel>]
[(<tag> instruction)
(let [[mapping instruction] (<relabel> [mapping instruction])]
[mapping (<tag> instruction)])])
([#/.GOTO ..relabel]
- [#/.Branching ..relabel-branching]
- [#/.Exception ..relabel-exception])
+ [#/.Branching ..relabel_branching]
+ [#/.Exception ..relabel_exception])
(^template [<tag>]
[(<tag> instruction)
@@ -458,8 +458,8 @@
([#/.Concurrency] [#/.Return])
))
-(def: (relabel-instruction [mapping instruction])
- (Re-labeler /.Instruction)
+(def: (relabel_instruction [mapping instruction])
+ (Re_labeler /.Instruction)
(case instruction
#/.NOP [mapping #/.NOP]
@@ -477,13 +477,13 @@
[#/.Comparison])
(#/.Control instruction)
- (let [[mapping instruction] (..relabel-control [mapping instruction])]
+ (let [[mapping instruction] (..relabel_control [mapping instruction])]
[mapping (#/.Control instruction)])))
-(def: (relabel-bytecode [mapping bytecode])
- (Re-labeler /.Bytecode)
+(def: (relabel_bytecode [mapping bytecode])
+ (Re_labeler /.Bytecode)
(row@fold (function (_ input [mapping output])
- (let [[mapping input] (..relabel-instruction [mapping input])]
+ (let [[mapping input] (..relabel_instruction [mapping input])]
[mapping (row.add input output)]))
[mapping (row.row)]
bytecode))
@@ -495,41 +495,41 @@
(def: bytecode
(-> (/.Bytecode /.Label) jvm.Inst)
(|>> [..fresh]
- ..relabel-bytecode
+ ..relabel_bytecode
product.right
(row@map ..instruction)
- row.to-list
+ row.to_list
_.fuse))
(type: Handler
(generation.Handler jvm.Anchor (/.Bytecode /.Label) jvm.Definition))
-(def: (true-handler extender pseudo)
+(def: (true_handler extender pseudo)
(-> jvm.Extender Any jvm.Handler)
- (function (_ extension-name phase archive inputs)
+ (function (_ extension_name phase archive inputs)
(do phase.monad
- [bytecode ((extender pseudo) extension-name phase archive inputs)]
+ [bytecode ((extender pseudo) extension_name phase archive inputs)]
(wrap (..bytecode (:coerce (/.Bytecode /.Label) bytecode))))))
(def: (def::generation extender)
(-> jvm.Extender
(directive.Handler jvm.Anchor jvm.Inst jvm.Definition))
- (function (handler extension-name phase archive inputsC+)
+ (function (handler extension_name phase archive inputsC+)
(case inputsC+
(^ (list nameC valueC))
(do phase.monad
[[_ _ name] (lux/.evaluate! archive Text nameC)
[_ handlerV] (lux/.generator archive (:coerce Text name) ..Handler valueC)
_ (|> handlerV
- (..true-handler extender)
+ (..true_handler extender)
(extension.install extender (:coerce Text name))
- directive.lift-generation)
- _ (directive.lift-generation
+ directive.lift_generation)
+ _ (directive.lift_generation
(generation.log! (format "Generation " (%.text (:coerce Text name)))))]
- (wrap directive.no-requirements))
+ (wrap directive.no_requirements))
_
- (phase.throw extension.invalid-syntax [extension-name %.code inputsC+]))))
+ (phase.throw extension.invalid_syntax [extension_name %.code inputsC+]))))
(def: #export (bundle extender)
(-> jvm.Extender
diff --git a/lux-jvm/source/luxc/lang/host/jvm.lux b/lux-jvm/source/luxc/lang/host/jvm.lux
index dea97851a..c2a2a6f41 100644
--- a/lux-jvm/source/luxc/lang/host/jvm.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm.lux
@@ -84,20 +84,20 @@
(type: #export (Generator i)
(-> Phase Archive i (Operation Inst)))
-(syntax: (config: {type s.local-identifier}
- {none s.local-identifier}
- {++ s.local-identifier}
- {options (s.tuple (p.many s.local-identifier))})
- (let [g!type (code.local-identifier type)
- g!none (code.local-identifier none)
- g!tags+ (list/map code.local-tag options)
- g!_left (code.local-identifier "_left")
- g!_right (code.local-identifier "_right")
+(syntax: (config: {type s.local_identifier}
+ {none s.local_identifier}
+ {++ s.local_identifier}
+ {options (s.tuple (p.many s.local_identifier))})
+ (let [g!type (code.local_identifier type)
+ g!none (code.local_identifier none)
+ g!tags+ (list/map code.local_tag options)
+ g!_left (code.local_identifier "_left")
+ g!_right (code.local_identifier "_right")
g!options+ (list/map (function (_ option)
- (` (def: (~' #export) (~ (code.local-identifier option))
+ (` (def: (~' #export) (~ (code.local_identifier option))
(~ g!type)
(|> (~ g!none)
- (set@ (~ (code.local-tag option)) #1)))))
+ (set@ (~ (code.local_tag option)) #1)))))
options)]
(wrap (list& (` (type: (~' #export) (~ g!type)
(~ (code.record (list/map (function (_ tag)
@@ -110,7 +110,7 @@
[tag (` #0)])
g!tags+)))))
- (` (def: (~' #export) ((~ (code.local-identifier ++)) (~ g!_left) (~ g!_right))
+ (` (def: (~' #export) ((~ (code.local_identifier ++)) (~ g!_left) (~ g!_right))
(-> (~ g!type) (~ g!type) (~ g!type))
(~ (code.record (list/map (function (_ tag)
[tag (` (or (get@ (~ tag) (~ g!_left))
@@ -119,15 +119,15 @@
g!options+))))
-(config: Class-Config noneC ++C [finalC])
-(config: Method-Config noneM ++M [finalM staticM synchronizedM strictM])
-(config: Field-Config noneF ++F [finalF staticF transientF volatileF])
+(config: Class_Config noneC ++C [finalC])
+(config: Method_Config noneM ++M [finalM staticM synchronizedM strictM])
+(config: Field_Config noneF ++F [finalF staticF transientF volatileF])
-(def: #export new-label
+(def: #export new_label
(-> Any Label)
(function (_ _)
(org/objectweb/asm/Label::new)))
-(def: #export (simple-class name)
+(def: #export (simple_class name)
(-> Text (Type Class))
(type.class name (list)))
diff --git a/lux-jvm/source/luxc/lang/host/jvm/def.lux b/lux-jvm/source/luxc/lang/host/jvm/def.lux
index a9003b485..12e2fe412 100644
--- a/lux-jvm/source/luxc/lang/host/jvm/def.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm/def.lux
@@ -1,6 +1,6 @@
(.module:
[lux (#- Type)
- ["." host (#+ import: do-to)]
+ ["." host (#+ import: do_to)]
[control
["." function]]
[data
@@ -24,7 +24,7 @@
(def: signature (|>> type.signature signature.signature))
(def: descriptor (|>> type.descriptor descriptor.descriptor))
-(def: class-name (|>> type.descriptor descriptor.class-name name.read))
+(def: class_name (|>> type.descriptor descriptor.class_name name.read))
(import: java/lang/Object)
(import: java/lang/String)
@@ -77,15 +77,15 @@
(visitMethod [int java/lang/String java/lang/String java/lang/String [java/lang/String]] org/objectweb/asm/MethodVisitor)
(toByteArray [] [byte])])
-(def: (string-array values)
+(def: (string_array values)
(-> (List Text) (Array Text))
(let [output (host.array java/lang/String (list.size values))]
(exec (list@map (function (_ [idx value])
- (host.array-write idx value output))
+ (host.array_write idx value output))
(list.enumeration values))
output)))
-(def: (version-flag version)
+(def: (version_flag version)
(-> //.Version Int)
(case version
#//.V1_1 (org/objectweb/asm/Opcodes::V1_1)
@@ -97,7 +97,7 @@
#//.V1_7 (org/objectweb/asm/Opcodes::V1_7)
#//.V1_8 (org/objectweb/asm/Opcodes::V1_8)))
-(def: (visibility-flag visibility)
+(def: (visibility_flag visibility)
(-> //.Visibility Int)
(case visibility
#//.Public (org/objectweb/asm/Opcodes::ACC_PUBLIC)
@@ -105,82 +105,82 @@
#//.Private (org/objectweb/asm/Opcodes::ACC_PRIVATE)
#//.Default +0))
-(def: (class-flags config)
- (-> //.Class-Config Int)
+(def: (class_flags config)
+ (-> //.Class_Config Int)
($_ i.+
(if (get@ #//.finalC config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0)))
-(def: (method-flags config)
- (-> //.Method-Config Int)
+(def: (method_flags config)
+ (-> //.Method_Config Int)
($_ i.+
(if (get@ #//.staticM config) (org/objectweb/asm/Opcodes::ACC_STATIC) +0)
(if (get@ #//.finalM config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0)
(if (get@ #//.synchronizedM config) (org/objectweb/asm/Opcodes::ACC_SYNCHRONIZED) +0)
(if (get@ #//.strictM config) (org/objectweb/asm/Opcodes::ACC_STRICT) +0)))
-(def: (field-flags config)
- (-> //.Field-Config Int)
+(def: (field_flags config)
+ (-> //.Field_Config Int)
($_ i.+
(if (get@ #//.staticF config) (org/objectweb/asm/Opcodes::ACC_STATIC) +0)
(if (get@ #//.finalF config) (org/objectweb/asm/Opcodes::ACC_FINAL) +0)
(if (get@ #//.transientF config) (org/objectweb/asm/Opcodes::ACC_TRANSIENT) +0)
(if (get@ #//.volatileF config) (org/objectweb/asm/Opcodes::ACC_VOLATILE) +0)))
-(def: param-signature
+(def: param_signature
(-> (Type Class) Text)
(|>> ..signature (format ":")))
-(def: (formal-param [name super interfaces])
+(def: (formal_param [name super interfaces])
(-> Constraint Text)
(format name
- (param-signature super)
+ (param_signature super)
(|> interfaces
- (list@map param-signature)
- (text.join-with ""))))
+ (list@map param_signature)
+ (text.join_with ""))))
-(def: (constraints-signature constraints super interfaces)
+(def: (constraints_signature constraints super interfaces)
(-> (List Constraint) (Type Class) (List (Type Class))
Text)
- (let [formal-params (if (list.empty? constraints)
+ (let [formal_params (if (list.empty? constraints)
""
(format "<"
(|> constraints
- (list@map formal-param)
- (text.join-with ""))
+ (list@map formal_param)
+ (text.join_with ""))
">"))]
- (format formal-params
+ (format formal_params
(..signature super)
(|> interfaces
(list@map ..signature)
- (text.join-with "")))))
+ (text.join_with "")))))
-(def: class-computes
+(def: class_computes
Int
($_ i.+
(org/objectweb/asm/ClassWriter::COMPUTE_MAXS)
## (org/objectweb/asm/ClassWriter::COMPUTE_FRAMES)
))
-(def: binary-name (|>> name.internal name.read))
+(def: binary_name (|>> name.internal name.read))
(template [<name> <flag>]
[(def: #export (<name> version visibility config name constraints super interfaces
definitions)
- (-> //.Version //.Visibility //.Class-Config Text (List Constraint) (Type Class) (List (Type Class)) //.Def
+ (-> //.Version //.Visibility //.Class_Config Text (List Constraint) (Type Class) (List (Type Class)) //.Def
(host.type [byte]))
- (let [writer (|> (do-to (org/objectweb/asm/ClassWriter::new class-computes)
- (org/objectweb/asm/ClassWriter::visit (version-flag version)
+ (let [writer (|> (do_to (org/objectweb/asm/ClassWriter::new class_computes)
+ (org/objectweb/asm/ClassWriter::visit (version_flag version)
($_ i.+
(org/objectweb/asm/Opcodes::ACC_SUPER)
<flag>
- (visibility-flag visibility)
- (class-flags config))
- (..binary-name name)
- (constraints-signature constraints super interfaces)
- (..class-name super)
+ (visibility_flag visibility)
+ (class_flags config))
+ (..binary_name name)
+ (constraints_signature constraints super interfaces)
+ (..class_name super)
(|> interfaces
- (list@map ..class-name)
- string-array)))
+ (list@map ..class_name)
+ string_array)))
definitions)
_ (org/objectweb/asm/ClassWriter::visitEnd writer)]
(org/objectweb/asm/ClassWriter::toByteArray writer)))]
@@ -195,36 +195,36 @@
(def: #export (interface version visibility config name constraints interfaces
definitions)
- (-> //.Version //.Visibility //.Class-Config Text (List Constraint) (List (Type Class)) //.Def
+ (-> //.Version //.Visibility //.Class_Config Text (List Constraint) (List (Type Class)) //.Def
(host.type [byte]))
- (let [writer (|> (do-to (org/objectweb/asm/ClassWriter::new class-computes)
- (org/objectweb/asm/ClassWriter::visit (version-flag version)
+ (let [writer (|> (do_to (org/objectweb/asm/ClassWriter::new class_computes)
+ (org/objectweb/asm/ClassWriter::visit (version_flag version)
($_ i.+
(org/objectweb/asm/Opcodes::ACC_SUPER)
(org/objectweb/asm/Opcodes::ACC_INTERFACE)
- (visibility-flag visibility)
- (class-flags config))
- (..binary-name name)
- (constraints-signature constraints $Object interfaces)
- (..class-name $Object)
+ (visibility_flag visibility)
+ (class_flags config))
+ (..binary_name name)
+ (constraints_signature constraints $Object interfaces)
+ (..class_name $Object)
(|> interfaces
- (list@map ..class-name)
- string-array)))
+ (list@map ..class_name)
+ string_array)))
definitions)
_ (org/objectweb/asm/ClassWriter::visitEnd writer)]
(org/objectweb/asm/ClassWriter::toByteArray writer)))
(def: #export (method visibility config name type then)
- (-> //.Visibility //.Method-Config Text (Type Method) //.Inst
+ (-> //.Visibility //.Method_Config Text (Type Method) //.Inst
//.Def)
(function (_ writer)
(let [=method (org/objectweb/asm/ClassWriter::visitMethod ($_ i.+
- (visibility-flag visibility)
- (method-flags config))
- (..binary-name name)
+ (visibility_flag visibility)
+ (method_flags config))
+ (..binary_name name)
(..descriptor type)
(..signature type)
- (string-array (list))
+ (string_array (list))
writer)
_ (org/objectweb/asm/MethodVisitor::visitCode =method)
_ (then =method)
@@ -232,29 +232,29 @@
_ (org/objectweb/asm/MethodVisitor::visitEnd =method)]
writer)))
-(def: #export (abstract-method visibility config name type)
- (-> //.Visibility //.Method-Config Text (Type Method)
+(def: #export (abstract_method visibility config name type)
+ (-> //.Visibility //.Method_Config Text (Type Method)
//.Def)
(function (_ writer)
(let [=method (org/objectweb/asm/ClassWriter::visitMethod ($_ i.+
- (visibility-flag visibility)
- (method-flags config)
+ (visibility_flag visibility)
+ (method_flags config)
(org/objectweb/asm/Opcodes::ACC_ABSTRACT))
- (..binary-name name)
+ (..binary_name name)
(..descriptor type)
(..signature type)
- (string-array (list))
+ (string_array (list))
writer)
_ (org/objectweb/asm/MethodVisitor::visitEnd =method)]
writer)))
(def: #export (field visibility config name type)
- (-> //.Visibility //.Field-Config Text (Type Value) //.Def)
+ (-> //.Visibility //.Field_Config Text (Type Value) //.Def)
(function (_ writer)
- (let [=field (do-to (org/objectweb/asm/ClassWriter::visitField ($_ i.+
- (visibility-flag visibility)
- (field-flags config))
- (..binary-name name)
+ (let [=field (do_to (org/objectweb/asm/ClassWriter::visitField ($_ i.+
+ (visibility_flag visibility)
+ (field_flags config))
+ (..binary_name name)
(..descriptor type)
(..signature type)
(host.null)
@@ -262,30 +262,30 @@
(org/objectweb/asm/FieldVisitor::visitEnd))]
writer)))
-(template [<name> <lux-type> <jvm-type> <prepare>]
+(template [<name> <lux_type> <jvm_type> <prepare>]
[(def: #export (<name> visibility config name value)
- (-> //.Visibility //.Field-Config Text <lux-type> //.Def)
+ (-> //.Visibility //.Field_Config Text <lux_type> //.Def)
(function (_ writer)
- (let [=field (do-to (org/objectweb/asm/ClassWriter::visitField ($_ i.+
- (visibility-flag visibility)
- (field-flags config))
- (..binary-name name)
- (..descriptor <jvm-type>)
- (..signature <jvm-type>)
+ (let [=field (do_to (org/objectweb/asm/ClassWriter::visitField ($_ i.+
+ (visibility_flag visibility)
+ (field_flags config))
+ (..binary_name name)
+ (..descriptor <jvm_type>)
+ (..signature <jvm_type>)
(<prepare> value)
writer)
(org/objectweb/asm/FieldVisitor::visitEnd))]
writer)))]
- [boolean-field Bit type.boolean function.identity]
- [byte-field Int type.byte host.long-to-byte]
- [short-field Int type.short host.long-to-short]
- [int-field Int type.int host.long-to-int]
- [long-field Int type.long function.identity]
- [float-field Frac type.float host.double-to-float]
- [double-field Frac type.double function.identity]
- [char-field Nat type.char (|>> .int host.long-to-int host.int-to-char)]
- [string-field Text (type.class "java.lang.String" (list)) function.identity]
+ [boolean_field Bit type.boolean function.identity]
+ [byte_field Int type.byte host.long_to_byte]
+ [short_field Int type.short host.long_to_short]
+ [int_field Int type.int host.long_to_int]
+ [long_field Int type.long function.identity]
+ [float_field Frac type.float host.double_to_float]
+ [double_field Frac type.double function.identity]
+ [char_field Nat type.char (|>> .int host.long_to_int host.int_to_char)]
+ [string_field Text (type.class "java.lang.String" (list)) function.identity]
)
(def: #export (fuse defs)
diff --git a/lux-jvm/source/luxc/lang/host/jvm/inst.lux b/lux-jvm/source/luxc/lang/host/jvm/inst.lux
index 9d51a15bb..341ded0e4 100644
--- a/lux-jvm/source/luxc/lang/host/jvm/inst.lux
+++ b/lux-jvm/source/luxc/lang/host/jvm/inst.lux
@@ -1,6 +1,6 @@
(.module:
[lux (#- Type int char)
- ["." host (#+ import: do-to)]
+ ["." host (#+ import: do_to)]
[abstract
[monad (#+ do)]]
[control
@@ -34,7 +34,7 @@
[phase (#+ Operation)]]]]
["." // (#+ Inst)])
-(def: class-name (|>> type.descriptor descriptor.class-name name.read))
+(def: class_name (|>> type.descriptor descriptor.class_name name.read))
(def: descriptor (|>> type.descriptor descriptor.descriptor))
(def: reflection (|>> type.reflection reflection.reflection))
@@ -42,9 +42,9 @@
(import: java/lang/Object)
(import: java/lang/String)
-(syntax: (declare {codes (p.many s.local-identifier)})
+(syntax: (declare {codes (p.many s.local_identifier)})
(|> codes
- (list@map (function (_ code) (` ((~' #static) (~ (code.local-identifier code)) (~' int)))))
+ (list@map (function (_ code) (` ((~' #static) (~ (code.local_identifier code)) (~' int)))))
wrap))
(`` (import: org/objectweb/asm/Opcodes
@@ -147,12 +147,12 @@
])
## [Insts]
-(def: #export make-label
+(def: #export make_label
(All [s] (Operation s org/objectweb/asm/Label))
(function (_ state)
(#try.Success [state (org/objectweb/asm/Label::new)])))
-(def: #export (with-label action)
+(def: #export (with_label action)
(All [a] (-> (-> org/objectweb/asm/Label a) a))
(action (org/objectweb/asm/Label::new)))
@@ -160,14 +160,14 @@
[(def: #export (<name> value)
(-> <type> Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitLdcInsn (<prepare> value)))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitLdcInsn (<prepare> value)))))]
[boolean Bit function.identity]
- [int Int host.long-to-int]
+ [int Int host.long_to_int]
[long Int function.identity]
[double Frac function.identity]
- [char Nat (|>> .int host.long-to-int host.int-to-char)]
+ [char Nat (|>> .int host.long_to_int host.int_to_char)]
[string Text function.identity]
)
@@ -178,8 +178,8 @@
[(def: #export <constant>
Inst
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitInsn (!prefix <constant>)))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitInsn (!prefix <constant>)))))]
[ICONST_M1] [ICONST_0] [ICONST_1] [ICONST_2] [ICONST_3] [ICONST_4] [ICONST_5]
[LCONST_0] [LCONST_1]
@@ -190,15 +190,15 @@
(def: #export NULL
Inst
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitInsn (!prefix ACONST_NULL)))))
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitInsn (!prefix ACONST_NULL)))))
(template [<constant>]
[(def: #export (<constant> constant)
(-> Int Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitIntInsn (!prefix <constant>) constant))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitIntInsn (!prefix <constant>) constant))))]
[BIPUSH]
[SIPUSH]
@@ -208,8 +208,8 @@
[(def: #export <name>
Inst
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitInsn (!prefix <name>)))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitInsn (!prefix <name>)))))]
[NOP]
@@ -271,8 +271,8 @@
[(def: #export (<name> register)
(-> Register Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitVarInsn (!prefix <name>) (.int register)))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitVarInsn (!prefix <name>) (.int register)))))]
[IINC]
[ILOAD] [LLOAD] [FLOAD] [DLOAD] [ALOAD]
@@ -283,8 +283,8 @@
[(def: #export (<name> class field type)
(-> (Type Class) Text (Type Value) Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitFieldInsn (<inst>) (..class-name class) field (..descriptor type)))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitFieldInsn (<inst>) (..class_name class) field (..descriptor type)))))]
[GETSTATIC org/objectweb/asm/Opcodes::GETSTATIC]
[PUTSTATIC org/objectweb/asm/Opcodes::PUTSTATIC]
@@ -298,8 +298,8 @@
[(def: #export (<name> class)
(-> (Type <category>) Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitTypeInsn (<inst>) (..class-name class)))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitTypeInsn (<inst>) (..class_name class)))))]
(~~ (template.splice <instructions>+))))]
@@ -315,32 +315,32 @@
(def: #export (NEWARRAY type)
(-> (Type Primitive) Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitIntInsn (org/objectweb/asm/Opcodes::NEWARRAY)
- (`` (cond (~~ (template [<descriptor> <opcode>]
- [(type@= <descriptor> type) (<opcode>)]
-
- [type.boolean org/objectweb/asm/Opcodes::T_BOOLEAN]
- [type.byte org/objectweb/asm/Opcodes::T_BYTE]
- [type.short org/objectweb/asm/Opcodes::T_SHORT]
- [type.int org/objectweb/asm/Opcodes::T_INT]
- [type.long org/objectweb/asm/Opcodes::T_LONG]
- [type.float org/objectweb/asm/Opcodes::T_FLOAT]
- [type.double org/objectweb/asm/Opcodes::T_DOUBLE]
- [type.char org/objectweb/asm/Opcodes::T_CHAR]))
- ## else
- (undefined)))))))
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitIntInsn (org/objectweb/asm/Opcodes::NEWARRAY)
+ (`` (cond (~~ (template [<descriptor> <opcode>]
+ [(type@= <descriptor> type) (<opcode>)]
+
+ [type.boolean org/objectweb/asm/Opcodes::T_BOOLEAN]
+ [type.byte org/objectweb/asm/Opcodes::T_BYTE]
+ [type.short org/objectweb/asm/Opcodes::T_SHORT]
+ [type.int org/objectweb/asm/Opcodes::T_INT]
+ [type.long org/objectweb/asm/Opcodes::T_LONG]
+ [type.float org/objectweb/asm/Opcodes::T_FLOAT]
+ [type.double org/objectweb/asm/Opcodes::T_DOUBLE]
+ [type.char org/objectweb/asm/Opcodes::T_CHAR]))
+ ## else
+ (undefined)))))))
(template [<name> <inst> <interface?>]
- [(def: #export (<name> class method-name method)
+ [(def: #export (<name> class method_name method)
(-> (Type Class) Text (Type Method) Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitMethodInsn (<inst>)
- (..class-name class)
- method-name
- (|> method type.descriptor descriptor.descriptor)
- <interface?>))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitMethodInsn (<inst>)
+ (..class_name class)
+ method_name
+ (|> method type.descriptor descriptor.descriptor)
+ <interface?>))))]
[INVOKESTATIC org/objectweb/asm/Opcodes::INVOKESTATIC false]
[INVOKEVIRTUAL org/objectweb/asm/Opcodes::INVOKEVIRTUAL false]
@@ -352,8 +352,8 @@
[(def: #export (<name> @where)
(-> //.Label Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitJumpInsn (!prefix <name>) @where))))]
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitJumpInsn (!prefix <name>) @where))))]
[IF_ICMPEQ] [IF_ICMPGT] [IF_ICMPLT]
[IF_ICMPNE] [IF_ICMPGE] [IF_ICMPLE]
@@ -368,46 +368,46 @@
(let [keys+labels (list.sort (function (_ left right)
(i.< (product.left left) (product.left right)))
keys+labels)
- array-size (list.size keys+labels)
- keys-array (host.array int array-size)
- labels-array (host.array org/objectweb/asm/Label array-size)
+ array_size (list.size keys+labels)
+ keys_array (host.array int array_size)
+ labels_array (host.array org/objectweb/asm/Label array_size)
_ (loop [idx 0]
- (if (n.< array-size idx)
+ (if (n.< array_size idx)
(let [[key label] (maybe.assume (list.nth idx keys+labels))]
(exec
- (host.array-write idx (host.long-to-int key) keys-array)
- (host.array-write idx label labels-array)
+ (host.array_write idx (host.long_to_int key) keys_array)
+ (host.array_write idx label labels_array)
(recur (inc idx))))
[]))]
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitLookupSwitchInsn default keys-array labels-array)))))
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitLookupSwitchInsn default keys_array labels_array)))))
(def: #export (TABLESWITCH min max default labels)
(-> Int Int //.Label (List //.Label) Inst)
(function (_ visitor)
- (let [num-labels (list.size labels)
- labels-array (host.array org/objectweb/asm/Label num-labels)
+ (let [num_labels (list.size labels)
+ labels_array (host.array org/objectweb/asm/Label num_labels)
_ (loop [idx 0]
- (if (n.< num-labels idx)
- (exec (host.array-write idx
+ (if (n.< num_labels idx)
+ (exec (host.array_write idx
(maybe.assume (list.nth idx labels))
- labels-array)
+ labels_array)
(recur (inc idx)))
[]))]
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitTableSwitchInsn min max default labels-array)))))
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitTableSwitchInsn min max default labels_array)))))
(def: #export (try @from @to @handler exception)
(-> //.Label //.Label //.Label (Type Class) Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitTryCatchBlock @from @to @handler (..class-name exception)))))
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitTryCatchBlock @from @to @handler (..class_name exception)))))
(def: #export (label @label)
(-> //.Label Inst)
(function (_ visitor)
- (do-to visitor
- (org/objectweb/asm/MethodVisitor::visitLabel @label))))
+ (do_to visitor
+ (org/objectweb/asm/MethodVisitor::visitLabel @label))))
(def: #export (array elementT)
(-> (Type Value) Inst)
@@ -435,24 +435,24 @@
## else
(undefined))))]
- [primitive-wrapper
+ [primitive_wrapper
box.boolean box.byte box.short box.int
box.long box.float box.double box.char]
- [primitive-unwrap
+ [primitive_unwrap
"booleanValue" "byteValue" "shortValue" "intValue"
"longValue" "floatValue" "doubleValue" "charValue"]
)
(def: #export (wrap type)
(-> (Type Primitive) Inst)
- (let [wrapper (type.class (primitive-wrapper type) (list))]
+ (let [wrapper (type.class (primitive_wrapper type) (list))]
(INVOKESTATIC wrapper "valueOf" (type.method [(list type) wrapper (list)]))))
(def: #export (unwrap type)
(-> (Type Primitive) Inst)
- (let [wrapper (type.class (primitive-wrapper type) (list))]
+ (let [wrapper (type.class (primitive_wrapper type) (list))]
(|>> (CHECKCAST wrapper)
- (INVOKEVIRTUAL wrapper (primitive-unwrap type) (type.method [(list) type (list)])))))
+ (INVOKEVIRTUAL wrapper (primitive_unwrap type) (type.method [(list) type (list)])))))
(def: #export (fuse insts)
(-> (List Inst) Inst)
diff --git a/lux-jvm/source/luxc/lang/translation/jvm.lux b/lux-jvm/source/luxc/lang/translation/jvm.lux
index 88dc6a96f..84eff942e 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm.lux
@@ -1,6 +1,6 @@
(.module:
[lux (#- Module Definition)
- ["." host (#+ import: do-to object)]
+ ["." host (#+ import: do_to object)]
[abstract
[monad (#+ do)]]
[control
@@ -30,7 +30,7 @@
["." version]
["." generation]]]
[meta
- [io (#+ lux-context)]
+ [io (#+ lux_context)]
[archive
[descriptor (#+ Module)]
["." artifact]]]]]]
@@ -57,27 +57,27 @@
(type: #export ByteCode Binary)
-(def: #export value-field Text "_value")
+(def: #export value_field Text "_value")
(def: #export $Value (type.class "java.lang.Object" (list)))
-(exception: #export (cannot-load {class Text} {error Text})
+(exception: #export (cannot_load {class Text} {error Text})
(exception.report
["Class" class]
["Error" error]))
-(exception: #export (invalid-field {class Text} {field Text} {error Text})
+(exception: #export (invalid_field {class Text} {field Text} {error Text})
(exception.report
["Class" class]
["Field" field]
["Error" error]))
-(exception: #export (invalid-value {class Text})
+(exception: #export (invalid_value {class Text})
(exception.report
["Class" class]))
-(def: (class-value class-name class)
+(def: (class_value class_name class)
(-> Text (java/lang/Class java/lang/Object) (Try Any))
- (case (java/lang/Class::getField ..value-field class)
+ (case (java/lang/Class::getField ..value_field class)
(#try.Success field)
(case (java/lang/reflect/Field::get #.None field)
(#try.Success ?value)
@@ -86,73 +86,73 @@
(#try.Success value)
#.None
- (exception.throw ..invalid-value class-name))
+ (exception.throw ..invalid_value class_name))
(#try.Failure error)
- (exception.throw ..cannot-load [class-name error]))
+ (exception.throw ..cannot_load [class_name error]))
(#try.Failure error)
- (exception.throw ..invalid-field [class-name ..value-field error])))
+ (exception.throw ..invalid_field [class_name ..value_field error])))
-(def: class-path-separator ".")
+(def: class_path_separator ".")
-(def: #export bytecode-name
+(def: #export bytecode_name
(-> Text Text)
- (text.replace-all ..class-path-separator .module-separator))
+ (text.replace_all ..class_path_separator .module_separator))
-(def: #export (class-name [module-id artifact-id])
+(def: #export (class_name [module_id artifact_id])
(-> generation.Context Text)
- (format lux-context
- ..class-path-separator (%.nat version.version)
- ..class-path-separator (%.nat module-id)
- ..class-path-separator (%.nat artifact-id)))
+ (format lux_context
+ ..class_path_separator (%.nat version.version)
+ ..class_path_separator (%.nat module_id)
+ ..class_path_separator (%.nat artifact_id)))
(def: (evaluate! library loader context valueI)
(-> Library java/lang/ClassLoader generation.Context Inst (Try [Any Definition]))
- (let [eval-class (..class-name context)
- bytecode-name (..bytecode-name eval-class)
+ (let [eval_class (..class_name context)
+ bytecode_name (..bytecode_name eval_class)
bytecode (def.class #jvm.V1_6
#jvm.Public jvm.noneC
- bytecode-name
+ bytecode_name
(list) $Value
(list)
(|>> (def.field #jvm.Public ($_ jvm.++F jvm.finalF jvm.staticF)
- ..value-field ..$Value)
+ ..value_field ..$Value)
(def.method #jvm.Public ($_ jvm.++M jvm.staticM jvm.strictM)
"<clinit>"
(type.method [(list) type.void (list)])
(|>> valueI
- (inst.PUTSTATIC (type.class bytecode-name (list)) ..value-field ..$Value)
+ (inst.PUTSTATIC (type.class bytecode_name (list)) ..value_field ..$Value)
inst.RETURN))))]
(io.run (do (try.with io.monad)
- [_ (loader.store eval-class bytecode library)
- class (loader.load eval-class loader)
- value (\ io.monad wrap (..class-value eval-class class))]
+ [_ (loader.store eval_class bytecode library)
+ class (loader.load eval_class loader)
+ value (\ io.monad wrap (..class_value eval_class class))]
(wrap [value
- [eval-class bytecode]])))))
+ [eval_class bytecode]])))))
-(def: (execute! library loader [class-name class-bytecode])
+(def: (execute! library loader [class_name class_bytecode])
(-> Library java/lang/ClassLoader Definition (Try Any))
(io.run (do (try.with io.monad)
- [existing-class? (|> (atom.read library)
+ [existing_class? (|> (atom.read library)
(\ io.monad map (function (_ library)
- (dictionary.key? library class-name)))
+ (dictionary.key? library class_name)))
(try.lift io.monad)
(: (IO (Try Bit))))
- _ (if existing-class?
+ _ (if existing_class?
(wrap [])
- (loader.store class-name class-bytecode library))]
- (loader.load class-name loader))))
+ (loader.store class_name class_bytecode library))]
+ (loader.load class_name loader))))
(def: (define! library loader context valueI)
(-> Library java/lang/ClassLoader generation.Context Inst (Try [Text Any Definition]))
(do try.monad
[[value definition] (evaluate! library loader context valueI)]
- (wrap [(..class-name context) value definition])))
+ (wrap [(..class_name context) value definition])))
(def: #export host
(IO Host)
- (io (let [library (loader.new-library [])
+ (io (let [library (loader.new_library [])
loader (loader.memory library)]
(: Host
(structure
@@ -167,21 +167,21 @@
(..define! library loader))
(def: (ingest context bytecode)
- [(..class-name context) bytecode])
+ [(..class_name context) bytecode])
- (def: (re-learn context [_ bytecode])
+ (def: (re_learn context [_ bytecode])
(io.run
- (loader.store (..class-name context) bytecode library)))
+ (loader.store (..class_name context) bytecode library)))
- (def: (re-load context [_ bytecode])
+ (def: (re_load context [_ bytecode])
(io.run
(do (try.with io.monad)
- [#let [class-name (..class-name context)]
- _ (loader.store class-name bytecode library)
- class (loader.load class-name loader)]
- (\ io.monad wrap (..class-value class-name class))))))))))
+ [#let [class_name (..class_name context)]
+ _ (loader.store class_name bytecode library)
+ class (loader.load class_name loader)]
+ (\ io.monad wrap (..class_value class_name class))))))))))
(def: #export $Variant (type.array ..$Value))
(def: #export $Tuple (type.array ..$Value))
-(def: #export $Runtime (type.class (..class-name [0 0]) (list)))
-(def: #export $Function (type.class (..class-name [0 1]) (list)))
+(def: #export $Runtime (type.class (..class_name [0 0]) (list)))
+(def: #export $Function (type.class (..class_name [0 1]) (list)))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/case.lux b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
index 68d9b4347..b9d6ec6d1 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/case.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/case.lux
@@ -33,15 +33,15 @@
["." runtime]
["." structure]])
-(def: (pop-altI stack-depth)
+(def: (pop_altI stack_depth)
(-> Nat Inst)
- (.case stack-depth
+ (.case stack_depth
0 function.identity
1 _.POP
2 _.POP2
_ ## (n.> 2)
(|>> _.POP2
- (pop-altI (n.- 2 stack-depth)))))
+ (pop_altI (n.- 2 stack_depth)))))
(def: peekI
Inst
@@ -69,7 +69,7 @@
5 _.ICONST_5
_ (_.int (.int value))))
-(def: (left-projection lefts)
+(def: (left_projection lefts)
(-> Nat Inst)
(.let [[indexI accessI] (.case lefts
0
@@ -83,13 +83,13 @@
indexI
accessI)))
-(def: (right-projection lefts)
+(def: (right_projection lefts)
(-> Nat Inst)
(|>> (_.CHECKCAST //.$Tuple)
(leftsI lefts)
(_.INVOKESTATIC //.$Runtime "tuple_right" (type.method [(list //.$Tuple runtime.$Index) //.$Value (list)]))))
-(def: (path' stack-depth @else @end phase archive path)
+(def: (path' stack_depth @else @end phase archive path)
(-> Nat Label Label Phase Archive Path (Operation Inst))
(.case path
#synthesis.Pop
@@ -99,17 +99,17 @@
(operation@wrap (|>> 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)
+ [thenG (path' stack_depth @else @end phase archive thenP)
elseG (.case elseP
(#.Some elseP)
- (path' stack-depth @else @end phase archive elseP)
+ (path' stack_depth @else @end phase archive elseP)
#.None
(wrap (_.GOTO @else)))
#let [ifI (.if when _.IFEQ _.IFNE)]]
- (wrap (<| _.with-label (function (_ @else))
+ (wrap (<| _.with_label (function (_ @else))
(|>> peekI
(_.unwrap type.boolean)
(ifI @else)
@@ -123,8 +123,8 @@
[forkG (: (Operation Inst)
(monad.fold @ (function (_ [test thenP] elseG)
(do @
- [thenG (path' stack-depth @else @end phase archive thenP)]
- (wrap (<| _.with-label (function (_ @else))
+ [thenG (path' stack_depth @else @end phase archive thenP)]
+ (wrap (<| _.with_label (function (_ @else))
(|>> <dup>
(<test> test)
<comparison>
@@ -139,23 +139,23 @@
(wrap (|>> peekI
<unwrap>
forkG)))])
- ([#synthesis.I64-Fork (_.unwrap type.long) _.DUP2 _.POP2 (|>> .int _.long) _.LCMP _.IFNE]
- [#synthesis.F64-Fork (_.unwrap type.double) _.DUP2 _.POP2 _.double _.DCMPL _.IFNE]
- [#synthesis.Text-Fork (|>) _.DUP _.POP _.string
+ ([#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" (type.method [(list //.$Value) type.boolean (list)]))
_.IFEQ])
(#synthesis.Then bodyS)
(do phase.monad
[bodyI (phase archive bodyS)]
- (wrap (|>> (pop-altI stack-depth)
+ (wrap (|>> (pop_altI stack_depth)
bodyI
(_.GOTO @end))))
(^template [<pattern> <right?>]
[(^ (<pattern> lefts))
- (operation@wrap (<| _.with-label (function (_ @success))
- _.with-label (function (_ @fail))
+ (operation@wrap (<| _.with_label (function (_ @success))
+ _.with_label (function (_ @fail))
(|>> peekI
(_.CHECKCAST //.$Variant)
(structure.tagI lefts <right?>)
@@ -181,31 +181,31 @@
(^ (synthesis.path/seq
(<path> lefts)
- (synthesis.!bind-top register thenP)))
+ (synthesis.!bind_top register thenP)))
(do phase.monad
- [then! (path' stack-depth @else @end phase archive thenP)]
+ [then! (path' stack_depth @else @end phase archive thenP)]
(wrap (|>> peekI
(<projection> lefts)
(_.ASTORE register)
then!)))])
- ([synthesis.member/left ..left-projection]
- [synthesis.member/right ..right-projection])
+ ([synthesis.member/left ..left_projection]
+ [synthesis.member/right ..right_projection])
(#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)]
+ [leftI (path' stack_depth @else @end phase archive leftP)
+ rightI (path' stack_depth @else @end phase archive rightP)]
(wrap (|>> leftI
rightI)))
(#synthesis.Alt leftP rightP)
(do phase.monad
- [@alt-else _.make-label
- leftI (path' (inc stack-depth) @alt-else @end phase archive leftP)
- rightI (path' stack-depth @else @end phase archive rightP)]
+ [@alt_else _.make_label
+ leftI (path' (inc stack_depth) @alt_else @end phase archive leftP)
+ rightI (path' stack_depth @else @end phase archive rightP)]
(wrap (|>> _.DUP
leftI
- (_.label @alt-else)
+ (_.label @alt_else)
_.POP
rightI)))
))
@@ -213,7 +213,7 @@
(def: (path @end phase archive path)
(-> Label Phase Archive Path (Operation Inst))
(do phase.monad
- [@else _.make-label
+ [@else _.make_label
pathI (..path' 1 @else @end phase archive path)]
(wrap (|>> pathI
(_.label @else)
@@ -228,8 +228,8 @@
[testI (phase archive testS)
thenI (phase archive thenS)
elseI (phase archive elseS)]
- (wrap (<| _.with-label (function (_ @else))
- _.with-label (function (_ @end))
+ (wrap (<| _.with_label (function (_ @else))
+ _.with_label (function (_ @end))
(|>> testI
(_.unwrap type.boolean)
(_.IFEQ @else)
@@ -252,21 +252,21 @@
(Generator [(List synthesis.Member) Synthesis])
(do phase.monad
[recordG (phase archive recordS)]
- (wrap (list@fold (function (_ step so-far)
+ (wrap (list@fold (function (_ step so_far)
(.let [next (.case step
(#.Left lefts)
- (..left-projection lefts)
+ (..left_projection lefts)
(#.Right lefts)
- (..right-projection lefts))]
- (|>> so-far next)))
+ (..right_projection lefts))]
+ (|>> so_far next)))
recordG
(list.reverse path)))))
(def: #export (case phase archive [valueS path])
(Generator [Synthesis Path])
(do phase.monad
- [@end _.make-label
+ [@end _.make_label
valueI (phase archive valueS)
pathI (..path @end phase archive path)]
(wrap (|>> _.NULL
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 e73ea068e..ff56c7824 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/common.lux
@@ -44,13 +44,13 @@
(-> [(Parser s)
(-> Text Phase Archive s (Operation Inst))]
Handler))
- (function (_ extension-name phase archive input)
+ (function (_ extension_name phase archive input)
(case (<s>.run parser input)
(#try.Success input')
- (handler extension-name phase archive input')
+ (handler extension_name phase archive input')
(#try.Failure error)
- (phase.throw extension.invalid-syntax [extension-name %synthesis input]))))
+ (phase.throw extension.invalid_syntax [extension_name %synthesis input]))))
(import: java/lang/Double
["#::."
@@ -62,16 +62,16 @@
(def: $System (type.class "java.lang.System" (list)))
(def: $Object (type.class "java.lang.Object" (list)))
-(def: lux-intI Inst (|>> _.I2L (_.wrap type.long)))
-(def: jvm-intI Inst (|>> (_.unwrap type.long) _.L2I))
-(def: check-stringI Inst (_.CHECKCAST $String))
+(def: lux_intI Inst (|>> _.I2L (_.wrap type.long)))
+(def: jvm_intI Inst (|>> (_.unwrap type.long) _.L2I))
+(def: check_stringI Inst (_.CHECKCAST $String))
(def: (predicateI tester)
(-> (-> Label Inst)
Inst)
(let [$Boolean (type.class "java.lang.Boolean" (list))]
- (<| _.with-label (function (_ @then))
- _.with-label (function (_ @end))
+ (<| _.with_label (function (_ @then))
+ _.with_label (function (_ @end))
(|>> (tester @then)
(_.GETSTATIC $Boolean "FALSE" $Boolean)
(_.GOTO @end)
@@ -83,16 +83,16 @@
(def: unitI Inst (_.string synthesis.unit))
## TODO: Get rid of this ASAP
-(def: lux::syntax-char-case!
+(def: lux::syntax_char_case!
(..custom [($_ <>.and
<s>.any
<s>.any
(<>.some (<s>.tuple ($_ <>.and
(<s>.tuple (<>.many <s>.i64))
<s>.any))))
- (function (_ extension-name phase archive [input else conditionals])
- (<| _.with-label (function (_ @end))
- _.with-label (function (_ @else))
+ (function (_ extension_name phase archive [input else conditionals])
+ (<| _.with_label (function (_ @end))
+ _.with_label (function (_ @else))
(do {@ phase.monad}
[inputG (phase archive input)
elseG (phase archive else)
@@ -101,7 +101,7 @@
(monad.map @ (function (_ [chars branch])
(do @
[branchG (phase archive branch)]
- (wrap (<| _.with-label (function (_ @branch))
+ (wrap (<| _.with_label (function (_ @branch))
[(list@map (function (_ char)
[(.int char) @branch])
chars)
@@ -151,13 +151,13 @@
[(def: (<name> [shiftI inputI])
(Binary Inst)
(|>> inputI (_.unwrap type.long)
- shiftI jvm-intI
+ shiftI jvm_intI
<op>
(_.wrap type.long)))]
- [i64::left-shift _.LSHL]
- [i64::arithmetic-right-shift _.LSHR]
- [i64::logical-right-shift _.LUSHR]
+ [i64::left_shift _.LSHL]
+ [i64::arithmetic_right_shift _.LSHR]
+ [i64::logical_right_shift _.LUSHR]
)
(template [<name> <const> <type>]
@@ -220,76 +220,76 @@
[f64::i64 (_.unwrap type.double) (<| (_.wrap type.long) _.D2L)]
[f64::encode (_.unwrap type.double)
(_.INVOKESTATIC (type.class "java.lang.Double" (list)) "toString" (type.method [(list type.double) $String (list)]))]
- [f64::decode ..check-stringI
+ [f64::decode ..check_stringI
(_.INVOKESTATIC ///.$Runtime "decode_frac" (type.method [(list $String) ///.$Variant (list)]))]
)
(def: (text::size inputI)
(Unary Inst)
(|>> inputI
- ..check-stringI
+ ..check_stringI
(_.INVOKEVIRTUAL $String "length" (type.method [(list) type.int (list)]))
- lux-intI))
+ lux_intI))
-(template [<name> <pre-subject> <pre-param> <op> <post>]
+(template [<name> <pre_subject> <pre_param> <op> <post>]
[(def: (<name> [paramI subjectI])
(Binary Inst)
- (|>> subjectI <pre-subject>
- paramI <pre-param>
+ (|>> subjectI <pre_subject>
+ paramI <pre_param>
<op> <post>))]
[text::= (<|) (<|)
(_.INVOKEVIRTUAL $Object "equals" (type.method [(list $Object) type.boolean (list)]))
(_.wrap type.boolean)]
- [text::< ..check-stringI ..check-stringI
+ [text::< ..check_stringI ..check_stringI
(_.INVOKEVIRTUAL $String "compareTo" (type.method [(list $String) type.int (list)]))
(predicateI _.IFLT)]
- [text::char ..check-stringI jvm-intI
+ [text::char ..check_stringI jvm_intI
(_.INVOKEVIRTUAL $String "charAt" (type.method [(list type.int) type.char (list)]))
- lux-intI]
+ lux_intI]
)
(def: (text::concat [leftI rightI])
(Binary Inst)
- (|>> leftI ..check-stringI
- rightI ..check-stringI
+ (|>> leftI ..check_stringI
+ rightI ..check_stringI
(_.INVOKEVIRTUAL $String "concat" (type.method [(list $String) $String (list)]))))
(def: (text::clip [startI endI subjectI])
(Trinary Inst)
- (|>> subjectI ..check-stringI
- startI jvm-intI
- endI jvm-intI
+ (|>> subjectI ..check_stringI
+ startI jvm_intI
+ endI jvm_intI
(_.INVOKEVIRTUAL $String "substring" (type.method [(list type.int type.int) $String (list)]))))
-(def: index-method (type.method [(list $String type.int) type.int (list)]))
+(def: index_method (type.method [(list $String type.int) type.int (list)]))
(def: (text::index [startI partI textI])
(Trinary Inst)
- (<| _.with-label (function (_ @not-found))
- _.with-label (function (_ @end))
- (|>> textI ..check-stringI
- partI ..check-stringI
- startI jvm-intI
- (_.INVOKEVIRTUAL $String "indexOf" index-method)
+ (<| _.with_label (function (_ @not_found))
+ _.with_label (function (_ @end))
+ (|>> textI ..check_stringI
+ partI ..check_stringI
+ startI jvm_intI
+ (_.INVOKEVIRTUAL $String "indexOf" index_method)
_.DUP
(_.int -1)
- (_.IF_ICMPEQ @not-found)
- lux-intI
+ (_.IF_ICMPEQ @not_found)
+ lux_intI
runtime.someI
(_.GOTO @end)
- (_.label @not-found)
+ (_.label @not_found)
_.POP
runtime.noneI
(_.label @end))))
-(def: string-method (type.method [(list $String) type.void (list)]))
+(def: string_method (type.method [(list $String) type.void (list)]))
(def: (io::log messageI)
(Unary Inst)
(let [$PrintStream (type.class "java.io.PrintStream" (list))]
(|>> (_.GETSTATIC $System "out" $PrintStream)
messageI
- ..check-stringI
- (_.INVOKEVIRTUAL $PrintStream "println" string-method)
+ ..check_stringI
+ (_.INVOKEVIRTUAL $PrintStream "println" string_method)
unitI)))
(def: (io::error messageI)
@@ -298,17 +298,17 @@
(|>> (_.NEW $Error)
_.DUP
messageI
- ..check-stringI
- (_.INVOKESPECIAL $Error "<init>" string-method)
+ ..check_stringI
+ (_.INVOKESPECIAL $Error "<init>" string_method)
_.ATHROW)))
(def: (io::exit codeI)
(Unary Inst)
- (|>> codeI jvm-intI
+ (|>> codeI jvm_intI
(_.INVOKESTATIC $System "exit" (type.method [(list type.int) type.void (list)]))
_.NULL))
-(def: (io::current-time _)
+(def: (io::current_time _)
(Nullary Inst)
(|>> (_.INVOKESTATIC $System "currentTimeMillis" (type.method [(list) type.long (list)]))
(_.wrap type.long)))
@@ -316,7 +316,7 @@
(def: bundle::lux
Bundle
(|> (: Bundle bundle.empty)
- (bundle.install "syntax char case!" lux::syntax-char-case!)
+ (bundle.install "syntax char case!" lux::syntax_char_case!)
(bundle.install "is" (binary lux::is))
(bundle.install "try" (unary lux::try))))
@@ -327,9 +327,9 @@
(bundle.install "and" (binary i64::and))
(bundle.install "or" (binary i64::or))
(bundle.install "xor" (binary i64::xor))
- (bundle.install "left-shift" (binary i64::left-shift))
- (bundle.install "logical-right-shift" (binary i64::logical-right-shift))
- (bundle.install "arithmetic-right-shift" (binary i64::arithmetic-right-shift))
+ (bundle.install "left-shift" (binary i64::left_shift))
+ (bundle.install "logical-right-shift" (binary i64::logical_right_shift))
+ (bundle.install "arithmetic-right-shift" (binary i64::arithmetic_right_shift))
(bundle.install "=" (binary i64::=))
(bundle.install "<" (binary i64::<))
(bundle.install "+" (binary i64::+))
@@ -377,7 +377,7 @@
(bundle.install "log" (unary io::log))
(bundle.install "error" (unary io::error))
(bundle.install "exit" (unary io::exit))
- (bundle.install "current-time" (nullary io::current-time)))))
+ (bundle.install "current-time" (nullary io::current_time)))))
(def: #export bundle
Bundle
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 77f421703..d83a6d841 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/extension/host.lux
@@ -74,11 +74,11 @@
[return Return parser.return]
)
-(exception: #export (not-an-object-array {arrayJT (Type Array)})
+(exception: #export (not_an_object_array {arrayJT (Type Array)})
(exception.report
["JVM Type" (|> arrayJT type.signature signature.signature)]))
-(def: #export object-array
+(def: #export object_array
(Parser (Type Object))
(do <>.monad
[arrayJT (<t>.embed parser.array <s>.text)]
@@ -89,7 +89,7 @@
(wrap elementJT)
#.None
- (<>.fail (exception.construct ..not-an-object-array arrayJT)))
+ (<>.fail (exception.construct ..not_an_object_array arrayJT)))
#.None
(undefined))))
@@ -112,60 +112,60 @@
(|>> inputI
<conversion>)))]
- [_.D2F conversion::double-to-float]
- [_.D2I conversion::double-to-int]
- [_.D2L conversion::double-to-long]
- [_.F2D conversion::float-to-double]
- [_.F2I conversion::float-to-int]
- [_.F2L conversion::float-to-long]
- [_.I2B conversion::int-to-byte]
- [_.I2C conversion::int-to-char]
- [_.I2D conversion::int-to-double]
- [_.I2F conversion::int-to-float]
- [_.I2L conversion::int-to-long]
- [_.I2S conversion::int-to-short]
- [_.L2D conversion::long-to-double]
- [_.L2F conversion::long-to-float]
- [_.L2I conversion::long-to-int]
- [..L2S conversion::long-to-short]
- [..L2B conversion::long-to-byte]
- [..L2C conversion::long-to-char]
- [_.I2B conversion::char-to-byte]
- [_.I2S conversion::char-to-short]
- [_.NOP conversion::char-to-int]
- [_.I2L conversion::char-to-long]
- [_.I2L conversion::byte-to-long]
- [_.I2L conversion::short-to-long]
+ [_.D2F conversion::double_to_float]
+ [_.D2I conversion::double_to_int]
+ [_.D2L conversion::double_to_long]
+ [_.F2D conversion::float_to_double]
+ [_.F2I conversion::float_to_int]
+ [_.F2L conversion::float_to_long]
+ [_.I2B conversion::int_to_byte]
+ [_.I2C conversion::int_to_char]
+ [_.I2D conversion::int_to_double]
+ [_.I2F conversion::int_to_float]
+ [_.I2L conversion::int_to_long]
+ [_.I2S conversion::int_to_short]
+ [_.L2D conversion::long_to_double]
+ [_.L2F conversion::long_to_float]
+ [_.L2I conversion::long_to_int]
+ [..L2S conversion::long_to_short]
+ [..L2B conversion::long_to_byte]
+ [..L2C conversion::long_to_char]
+ [_.I2B conversion::char_to_byte]
+ [_.I2S conversion::char_to_short]
+ [_.NOP conversion::char_to_int]
+ [_.I2L conversion::char_to_long]
+ [_.I2L conversion::byte_to_long]
+ [_.I2L conversion::short_to_long]
)
(def: conversion
Bundle
(<| (bundle.prefix "conversion")
(|> (: Bundle bundle.empty)
- (bundle.install "double-to-float" (unary conversion::double-to-float))
- (bundle.install "double-to-int" (unary conversion::double-to-int))
- (bundle.install "double-to-long" (unary conversion::double-to-long))
- (bundle.install "float-to-double" (unary conversion::float-to-double))
- (bundle.install "float-to-int" (unary conversion::float-to-int))
- (bundle.install "float-to-long" (unary conversion::float-to-long))
- (bundle.install "int-to-byte" (unary conversion::int-to-byte))
- (bundle.install "int-to-char" (unary conversion::int-to-char))
- (bundle.install "int-to-double" (unary conversion::int-to-double))
- (bundle.install "int-to-float" (unary conversion::int-to-float))
- (bundle.install "int-to-long" (unary conversion::int-to-long))
- (bundle.install "int-to-short" (unary conversion::int-to-short))
- (bundle.install "long-to-double" (unary conversion::long-to-double))
- (bundle.install "long-to-float" (unary conversion::long-to-float))
- (bundle.install "long-to-int" (unary conversion::long-to-int))
- (bundle.install "long-to-short" (unary conversion::long-to-short))
- (bundle.install "long-to-byte" (unary conversion::long-to-byte))
- (bundle.install "long-to-char" (unary conversion::long-to-char))
- (bundle.install "char-to-byte" (unary conversion::char-to-byte))
- (bundle.install "char-to-short" (unary conversion::char-to-short))
- (bundle.install "char-to-int" (unary conversion::char-to-int))
- (bundle.install "char-to-long" (unary conversion::char-to-long))
- (bundle.install "byte-to-long" (unary conversion::byte-to-long))
- (bundle.install "short-to-long" (unary conversion::short-to-long))
+ (bundle.install "double-to-float" (unary conversion::double_to_float))
+ (bundle.install "double-to-int" (unary conversion::double_to_int))
+ (bundle.install "double-to-long" (unary conversion::double_to_long))
+ (bundle.install "float-to-double" (unary conversion::float_to_double))
+ (bundle.install "float-to-int" (unary conversion::float_to_int))
+ (bundle.install "float-to-long" (unary conversion::float_to_long))
+ (bundle.install "int-to-byte" (unary conversion::int_to_byte))
+ (bundle.install "int-to-char" (unary conversion::int_to_char))
+ (bundle.install "int-to-double" (unary conversion::int_to_double))
+ (bundle.install "int-to-float" (unary conversion::int_to_float))
+ (bundle.install "int-to-long" (unary conversion::int_to_long))
+ (bundle.install "int-to-short" (unary conversion::int_to_short))
+ (bundle.install "long-to-double" (unary conversion::long_to_double))
+ (bundle.install "long-to-float" (unary conversion::long_to_float))
+ (bundle.install "long-to-int" (unary conversion::long_to_int))
+ (bundle.install "long-to-short" (unary conversion::long_to_short))
+ (bundle.install "long-to-byte" (unary conversion::long_to_byte))
+ (bundle.install "long-to-char" (unary conversion::long_to_char))
+ (bundle.install "char-to-byte" (unary conversion::char_to_byte))
+ (bundle.install "char-to-short" (unary conversion::char_to_short))
+ (bundle.install "char-to-int" (unary conversion::char_to_int))
+ (bundle.install "char-to-long" (unary conversion::char_to_long))
+ (bundle.install "byte-to-long" (unary conversion::byte_to_long))
+ (bundle.install "short-to-long" (unary conversion::short_to_long))
)))
(template [<name> <op>]
@@ -219,8 +219,8 @@
(template [<name> <op>]
[(def: (<name> [referenceI subjectI])
(Binary Inst)
- (<| _.with-label (function (_ @then))
- _.with-label (function (_ @end))
+ (<| _.with_label (function (_ @then))
+ _.with_label (function (_ @end))
(|>> subjectI
referenceI
(<op> @then)
@@ -240,8 +240,8 @@
(template [<name> <op> <reference>]
[(def: (<name> [referenceI subjectI])
(Binary Inst)
- (<| _.with-label (function (_ @then))
- _.with-label (function (_ @end))
+ (<| _.with_label (function (_ @then))
+ _.with_label (function (_ @end))
(|>> subjectI
referenceI
<op>
@@ -335,72 +335,72 @@
(bundle.install "<" (binary char::<))
)))
-(def: (primitive-array-length-handler jvm-primitive)
+(def: (primitive_array_length_handler jvm_primitive)
(-> (Type Primitive) Handler)
(..custom
[<s>.any
- (function (_ extension-name generate archive arrayS)
+ (function (_ extension_name generate archive arrayS)
(do phase.monad
[arrayI (generate archive arrayS)]
(wrap (|>> arrayI
- (_.CHECKCAST (type.array jvm-primitive))
+ (_.CHECKCAST (type.array jvm_primitive))
_.ARRAYLENGTH))))]))
(def: array::length::object
Handler
(..custom
- [($_ <>.and ..object-array <s>.any)
- (function (_ extension-name generate archive [elementJT arrayS])
+ [($_ <>.and ..object_array <s>.any)
+ (function (_ extension_name generate archive [elementJT arrayS])
(do phase.monad
[arrayI (generate archive arrayS)]
(wrap (|>> arrayI
(_.CHECKCAST (type.array elementJT))
_.ARRAYLENGTH))))]))
-(def: (new-primitive-array-handler jvm-primitive)
+(def: (new_primitive_array_handler jvm_primitive)
(-> (Type Primitive) Handler)
- (function (_ extension-name generate archive inputs)
+ (function (_ extension_name generate archive inputs)
(case inputs
(^ (list lengthS))
(do phase.monad
[lengthI (generate archive lengthS)]
(wrap (|>> lengthI
- (_.array jvm-primitive))))
+ (_.array jvm_primitive))))
_
- (phase.throw extension.invalid-syntax [extension-name %synthesis inputs]))))
+ (phase.throw extension.invalid_syntax [extension_name %synthesis inputs]))))
(def: array::new::object
Handler
(..custom
[($_ <>.and ..object <s>.any)
- (function (_ extension-name generate archive [objectJT lengthS])
+ (function (_ extension_name generate archive [objectJT lengthS])
(do phase.monad
[lengthI (generate archive lengthS)]
(wrap (|>> lengthI
(_.ANEWARRAY objectJT)))))]))
-(def: (read-primitive-array-handler jvm-primitive loadI)
+(def: (read_primitive_array_handler jvm_primitive loadI)
(-> (Type Primitive) Inst Handler)
- (function (_ extension-name generate archive inputs)
+ (function (_ extension_name generate archive inputs)
(case inputs
(^ (list idxS arrayS))
(do phase.monad
[arrayI (generate archive arrayS)
idxI (generate archive idxS)]
(wrap (|>> arrayI
- (_.CHECKCAST (type.array jvm-primitive))
+ (_.CHECKCAST (type.array jvm_primitive))
idxI
loadI)))
_
- (phase.throw extension.invalid-syntax [extension-name %synthesis inputs]))))
+ (phase.throw extension.invalid_syntax [extension_name %synthesis inputs]))))
(def: array::read::object
Handler
(..custom
- [($_ <>.and ..object-array <s>.any <s>.any)
- (function (_ extension-name generate archive [elementJT idxS arrayS])
+ [($_ <>.and ..object_array <s>.any <s>.any)
+ (function (_ extension_name generate archive [elementJT idxS arrayS])
(do phase.monad
[arrayI (generate archive arrayS)
idxI (generate archive idxS)]
@@ -409,9 +409,9 @@
idxI
_.AALOAD))))]))
-(def: (write-primitive-array-handler jvm-primitive storeI)
+(def: (write_primitive_array_handler jvm_primitive storeI)
(-> (Type Primitive) Inst Handler)
- (function (_ extension-name generate archive inputs)
+ (function (_ extension_name generate archive inputs)
(case inputs
(^ (list idxS valueS arrayS))
(do phase.monad
@@ -419,20 +419,20 @@
idxI (generate archive idxS)
valueI (generate archive valueS)]
(wrap (|>> arrayI
- (_.CHECKCAST (type.array jvm-primitive))
+ (_.CHECKCAST (type.array jvm_primitive))
_.DUP
idxI
valueI
storeI)))
_
- (phase.throw extension.invalid-syntax [extension-name %synthesis inputs]))))
+ (phase.throw extension.invalid_syntax [extension_name %synthesis inputs]))))
(def: array::write::object
Handler
(..custom
- [($_ <>.and ..object-array <s>.any <s>.any <s>.any)
- (function (_ extension-name generate archive [elementJT idxS valueS arrayS])
+ [($_ <>.and ..object_array <s>.any <s>.any <s>.any)
+ (function (_ extension_name generate archive [elementJT idxS valueS arrayS])
(do phase.monad
[arrayI (generate archive arrayS)
idxI (generate archive idxS)
@@ -450,47 +450,47 @@
(|> bundle.empty
(dictionary.merge (<| (bundle.prefix "length")
(|> bundle.empty
- (bundle.install (reflection.reflection reflection.boolean) (primitive-array-length-handler type.boolean))
- (bundle.install (reflection.reflection reflection.byte) (primitive-array-length-handler type.byte))
- (bundle.install (reflection.reflection reflection.short) (primitive-array-length-handler type.short))
- (bundle.install (reflection.reflection reflection.int) (primitive-array-length-handler type.int))
- (bundle.install (reflection.reflection reflection.long) (primitive-array-length-handler type.long))
- (bundle.install (reflection.reflection reflection.float) (primitive-array-length-handler type.float))
- (bundle.install (reflection.reflection reflection.double) (primitive-array-length-handler type.double))
- (bundle.install (reflection.reflection reflection.char) (primitive-array-length-handler type.char))
+ (bundle.install (reflection.reflection reflection.boolean) (primitive_array_length_handler type.boolean))
+ (bundle.install (reflection.reflection reflection.byte) (primitive_array_length_handler type.byte))
+ (bundle.install (reflection.reflection reflection.short) (primitive_array_length_handler type.short))
+ (bundle.install (reflection.reflection reflection.int) (primitive_array_length_handler type.int))
+ (bundle.install (reflection.reflection reflection.long) (primitive_array_length_handler type.long))
+ (bundle.install (reflection.reflection reflection.float) (primitive_array_length_handler type.float))
+ (bundle.install (reflection.reflection reflection.double) (primitive_array_length_handler type.double))
+ (bundle.install (reflection.reflection reflection.char) (primitive_array_length_handler type.char))
(bundle.install "object" array::length::object))))
(dictionary.merge (<| (bundle.prefix "new")
(|> bundle.empty
- (bundle.install (reflection.reflection reflection.boolean) (new-primitive-array-handler type.boolean))
- (bundle.install (reflection.reflection reflection.byte) (new-primitive-array-handler type.byte))
- (bundle.install (reflection.reflection reflection.short) (new-primitive-array-handler type.short))
- (bundle.install (reflection.reflection reflection.int) (new-primitive-array-handler type.int))
- (bundle.install (reflection.reflection reflection.long) (new-primitive-array-handler type.long))
- (bundle.install (reflection.reflection reflection.float) (new-primitive-array-handler type.float))
- (bundle.install (reflection.reflection reflection.double) (new-primitive-array-handler type.double))
- (bundle.install (reflection.reflection reflection.char) (new-primitive-array-handler type.char))
+ (bundle.install (reflection.reflection reflection.boolean) (new_primitive_array_handler type.boolean))
+ (bundle.install (reflection.reflection reflection.byte) (new_primitive_array_handler type.byte))
+ (bundle.install (reflection.reflection reflection.short) (new_primitive_array_handler type.short))
+ (bundle.install (reflection.reflection reflection.int) (new_primitive_array_handler type.int))
+ (bundle.install (reflection.reflection reflection.long) (new_primitive_array_handler type.long))
+ (bundle.install (reflection.reflection reflection.float) (new_primitive_array_handler type.float))
+ (bundle.install (reflection.reflection reflection.double) (new_primitive_array_handler type.double))
+ (bundle.install (reflection.reflection reflection.char) (new_primitive_array_handler type.char))
(bundle.install "object" array::new::object))))
(dictionary.merge (<| (bundle.prefix "read")
(|> bundle.empty
- (bundle.install (reflection.reflection reflection.boolean) (read-primitive-array-handler type.boolean _.BALOAD))
- (bundle.install (reflection.reflection reflection.byte) (read-primitive-array-handler type.byte _.BALOAD))
- (bundle.install (reflection.reflection reflection.short) (read-primitive-array-handler type.short _.SALOAD))
- (bundle.install (reflection.reflection reflection.int) (read-primitive-array-handler type.int _.IALOAD))
- (bundle.install (reflection.reflection reflection.long) (read-primitive-array-handler type.long _.LALOAD))
- (bundle.install (reflection.reflection reflection.float) (read-primitive-array-handler type.float _.FALOAD))
- (bundle.install (reflection.reflection reflection.double) (read-primitive-array-handler type.double _.DALOAD))
- (bundle.install (reflection.reflection reflection.char) (read-primitive-array-handler type.char _.CALOAD))
+ (bundle.install (reflection.reflection reflection.boolean) (read_primitive_array_handler type.boolean _.BALOAD))
+ (bundle.install (reflection.reflection reflection.byte) (read_primitive_array_handler type.byte _.BALOAD))
+ (bundle.install (reflection.reflection reflection.short) (read_primitive_array_handler type.short _.SALOAD))
+ (bundle.install (reflection.reflection reflection.int) (read_primitive_array_handler type.int _.IALOAD))
+ (bundle.install (reflection.reflection reflection.long) (read_primitive_array_handler type.long _.LALOAD))
+ (bundle.install (reflection.reflection reflection.float) (read_primitive_array_handler type.float _.FALOAD))
+ (bundle.install (reflection.reflection reflection.double) (read_primitive_array_handler type.double _.DALOAD))
+ (bundle.install (reflection.reflection reflection.char) (read_primitive_array_handler type.char _.CALOAD))
(bundle.install "object" array::read::object))))
(dictionary.merge (<| (bundle.prefix "write")
(|> bundle.empty
- (bundle.install (reflection.reflection reflection.boolean) (write-primitive-array-handler type.boolean _.BASTORE))
- (bundle.install (reflection.reflection reflection.byte) (write-primitive-array-handler type.byte _.BASTORE))
- (bundle.install (reflection.reflection reflection.short) (write-primitive-array-handler type.short _.SASTORE))
- (bundle.install (reflection.reflection reflection.int) (write-primitive-array-handler type.int _.IASTORE))
- (bundle.install (reflection.reflection reflection.long) (write-primitive-array-handler type.long _.LASTORE))
- (bundle.install (reflection.reflection reflection.float) (write-primitive-array-handler type.float _.FASTORE))
- (bundle.install (reflection.reflection reflection.double) (write-primitive-array-handler type.double _.DASTORE))
- (bundle.install (reflection.reflection reflection.char) (write-primitive-array-handler type.char _.CASTORE))
+ (bundle.install (reflection.reflection reflection.boolean) (write_primitive_array_handler type.boolean _.BASTORE))
+ (bundle.install (reflection.reflection reflection.byte) (write_primitive_array_handler type.byte _.BASTORE))
+ (bundle.install (reflection.reflection reflection.short) (write_primitive_array_handler type.short _.SASTORE))
+ (bundle.install (reflection.reflection reflection.int) (write_primitive_array_handler type.int _.IASTORE))
+ (bundle.install (reflection.reflection reflection.long) (write_primitive_array_handler type.long _.LASTORE))
+ (bundle.install (reflection.reflection reflection.float) (write_primitive_array_handler type.float _.FASTORE))
+ (bundle.install (reflection.reflection reflection.double) (write_primitive_array_handler type.double _.DASTORE))
+ (bundle.install (reflection.reflection reflection.char) (write_primitive_array_handler type.char _.CASTORE))
(bundle.install "object" array::write::object))))
)))
@@ -500,8 +500,8 @@
(def: (object::null? objectI)
(Unary Inst)
- (<| _.with-label (function (_ @then))
- _.with-label (function (_ @end))
+ (<| _.with_label (function (_ @then))
+ _.with_label (function (_ @end))
(|>> objectI
(_.IFNULL @then)
falseI
@@ -526,7 +526,7 @@
(def: $Class (type.class "java.lang.Class" (list)))
-(def: (object::class extension-name generate archive inputs)
+(def: (object::class extension_name generate archive inputs)
Handler
(case inputs
(^ (list (synthesis.text class)))
@@ -536,20 +536,20 @@
(_.INVOKESTATIC $Class "forName" (type.method [(list (type.class "java.lang.String" (list))) $Class (list)])))))
_
- (phase.throw extension.invalid-syntax [extension-name %synthesis inputs])))
+ (phase.throw extension.invalid_syntax [extension_name %synthesis inputs])))
(def: object::instance?
Handler
(..custom
[($_ <>.and <s>.text <s>.any)
- (function (_ extension-name generate archive [class objectS])
+ (function (_ extension_name generate archive [class objectS])
(do phase.monad
[objectI (generate archive objectS)]
(wrap (|>> objectI
(_.INSTANCEOF (type.class class (list)))
(_.wrap type.boolean)))))]))
-(def: (object::cast extension-name generate archive inputs)
+(def: (object::cast extension_name generate archive inputs)
Handler
(case inputs
(^ (list (synthesis.text from) (synthesis.text to) valueS))
@@ -580,9 +580,9 @@
(wrap valueI))))
_
- (phase.throw extension.invalid-syntax [extension-name %synthesis inputs])))
+ (phase.throw extension.invalid_syntax [extension_name %synthesis inputs])))
-(def: object-bundle
+(def: object_bundle
Bundle
(<| (bundle.prefix "object")
(|> (: Bundle bundle.empty)
@@ -605,13 +605,13 @@
[(reflection.reflection reflection.float) type.float]
[(reflection.reflection reflection.double) type.double]
[(reflection.reflection reflection.char) type.char])
- (dictionary.from-list text.hash)))
+ (dictionary.from_list text.hash)))
(def: get::static
Handler
(..custom
[($_ <>.and <s>.text <s>.text <s>.text)
- (function (_ extension-name generate archive [class field unboxed])
+ (function (_ extension_name generate archive [class field unboxed])
(do phase.monad
[]
(case (dictionary.get unboxed ..primitives)
@@ -625,7 +625,7 @@
Handler
(..custom
[($_ <>.and <s>.text <s>.text <s>.text <s>.any)
- (function (_ extension-name generate archive [class field unboxed valueS])
+ (function (_ extension_name generate archive [class field unboxed valueS])
(do phase.monad
[valueI (generate archive valueS)
#let [$class (type.class class (list))]]
@@ -645,7 +645,7 @@
Handler
(..custom
[($_ <>.and <s>.text <s>.text <s>.text <s>.any)
- (function (_ extension-name generate archive [class field unboxed objectS])
+ (function (_ extension_name generate archive [class field unboxed objectS])
(do phase.monad
[objectI (generate archive objectS)
#let [$class (type.class class (list))
@@ -663,7 +663,7 @@
Handler
(..custom
[($_ <>.and <s>.text <s>.text <s>.text <s>.any <s>.any)
- (function (_ extension-name generate archive [class field unboxed valueS objectS])
+ (function (_ extension_name generate archive [class field unboxed valueS objectS])
(do phase.monad
[valueI (generate archive valueS)
objectI (generate archive objectS)
@@ -688,7 +688,7 @@
(Parser Input)
(<s>.tuple (<>.and ..value <s>.any)))
-(def: (generate-input generate archive [valueT valueS])
+(def: (generate_input generate archive [valueT valueS])
(-> Phase Archive Input
(Operation (Typed Inst)))
(do phase.monad
@@ -703,7 +703,7 @@
(def: voidI (_.string synthesis.unit))
-(def: (prepare-output outputT)
+(def: (prepare_output outputT)
(-> (Type Return) Inst)
(case (type.void? outputT)
(#.Right outputT)
@@ -716,22 +716,22 @@
Handler
(..custom
[($_ <>.and ..class <s>.text ..return (<>.some ..input))
- (function (_ extension-name generate archive [class method outputT inputsTS])
+ (function (_ extension_name generate archive [class method outputT inputsTS])
(do {@ phase.monad}
- [inputsTI (monad.map @ (generate-input generate archive) inputsTS)]
+ [inputsTI (monad.map @ (generate_input generate archive) inputsTS)]
(wrap (|>> (_.fuse (list@map product.right inputsTI))
(_.INVOKESTATIC class method (type.method [(list@map product.left inputsTI) outputT (list)]))
- (prepare-output outputT)))))]))
+ (prepare_output outputT)))))]))
(template [<name> <invoke>]
[(def: <name>
Handler
(..custom
[($_ <>.and ..class <s>.text ..return <s>.any (<>.some ..input))
- (function (_ extension-name generate archive [class method outputT objectS inputsTS])
+ (function (_ extension_name generate archive [class method outputT objectS inputsTS])
(do {@ phase.monad}
[objectI (generate archive objectS)
- inputsTI (monad.map @ (generate-input generate archive) inputsTS)]
+ inputsTI (monad.map @ (generate_input generate archive) inputsTS)]
(wrap (|>> objectI
(_.CHECKCAST class)
(_.fuse (list@map product.right inputsTI))
@@ -739,7 +739,7 @@
(type.method [(list@map product.left inputsTI)
outputT
(list)]))
- (prepare-output outputT)))))]))]
+ (prepare_output outputT)))))]))]
[invoke::virtual _.INVOKEVIRTUAL]
[invoke::special _.INVOKESPECIAL]
@@ -750,9 +750,9 @@
Handler
(..custom
[($_ <>.and ..class (<>.some ..input))
- (function (_ extension-name generate archive [class inputsTS])
+ (function (_ extension_name generate archive [class inputsTS])
(do {@ phase.monad}
- [inputsTI (monad.map @ (generate-input generate archive) inputsTS)]
+ [inputsTI (monad.map @ (generate_input generate archive) inputsTS)]
(wrap (|>> (_.NEW class)
_.DUP
(_.fuse (list@map product.right inputsTI))
@@ -779,28 +779,28 @@
(bundle.install "constructor" invoke::constructor))))
)))
-(def: annotation-parameter
- (Parser (/.Annotation-Parameter Synthesis))
+(def: annotation_parameter
+ (Parser (/.Annotation_Parameter Synthesis))
(<s>.tuple (<>.and <s>.text <s>.any)))
(def: annotation
(Parser (/.Annotation Synthesis))
- (<s>.tuple (<>.and <s>.text (<>.some ..annotation-parameter))))
+ (<s>.tuple (<>.and <s>.text (<>.some ..annotation_parameter))))
(def: argument
(Parser Argument)
(<s>.tuple (<>.and <s>.text ..value)))
-(def: overriden-method-definition
- (Parser [(Environment Synthesis) (/.Overriden-Method Synthesis)])
+(def: overriden_method_definition
+ (Parser [(Environment Synthesis) (/.Overriden_Method Synthesis)])
(<s>.tuple (do <>.monad
- [_ (<s>.text! /.overriden-tag)
+ [_ (<s>.text! /.overriden_tag)
ownerT ..class
name <s>.text
- strict-fp? <s>.bit
+ strict_fp? <s>.bit
annotations (<s>.tuple (<>.some ..annotation))
vars (<s>.tuple (<>.some ..var))
- self-name <s>.text
+ self_name <s>.text
arguments (<s>.tuple (<>.some ..argument))
returnT ..return
exceptionsT (<s>.tuple (<>.some ..class))
@@ -809,11 +809,11 @@
(<s>.tuple <s>.any)))]
(wrap [environment
[ownerT name
- strict-fp? annotations vars
- self-name arguments returnT exceptionsT
+ strict_fp? annotations vars
+ self_name arguments returnT exceptionsT
body]]))))
-(def: (normalize-path normalize)
+(def: (normalize_path normalize)
(-> (-> Synthesis Synthesis)
(-> Path Path))
(function (recur path)
@@ -834,21 +834,21 @@
[#synthesis.Bind]
[#synthesis.Access])
- (#synthesis.Bit-Fork when then else)
- (#synthesis.Bit-Fork when (recur then) (maybe@map recur else))
+ (#synthesis.Bit_Fork when then else)
+ (#synthesis.Bit_Fork when (recur then) (maybe@map recur else))
(^template [<tag>]
[(<tag> [[test then] elses])
(<tag> [[test (recur then)]
- (list@map (function (_ [else-test else-then])
- [else-test (recur else-then)])
+ (list@map (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)
+(def: (normalize_method_body mapping)
(-> (Dictionary Synthesis Variable) Synthesis Synthesis)
(function (recur body)
(case body
@@ -871,7 +871,7 @@
synthesis.variable)
(^ (synthesis.branch/case [inputS pathS]))
- (synthesis.branch/case [(recur inputS) (normalize-path recur pathS)])
+ (synthesis.branch/case [(recur inputS) (normalize_path recur pathS)])
(^ (synthesis.branch/let [inputS register outputS]))
(synthesis.branch/let [(recur inputS) register (recur outputS)])
@@ -911,37 +911,37 @@
(def: $Object (type.class "java.lang.Object" (list)))
-(def: (anonymous-init-method env)
+(def: (anonymous_init_method env)
(-> (Environment Synthesis) (Type Method))
(type.method [(list.repeat (list.size env) $Object)
type.void
(list)]))
-(def: (with-anonymous-init class env super-class inputsTI)
+(def: (with_anonymous_init class env super_class inputsTI)
(-> (Type Class) (Environment Synthesis) (Type Class) (List (Typed Inst)) Def)
- (let [store-capturedI (|> env
+ (let [store_capturedI (|> env
list.size
list.indices
(list@map (.function (_ register)
(|>> (_.ALOAD 0)
(_.ALOAD (inc register))
- (_.PUTFIELD class (///reference.foreign-name register) $Object))))
+ (_.PUTFIELD class (///reference.foreign_name register) $Object))))
_.fuse)]
- (_def.method #$.Public $.noneM "<init>" (anonymous-init-method env)
+ (_def.method #$.Public $.noneM "<init>" (anonymous_init_method env)
(|>> (_.ALOAD 0)
((_.fuse (list@map product.right inputsTI)))
- (_.INVOKESPECIAL super-class "<init>" (type.method [(list@map product.left inputsTI) type.void (list)]))
- store-capturedI
+ (_.INVOKESPECIAL super_class "<init>" (type.method [(list@map product.left inputsTI) type.void (list)]))
+ store_capturedI
_.RETURN))))
-(def: (anonymous-instance generate archive class env)
+(def: (anonymous_instance generate archive class env)
(-> Phase Archive (Type Class) (Environment Synthesis) (Operation Inst))
(do {@ phase.monad}
[captureI+ (monad.map @ (generate archive) env)]
(wrap (|>> (_.NEW class)
_.DUP
(_.fuse captureI+)
- (_.INVOKESPECIAL class "<init>" (anonymous-init-method env))))))
+ (_.INVOKESPECIAL class "<init>" (anonymous_init_method env))))))
(def: (returnI returnT)
(-> (Type Return) Inst)
@@ -979,58 +979,58 @@
..class
(<s>.tuple (<>.some ..class))
(<s>.tuple (<>.some ..input))
- (<s>.tuple (<>.some ..overriden-method-definition)))
- (function (_ extension-name generate archive [super-class super-interfaces
+ (<s>.tuple (<>.some ..overriden_method_definition)))
+ (function (_ extension_name generate archive [super_class super_interfaces
inputsTS
- overriden-methods])
+ overriden_methods])
(do {@ phase.monad}
- [[context _] (generation.with-new-context archive (wrap []))
- #let [[module-id artifact-id] context
- anonymous-class-name (///.class-name context)
- class (type.class anonymous-class-name (list))
- total-environment (|> overriden-methods
+ [[context _] (generation.with_new_context archive (wrap []))
+ #let [[module_id artifact_id] context
+ anonymous_class_name (///.class_name context)
+ class (type.class anonymous_class_name (list))
+ total_environment (|> overriden_methods
## Get all the environments.
(list@map product.left)
## Combine them.
list@join
## Remove duplicates.
- (set.from-list synthesis.hash)
- set.to-list)
- global-mapping (|> total-environment
+ (set.from_list synthesis.hash)
+ set.to_list)
+ global_mapping (|> total_environment
## Give them names as "foreign" variables.
list.enumeration
(list@map (function (_ [id capture])
[capture (#variable.Foreign id)]))
- (dictionary.from-list synthesis.hash))
- normalized-methods (list@map (function (_ [environment
+ (dictionary.from_list synthesis.hash))
+ normalized_methods (list@map (function (_ [environment
[ownerT name
- strict-fp? annotations vars
- self-name arguments returnT exceptionsT
+ strict_fp? annotations vars
+ self_name arguments returnT exceptionsT
body]])
- (let [local-mapping (|> environment
+ (let [local_mapping (|> environment
list.enumeration
- (list@map (function (_ [foreign-id capture])
- [(synthesis.variable/foreign foreign-id)
- (|> global-mapping
+ (list@map (function (_ [foreign_id capture])
+ [(synthesis.variable/foreign foreign_id)
+ (|> global_mapping
(dictionary.get capture)
maybe.assume)]))
- (dictionary.from-list synthesis.hash))]
+ (dictionary.from_list synthesis.hash))]
[ownerT name
- strict-fp? annotations vars
- self-name arguments returnT exceptionsT
- (normalize-method-body local-mapping body)]))
- overriden-methods)]
- inputsTI (monad.map @ (generate-input generate archive) inputsTS)
- method-definitions (|> normalized-methods
+ strict_fp? annotations vars
+ self_name arguments returnT exceptionsT
+ (normalize_method_body local_mapping body)]))
+ overriden_methods)]
+ inputsTI (monad.map @ (generate_input generate archive) inputsTS)
+ method_definitions (|> normalized_methods
(monad.map @ (function (_ [ownerT name
- strict-fp? annotations vars
- self-name arguments returnT exceptionsT
+ strict_fp? annotations vars
+ self_name arguments returnT exceptionsT
bodyS])
(do @
- [bodyG (generation.with-context artifact-id
+ [bodyG (generation.with_context artifact_id
(generate archive bodyS))]
(wrap (_def.method #$.Public
- (if strict-fp?
+ (if strict_fp?
($_ $.++M $.finalM $.strictM)
$.finalM)
name
@@ -1039,16 +1039,16 @@
exceptionsT])
(|>> bodyG (returnI returnT)))))))
(\ @ map _def.fuse))
- #let [directive [anonymous-class-name
+ #let [directive [anonymous_class_name
(_def.class #$.V1_6 #$.Public $.finalC
- anonymous-class-name (list)
- super-class super-interfaces
- (|>> (///function.with-environment total-environment)
- (..with-anonymous-init class total-environment super-class inputsTI)
- method-definitions))]]
+ anonymous_class_name (list)
+ super_class super_interfaces
+ (|>> (///function.with_environment total_environment)
+ (..with_anonymous_init class total_environment super_class inputsTI)
+ method_definitions))]]
_ (generation.execute! directive)
- _ (generation.save! (%.nat artifact-id) directive)]
- (..anonymous-instance generate archive class total-environment)))]))
+ _ (generation.save! (%.nat artifact_id) directive)]
+ (..anonymous_instance generate archive class total_environment)))]))
(def: bundle::class
Bundle
@@ -1067,7 +1067,7 @@
(dictionary.merge ..double)
(dictionary.merge ..char)
(dictionary.merge ..array)
- (dictionary.merge ..object-bundle)
+ (dictionary.merge ..object_bundle)
(dictionary.merge ..member)
(dictionary.merge ..bundle::class)
)))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/function.lux b/lux-jvm/source/luxc/lang/translation/jvm/function.lux
index 97b32f8c2..0fe7717fb 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/function.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/function.lux
@@ -42,35 +42,35 @@
["#." runtime]
["." reference]])
-(def: arity-field Text "arity")
+(def: arity_field Text "arity")
-(def: (poly-arg? arity)
+(def: poly_arg?
(-> Arity Bit)
- (n.> 1 arity))
+ (n.> 1))
-(def: (captured-args env)
+(def: (captured_args env)
(-> (Environment Synthesis) (List (Type Value)))
(list.repeat (list.size env) //.$Value))
-(def: (init-method env arity)
+(def: (init_method env arity)
(-> (Environment Synthesis) Arity (Type Method))
- (if (poly-arg? arity)
- (type.method [(list.concat (list (captured-args env)
+ (if (poly_arg? arity)
+ (type.method [(list.concat (list (captured_args env)
(list type.int)
(list.repeat (dec arity) //.$Value)))
type.void
(list)])
- (type.method [(captured-args env) type.void (list)])))
+ (type.method [(captured_args env) type.void (list)])))
-(def: (implementation-method arity)
+(def: (implementation_method arity)
(type.method [(list.repeat arity //.$Value) //.$Value (list)]))
-(def: get-amount-of-partialsI
+(def: get_amount_of_partialsI
Inst
(|>> (_.ALOAD 0)
- (_.GETFIELD //.$Function //runtime.partials-field type.int)))
+ (_.GETFIELD //.$Function //runtime.partials_field type.int)))
-(def: (load-fieldI class field)
+(def: (load_fieldI class field)
(-> (Type Class) Text Inst)
(|>> (_.ALOAD 0)
(_.GETFIELD class field //.$Value)))
@@ -83,16 +83,16 @@
(def: (applysI start amount)
(-> Register Nat Inst)
- (let [max-args (n.min amount //runtime.num-apply-variants)
- later-applysI (if (n.> //runtime.num-apply-variants amount)
- (applysI (n.+ //runtime.num-apply-variants start) (n.- //runtime.num-apply-variants amount))
+ (let [max_args (n.min amount //runtime.num_apply_variants)
+ later_applysI (if (n.> //runtime.num_apply_variants amount)
+ (applysI (n.+ //runtime.num_apply_variants start) (n.- //runtime.num_apply_variants amount))
function.identity)]
(|>> (_.CHECKCAST //.$Function)
- (inputsI start max-args)
- (_.INVOKEVIRTUAL //.$Function //runtime.apply-method (//runtime.apply-signature max-args))
- later-applysI)))
+ (inputsI start max_args)
+ (_.INVOKEVIRTUAL //.$Function //runtime.apply_method (//runtime.apply_signature max_args))
+ later_applysI)))
-(def: (inc-intI by)
+(def: (inc_intI by)
(-> Nat Inst)
(|>> (_.int (.int by))
_.IADD))
@@ -107,7 +107,7 @@
(-> Phase Archive (Type Class) Arity (Environment Synthesis) (Operation Inst))
(do {@ phase.monad}
[captureI+ (monad.map @ (generate archive) env)
- #let [argsI (if (poly-arg? arity)
+ #let [argsI (if (poly_arg? arity)
(|> (nullsI (dec arity))
(list (_.int +0))
_.fuse)
@@ -116,23 +116,23 @@
_.DUP
(_.fuse captureI+)
argsI
- (_.INVOKESPECIAL class "<init>" (init-method env arity))))))
+ (_.INVOKESPECIAL class "<init>" (init_method env arity))))))
-(def: (reset-method return)
+(def: (reset_method return)
(-> (Type Class) (Type Method))
(type.method [(list) return (list)]))
-(def: (with-reset class arity env)
+(def: (with_reset class arity env)
(-> (Type Class) Arity (Environment Synthesis) Def)
- (def.method #$.Public $.noneM "reset" (reset-method class)
- (if (poly-arg? arity)
- (let [env-size (list.size env)
- captureI (|> (case env-size
+ (def.method #$.Public $.noneM "reset" (reset_method class)
+ (if (poly_arg? arity)
+ (let [env_size (list.size env)
+ captureI (|> (case env_size
0 (list)
- _ (enum.range n.enum 0 (dec env-size)))
+ _ (enum.range n.enum 0 (dec env_size)))
(list@map (.function (_ source)
(|>> (_.ALOAD 0)
- (_.GETFIELD class (reference.foreign-name source) //.$Value))))
+ (_.GETFIELD class (reference.foreign_name source) //.$Value))))
_.fuse)
argsI (|> (nullsI (dec arity))
(list (_.int +0))
@@ -141,159 +141,159 @@
_.DUP
captureI
argsI
- (_.INVOKESPECIAL class "<init>" (init-method env arity))
+ (_.INVOKESPECIAL class "<init>" (init_method env arity))
_.ARETURN))
(|>> (_.ALOAD 0)
_.ARETURN))))
-(def: (with-implementation arity @begin bodyI)
+(def: (with_implementation arity @begin bodyI)
(-> Nat Label Inst Def)
- (def.method #$.Public $.strictM "impl" (implementation-method arity)
+ (def.method #$.Public $.strictM "impl" (implementation_method arity)
(|>> (_.label @begin)
bodyI
_.ARETURN)))
-(def: function-init-method
+(def: function_init_method
(type.method [(list type.int) type.void (list)]))
-(def: (function-init arity env-size)
+(def: (function_init arity env_size)
(-> Arity Nat Inst)
(if (n.= 1 arity)
(|>> (_.int +0)
- (_.INVOKESPECIAL //.$Function "<init>" function-init-method))
- (|>> (_.ILOAD (inc env-size))
- (_.INVOKESPECIAL //.$Function "<init>" function-init-method))))
+ (_.INVOKESPECIAL //.$Function "<init>" function_init_method))
+ (|>> (_.ILOAD (inc env_size))
+ (_.INVOKESPECIAL //.$Function "<init>" function_init_method))))
-(def: (with-init class env arity)
+(def: (with_init class env arity)
(-> (Type Class) (Environment Synthesis) Arity Def)
- (let [env-size (list.size env)
- offset-partial (: (-> Nat Nat)
- (|>> inc (n.+ env-size)))
- store-capturedI (|> (case env-size
+ (let [env_size (list.size env)
+ offset_partial (: (-> Nat Nat)
+ (|>> inc (n.+ env_size)))
+ store_capturedI (|> (case env_size
0 (list)
- _ (enum.range n.enum 0 (dec env-size)))
+ _ (enum.range n.enum 0 (dec env_size)))
(list@map (.function (_ register)
(|>> (_.ALOAD 0)
(_.ALOAD (inc register))
- (_.PUTFIELD class (reference.foreign-name register) //.$Value))))
+ (_.PUTFIELD class (reference.foreign_name register) //.$Value))))
_.fuse)
- store-partialI (if (poly-arg? arity)
+ store_partialI (if (poly_arg? arity)
(|> (enum.range n.enum 0 (n.- 2 arity))
(list@map (.function (_ idx)
- (let [register (offset-partial idx)]
+ (let [register (offset_partial idx)]
(|>> (_.ALOAD 0)
(_.ALOAD (inc register))
- (_.PUTFIELD class (reference.partial-name idx) //.$Value)))))
+ (_.PUTFIELD class (reference.partial_name idx) //.$Value)))))
_.fuse)
function.identity)]
- (def.method #$.Public $.noneM "<init>" (init-method env arity)
+ (def.method #$.Public $.noneM "<init>" (init_method env arity)
(|>> (_.ALOAD 0)
- (function-init arity env-size)
- store-capturedI
- store-partialI
+ (function_init arity env_size)
+ store_capturedI
+ store_partialI
_.RETURN))))
-(def: (with-apply class env function-arity @begin bodyI apply-arity)
+(def: (with_apply class env function_arity @begin bodyI apply_arity)
(-> (Type Class) (Environment Synthesis) Arity Label Inst Arity
Def)
- (let [num-partials (dec function-arity)
- @default ($.new-label [])
- @labels (list@map $.new-label (list.repeat num-partials []))
- over-extent (|> (.int function-arity) (i.- (.int apply-arity)))
+ (let [num_partials (dec function_arity)
+ @default ($.new_label [])
+ @labels (list@map $.new_label (list.repeat num_partials []))
+ over_extent (|> (.int function_arity) (i.- (.int apply_arity)))
casesI (|> (list@compose @labels (list @default))
- (list.zip/2 (enum.range n.enum 0 num-partials))
+ (list.zip/2 (enum.range n.enum 0 num_partials))
(list@map (.function (_ [stage @label])
- (let [load-partialsI (if (n.> 0 stage)
+ (let [load_partialsI (if (n.> 0 stage)
(|> (enum.range n.enum 0 (dec stage))
- (list@map (|>> reference.partial-name (load-fieldI class)))
+ (list@map (|>> reference.partial_name (load_fieldI class)))
_.fuse)
function.identity)]
- (cond (i.= over-extent (.int stage))
+ (cond (i.= over_extent (.int stage))
(|>> (_.label @label)
(_.ALOAD 0)
(when> [(new> (n.> 0 stage) [])]
- [(_.INVOKEVIRTUAL class "reset" (reset-method class))])
- load-partialsI
- (inputsI 1 apply-arity)
- (_.INVOKEVIRTUAL class "impl" (implementation-method function-arity))
+ [(_.INVOKEVIRTUAL class "reset" (reset_method class))])
+ load_partialsI
+ (inputsI 1 apply_arity)
+ (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity))
_.ARETURN)
- (i.> over-extent (.int stage))
- (let [args-to-completion (|> function-arity (n.- stage))
- args-left (|> apply-arity (n.- args-to-completion))]
+ (i.> over_extent (.int stage))
+ (let [args_to_completion (|> function_arity (n.- stage))
+ args_left (|> apply_arity (n.- args_to_completion))]
(|>> (_.label @label)
(_.ALOAD 0)
- (_.INVOKEVIRTUAL class "reset" (reset-method class))
- load-partialsI
- (inputsI 1 args-to-completion)
- (_.INVOKEVIRTUAL class "impl" (implementation-method function-arity))
- (applysI (inc args-to-completion) args-left)
+ (_.INVOKEVIRTUAL class "reset" (reset_method class))
+ load_partialsI
+ (inputsI 1 args_to_completion)
+ (_.INVOKEVIRTUAL class "impl" (implementation_method function_arity))
+ (applysI (inc args_to_completion) args_left)
_.ARETURN))
- ## (i.< over-extent (.int stage))
- (let [env-size (list.size env)
- load-capturedI (|> (case env-size
+ ## (i.< over_extent (.int stage))
+ (let [env_size (list.size env)
+ load_capturedI (|> (case env_size
0 (list)
- _ (enum.range n.enum 0 (dec env-size)))
- (list@map (|>> reference.foreign-name (load-fieldI class)))
+ _ (enum.range n.enum 0 (dec env_size)))
+ (list@map (|>> reference.foreign_name (load_fieldI class)))
_.fuse)]
(|>> (_.label @label)
(_.NEW class)
_.DUP
- load-capturedI
- get-amount-of-partialsI
- (inc-intI apply-arity)
- load-partialsI
- (inputsI 1 apply-arity)
- (nullsI (|> num-partials (n.- apply-arity) (n.- stage)))
- (_.INVOKESPECIAL class "<init>" (init-method env function-arity))
+ load_capturedI
+ get_amount_of_partialsI
+ (inc_intI apply_arity)
+ load_partialsI
+ (inputsI 1 apply_arity)
+ (nullsI (|> num_partials (n.- apply_arity) (n.- stage)))
+ (_.INVOKESPECIAL class "<init>" (init_method env function_arity))
_.ARETURN))
))))
_.fuse)]
- (def.method #$.Public $.noneM //runtime.apply-method (//runtime.apply-signature apply-arity)
- (|>> get-amount-of-partialsI
- (_.TABLESWITCH +0 (|> num-partials dec .int)
+ (def.method #$.Public $.noneM //runtime.apply_method (//runtime.apply_signature apply_arity)
+ (|>> get_amount_of_partialsI
+ (_.TABLESWITCH +0 (|> num_partials dec .int)
@default @labels)
casesI
))))
-(def: #export with-environment
+(def: #export with_environment
(-> (Environment Synthesis) Def)
(|>> list.enumeration
- (list@map (.function (_ [env-idx env-source])
- (def.field #$.Private $.finalF (reference.foreign-name env-idx) //.$Value)))
+ (list@map (.function (_ [env_idx env_source])
+ (def.field #$.Private $.finalF (reference.foreign_name env_idx) //.$Value)))
def.fuse))
-(def: (with-partial arity)
+(def: (with_partial arity)
(-> Arity Def)
- (if (poly-arg? arity)
+ (if (poly_arg? arity)
(|> (enum.range n.enum 0 (n.- 2 arity))
(list@map (.function (_ idx)
- (def.field #$.Private $.finalF (reference.partial-name idx) //.$Value)))
+ (def.field #$.Private $.finalF (reference.partial_name idx) //.$Value)))
def.fuse)
function.identity))
-(def: #export (with-function generate archive @begin class env arity bodyI)
+(def: #export (with_function generate archive @begin class env arity bodyI)
(-> Phase Archive Label Text (Environment Synthesis) Arity Inst
(Operation [Def Inst]))
(let [classD (type.class class (list))
applyD (: Def
- (if (poly-arg? arity)
- (|> (n.min arity //runtime.num-apply-variants)
+ (if (poly_arg? arity)
+ (|> (n.min arity //runtime.num_apply_variants)
(enum.range n.enum 1)
- (list@map (with-apply classD env arity @begin bodyI))
- (list& (with-implementation arity @begin bodyI))
+ (list@map (with_apply classD env arity @begin bodyI))
+ (list& (with_implementation arity @begin bodyI))
def.fuse)
- (def.method #$.Public $.strictM //runtime.apply-method (//runtime.apply-signature 1)
+ (def.method #$.Public $.strictM //runtime.apply_method (//runtime.apply_signature 1)
(|>> (_.label @begin)
bodyI
_.ARETURN))))
functionD (: Def
- (|>> (def.int-field #$.Public ($_ $.++F $.staticF $.finalF) arity-field (.int arity))
- (with-environment env)
- (with-partial arity)
- (with-init classD env arity)
- (with-reset classD arity env)
+ (|>> (def.int_field #$.Public ($_ $.++F $.staticF $.finalF) arity_field (.int arity))
+ (with_environment env)
+ (with_partial arity)
+ (with_init classD env arity)
+ (with_reset classD arity env)
applyD
))]
(do phase.monad
@@ -303,19 +303,19 @@
(def: #export (function generate archive [env arity bodyS])
(Generator Abstraction)
(do phase.monad
- [@begin _.make-label
- [function-context bodyI] (generation.with-new-context archive
- (generation.with-anchor [@begin 1]
+ [@begin _.make_label
+ [function_context bodyI] (generation.with_new_context archive
+ (generation.with_anchor [@begin 1]
(generate archive bodyS)))
- #let [function-class (//.class-name function-context)]
- [functionD instanceI] (..with-function generate archive @begin function-class env arity bodyI)
- #let [directive [function-class
+ #let [function_class (//.class_name function_context)]
+ [functionD instanceI] (..with_function generate archive @begin function_class env arity bodyI)
+ #let [directive [function_class
(def.class #$.V1_6 #$.Public $.finalC
- function-class (list)
+ function_class (list)
//.$Function (list)
functionD)]]
_ (generation.execute! directive)
- _ (generation.save! (%.nat (product.right function-context)) directive)]
+ _ (generation.save! (%.nat (product.right function_context)) directive)]
(wrap instanceI)))
(def: #export (call generate archive [functionS argsS])
@@ -324,11 +324,11 @@
[functionI (generate archive functionS)
argsI (monad.map @ (generate archive) argsS)
#let [applyI (|> argsI
- (list.chunk //runtime.num-apply-variants)
+ (list.chunk //runtime.num_apply_variants)
(list@map (.function (_ chunkI+)
(|>> (_.CHECKCAST //.$Function)
(_.fuse chunkI+)
- (_.INVOKEVIRTUAL //.$Function //runtime.apply-method (//runtime.apply-signature (list.size chunkI+))))))
+ (_.INVOKEVIRTUAL //.$Function //runtime.apply_method (//runtime.apply_signature (list.size chunkI+))))))
_.fuse)]]
(wrap (|>> functionI
applyI))))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
index 1d22b0e63..4b44561c7 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/loop.lux
@@ -69,9 +69,9 @@
(def: #export (scope translate archive [start initsS+ iterationS])
(Generator [Nat (List Synthesis) Synthesis])
(do {@ phase.monad}
- [@begin _.make-label
+ [@begin _.make_label
initsI+ (monad.map @ (translate archive) initsS+)
- iterationI (generation.with-anchor [@begin start]
+ iterationI (generation.with_anchor [@begin start]
(translate archive iterationS))
#let [initializationI (|> (list.enumeration initsI+)
(list@map (function (_ [register initI])
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/program.lux b/lux-jvm/source/luxc/lang/translation/jvm/program.lux
index 2c4f1d3f2..234c20fa9 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/program.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/program.lux
@@ -24,10 +24,10 @@
(def: ^Object ($t.class "java.lang.Object" (list)))
-(def: #export (program artifact-name context programI)
+(def: #export (program artifact_name context programI)
(-> (-> Context Text) (Program _.Inst _.Definition))
(let [nilI runtime.noneI
- num-inputsI (|>> ($i.ALOAD 0) $i.ARRAYLENGTH)
+ num_inputsI (|>> ($i.ALOAD 0) $i.ARRAYLENGTH)
decI (|>> ($i.int +1) $i.ISUB)
headI (|>> $i.DUP
($i.ALOAD 0)
@@ -53,10 +53,10 @@
$i.DUP2_X1
$i.POP2
runtime.variantI)
- prepare-input-listI (<| $i.with-label (function (_ @loop))
- $i.with-label (function (_ @end))
+ prepare_input_listI (<| $i.with_label (function (_ @loop))
+ $i.with_label (function (_ @end))
(|>> nilI
- num-inputsI
+ num_inputsI
($i.label @loop)
decI
$i.DUP
@@ -68,23 +68,23 @@
($i.GOTO @loop)
($i.label @end)
$i.POP))
- feed-inputsI ($i.INVOKEVIRTUAL jvm.$Function runtime.apply-method (runtime.apply-signature 1))
- run-ioI (|>> ($i.CHECKCAST jvm.$Function)
+ feed_inputsI ($i.INVOKEVIRTUAL jvm.$Function runtime.apply_method (runtime.apply_signature 1))
+ run_ioI (|>> ($i.CHECKCAST jvm.$Function)
$i.NULL
- ($i.INVOKEVIRTUAL jvm.$Function runtime.apply-method (runtime.apply-signature 1)))
- main-type ($t.method [(list ($t.array ($t.class "java.lang.String" (list))))
+ ($i.INVOKEVIRTUAL jvm.$Function runtime.apply_method (runtime.apply_signature 1)))
+ main_type ($t.method [(list ($t.array ($t.class "java.lang.String" (list))))
$t.void
(list)])
- class (artifact-name context)]
+ class (artifact_name context)]
[class
($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
- run-ioI
+ prepare_input_listI
+ feed_inputsI
+ run_ioI
$i.RETURN))))]))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
index c7570d01a..d2a524a82 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/reference.lux
@@ -31,18 +31,18 @@
(-> Nat Text)
(|>> %.nat (format <prefix>)))]
- [foreign-name "f"]
- [partial-name "p"]
+ [foreign_name "f"]
+ [partial_name "p"]
)
(def: (foreign archive variable)
(-> Archive Register (Operation Inst))
(do {@ phase.monad}
- [class-name (\ @ map //.class-name
+ [class_name (\ @ map //.class_name
(generation.context archive))]
(wrap (|>> (_.ALOAD 0)
- (_.GETFIELD (type.class class-name (list))
- (|> variable .nat foreign-name)
+ (_.GETFIELD (type.class class_name (list))
+ (|> variable .nat foreign_name)
//.$Value)))))
(def: local
@@ -61,6 +61,6 @@
(def: #export (constant archive name)
(-> Archive Name (Operation Inst))
(do {@ phase.monad}
- [class-name (\ @ map //.class-name
+ [class_name (\ @ map //.class_name
(generation.remember archive name))]
- (wrap (_.GETSTATIC (type.class class-name (list)) //.value-field //.$Value))))
+ (wrap (_.GETSTATIC (type.class class_name (list)) //.value_field //.$Value))))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
index e7a37584e..061972df1 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/runtime.lux
@@ -46,10 +46,10 @@
(def: #export $Stack (type.array $Value))
(def: $Throwable (type.class "java.lang.Throwable" (list)))
-(def: nullary-init-methodT
+(def: nullary_init_methodT
(type.method [(list) type.void (list)]))
-(def: throw-methodT
+(def: throw_methodT
(type.method [(list) type.void (list)]))
(def: #export logI
@@ -61,12 +61,12 @@
(|>> outI (_.string "LOG: ") (printI "print")
outI _.SWAP (printI "println"))))
-(def: variant-method
+(def: variant_method
(type.method [(list $Tag $Flag $Value) //.$Variant (list)]))
(def: #export variantI
Inst
- (_.INVOKESTATIC //.$Runtime "variant_make" variant-method))
+ (_.INVOKESTATIC //.$Runtime "variant_make" variant_method))
(def: #export leftI
Inst
@@ -95,9 +95,9 @@
(def: (tryI unsafeI)
(-> Inst Inst)
- (<| _.with-label (function (_ @from))
- _.with-label (function (_ @to))
- _.with-label (function (_ @handler))
+ (<| _.with_label (function (_ @from))
+ _.with_label (function (_ @to))
+ _.with_label (function (_ @handler))
(|>> (_.try @from @to @handler (type.class "java.lang.Exception" (list)))
(_.label @from)
unsafeI
@@ -108,29 +108,29 @@
noneI
_.ARETURN)))
-(def: #export partials-field Text "partials")
-(def: #export apply-method Text "apply")
-(def: #export num-apply-variants Nat 8)
+(def: #export partials_field Text "partials")
+(def: #export apply_method Text "apply")
+(def: #export num_apply_variants Nat 8)
-(def: #export (apply-signature arity)
+(def: #export (apply_signature arity)
(-> Arity (Type Method))
(type.method [(list.repeat arity $Value) $Value (list)]))
-(def: adt-methods
+(def: adt_methods
Def
- (let [store-tagI (|>> _.DUP _.ICONST_0 (_.ILOAD 0) (_.wrap type.int) _.AASTORE)
- store-flagI (|>> _.DUP _.ICONST_1 (_.ALOAD 1) _.AASTORE)
- store-valueI (|>> _.DUP _.ICONST_2 (_.ALOAD 2) _.AASTORE)]
+ (let [store_tagI (|>> _.DUP _.ICONST_0 (_.ILOAD 0) (_.wrap type.int) _.AASTORE)
+ store_flagI (|>> _.DUP _.ICONST_1 (_.ALOAD 1) _.AASTORE)
+ store_valueI (|>> _.DUP _.ICONST_2 (_.ALOAD 2) _.AASTORE)]
(|>> ($d.method #$.Public $.staticM "variant_make"
(type.method [(list $Tag $Flag $Value) //.$Variant (list)])
(|>> _.ICONST_3
(_.ANEWARRAY $Value)
- store-tagI
- store-flagI
- store-valueI
+ store_tagI
+ store_flagI
+ store_valueI
_.ARETURN)))))
-(def: frac-methods
+(def: frac_methods
Def
(|>> ($d.method #$.Public $.staticM "decode_frac" (type.method [(list $Text) //.$Variant (list)])
(tryI
@@ -139,7 +139,7 @@
(_.wrap type.double))))
))
-(def: (illegal-state-exception message)
+(def: (illegal_state_exception message)
(-> Text Inst)
(let [IllegalStateException (type.class "java.lang.IllegalStateException" (list))]
(|>> (_.NEW IllegalStateException)
@@ -147,32 +147,32 @@
(_.string message)
(_.INVOKESPECIAL IllegalStateException "<init>" (type.method [(list $Text) type.void (list)])))))
-(def: pm-methods
+(def: pm_methods
Def
- (let [tuple-sizeI (|>> (_.ALOAD 0)
+ (let [tuple_sizeI (|>> (_.ALOAD 0)
_.ARRAYLENGTH)
- last-rightI (|>> tuple-sizeI
+ last_rightI (|>> tuple_sizeI
_.ICONST_1
_.ISUB)
leftsI (_.ILOAD 1)
- left-indexI leftsI
- sub-leftsI (|>> leftsI
- last-rightI
+ left_indexI leftsI
+ sub_leftsI (|>> leftsI
+ last_rightI
_.ISUB)
- sub-tupleI (|>> (_.ALOAD 0)
- last-rightI
+ sub_tupleI (|>> (_.ALOAD 0)
+ last_rightI
_.AALOAD
(_.CHECKCAST //.$Tuple))
recurI (: (-> Label Inst)
(function (_ @loop)
- (|>> sub-leftsI (_.ISTORE 1)
- sub-tupleI (_.ASTORE 0)
+ (|>> sub_leftsI (_.ISTORE 1)
+ sub_tupleI (_.ASTORE 0)
(_.GOTO @loop))))]
- (|>> ($d.method #$.Public $.staticM "pm_fail" throw-methodT
- (|>> (illegal-state-exception "Invalid expression for pattern-matching.")
+ (|>> ($d.method #$.Public $.staticM "pm_fail" throw_methodT
+ (|>> (illegal_state_exception "Invalid expression for pattern-matching.")
_.ATHROW))
- ($d.method #$.Public $.staticM "apply_fail" throw-methodT
- (|>> (illegal-state-exception "Error while applying function.")
+ ($d.method #$.Public $.staticM "apply_fail" throw_methodT
+ (|>> (illegal_state_exception "Error while applying function.")
_.ATHROW))
($d.method #$.Public $.staticM "pm_push" (type.method [(list $Stack $Value) $Stack (list)])
(|>> _.ICONST_2
@@ -187,119 +187,119 @@
_.AASTORE
_.ARETURN))
($d.method #$.Public $.staticM "pm_variant" (type.method [(list //.$Variant $Tag $Flag) $Value (list)])
- (<| _.with-label (function (_ @loop))
- _.with-label (function (_ @perfect-match!))
- _.with-label (function (_ @tags-match!))
- _.with-label (function (_ @maybe-nested))
- _.with-label (function (_ @mismatch!))
+ (<| _.with_label (function (_ @loop))
+ _.with_label (function (_ @perfect_match!))
+ _.with_label (function (_ @tags_match!))
+ _.with_label (function (_ @maybe_nested))
+ _.with_label (function (_ @mismatch!))
(let [$variant (_.ALOAD 0)
$tag (_.ILOAD 1)
$last? (_.ALOAD 2)
- variant-partI (: (-> Nat Inst)
+ variant_partI (: (-> Nat Inst)
(function (_ idx)
(|>> (_.int (.int idx)) _.AALOAD)))
::tag (: Inst
- (|>> (variant-partI 0) (_.unwrap type.int)))
- ::last? (variant-partI 1)
- ::value (variant-partI 2)
+ (|>> (variant_partI 0) (_.unwrap type.int)))
+ ::last? (variant_partI 1)
+ ::value (variant_partI 2)
- super-nested-tag (|>> _.SWAP ## variant::tag, tag
+ super_nested_tag (|>> _.SWAP ## variant::tag, tag
_.ISUB)
- super-nested (|>> super-nested-tag ## super-tag
- $variant ::last? ## super-tag, super-last
- $variant ::value ## super-tag, super-last, super-value
+ super_nested (|>> super_nested_tag ## super_tag
+ $variant ::last? ## super_tag, super_last
+ $variant ::value ## super_tag, super_last, super_value
..variantI)
- update-$tag _.ISUB
- update-$variant (|>> $variant ::value
+ update_$tag _.ISUB
+ update_$variant (|>> $variant ::value
(_.CHECKCAST //.$Variant)
(_.ASTORE 0))
iterate! (: (-> Label Inst)
(function (_ @loop)
- (|>> update-$variant
- update-$tag
+ (|>> update_$variant
+ update_$tag
(_.GOTO @loop))))
- not-found _.NULL])
+ not_found _.NULL])
(|>> $tag ## tag
(_.label @loop)
$variant ::tag ## tag, variant::tag
- _.DUP2 (_.IF_ICMPEQ @tags-match!) ## tag, variant::tag
- _.DUP2 (_.IF_ICMPGT @maybe-nested) ## tag, variant::tag
+ _.DUP2 (_.IF_ICMPEQ @tags_match!) ## tag, variant::tag
+ _.DUP2 (_.IF_ICMPGT @maybe_nested) ## tag, variant::tag
$last? (_.IFNULL @mismatch!) ## tag, variant::tag
- super-nested ## super-variant
+ super_nested ## super_variant
_.ARETURN
- (_.label @tags-match!) ## tag, variant::tag
+ (_.label @tags_match!) ## tag, variant::tag
$last? ## tag, variant::tag, last?
$variant ::last? ## tag, variant::tag, last?, variant::last?
- (_.IF_ACMPEQ @perfect-match!) ## tag, variant::tag
- (_.label @maybe-nested) ## tag, variant::tag
+ (_.IF_ACMPEQ @perfect_match!) ## tag, variant::tag
+ (_.label @maybe_nested) ## tag, variant::tag
$variant ::last? ## tag, variant::tag, variant::last?
(_.IFNULL @mismatch!) ## tag, variant::tag
(iterate! @loop)
- (_.label @perfect-match!) ## tag, variant::tag
+ (_.label @perfect_match!) ## tag, variant::tag
## _.POP2
$variant ::value
_.ARETURN
(_.label @mismatch!) ## tag, variant::tag
## _.POP2
- not-found
+ not_found
_.ARETURN)))
($d.method #$.Public $.staticM "tuple_left" (type.method [(list //.$Tuple $Index) $Value (list)])
- (<| _.with-label (function (_ @loop))
- _.with-label (function (_ @recursive))
- (let [left-accessI (|>> (_.ALOAD 0) left-indexI _.AALOAD)])
+ (<| _.with_label (function (_ @loop))
+ _.with_label (function (_ @recursive))
+ (let [left_accessI (|>> (_.ALOAD 0) left_indexI _.AALOAD)])
(|>> (_.label @loop)
- leftsI last-rightI (_.IF_ICMPGE @recursive)
- left-accessI
+ leftsI last_rightI (_.IF_ICMPGE @recursive)
+ left_accessI
_.ARETURN
(_.label @recursive)
## Recursive
(recurI @loop))))
($d.method #$.Public $.staticM "tuple_right" (type.method [(list //.$Tuple $Index) $Value (list)])
- (<| _.with-label (function (_ @loop))
- _.with-label (function (_ @not-tail))
- _.with-label (function (_ @slice))
- (let [right-indexI (|>> leftsI
+ (<| _.with_label (function (_ @loop))
+ _.with_label (function (_ @not_tail))
+ _.with_label (function (_ @slice))
+ (let [right_indexI (|>> leftsI
_.ICONST_1
_.IADD)
- right-accessI (|>> (_.ALOAD 0)
+ right_accessI (|>> (_.ALOAD 0)
_.SWAP
_.AALOAD)
- sub-rightI (|>> (_.ALOAD 0)
- right-indexI
- tuple-sizeI
+ sub_rightI (|>> (_.ALOAD 0)
+ right_indexI
+ tuple_sizeI
(_.INVOKESTATIC (type.class "java.util.Arrays" (list)) "copyOfRange"
(type.method [(list //.$Tuple $Index $Index)
//.$Tuple
(list)])))])
(|>> (_.label @loop)
- last-rightI right-indexI
- _.DUP2 (_.IF_ICMPNE @not-tail)
+ last_rightI right_indexI
+ _.DUP2 (_.IF_ICMPNE @not_tail)
## _.POP
- right-accessI
+ right_accessI
_.ARETURN
- (_.label @not-tail)
+ (_.label @not_tail)
(_.IF_ICMPGT @slice)
## Must recurse
(recurI @loop)
(_.label @slice)
- sub-rightI
+ sub_rightI
_.ARETURN
)))
)))
(def: #export try (type.method [(list //.$Function) //.$Variant (list)]))
-(def: io-methods
+(def: io_methods
Def
(let [StringWriter (type.class "java.io.StringWriter" (list))
PrintWriter (type.class "java.io.PrintWriter" (list))
- string-writerI (|>> (_.NEW StringWriter)
+ string_writerI (|>> (_.NEW StringWriter)
_.DUP
- (_.INVOKESPECIAL StringWriter "<init>" nullary-init-methodT))
- print-writerI (|>> (_.NEW PrintWriter)
+ (_.INVOKESPECIAL StringWriter "<init>" nullary_init_methodT))
+ print_writerI (|>> (_.NEW PrintWriter)
_.SWAP
_.DUP2
_.POP
@@ -308,21 +308,21 @@
(_.INVOKESPECIAL PrintWriter "<init>" (type.method [(list (type.class "java.io.Writer" (list)) type.boolean) type.void (list)]))
)]
(|>> ($d.method #$.Public $.staticM "try" ..try
- (<| _.with-label (function (_ @from))
- _.with-label (function (_ @to))
- _.with-label (function (_ @handler))
+ (<| _.with_label (function (_ @from))
+ _.with_label (function (_ @to))
+ _.with_label (function (_ @handler))
(|>> (_.try @from @to @handler $Throwable)
(_.label @from)
(_.ALOAD 0)
_.NULL
- (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature 1))
+ (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature 1))
rightI
_.ARETURN
(_.label @to)
(_.label @handler)
- string-writerI ## TW
+ string_writerI ## TW
_.DUP2 ## TWTW
- print-writerI ## TWTP
+ print_writerI ## TWTP
(_.INVOKEVIRTUAL $Throwable "printStackTrace" (type.method [(list (type.class "java.io.PrintWriter" (list))) type.void (list)])) ## TW
(_.INVOKEVIRTUAL StringWriter "toString" (type.method [(list) $Text (list)])) ## TS
_.SWAP _.POP leftI
@@ -334,49 +334,49 @@
(-> (Type (<| Return' Value' category)) Text))
(|>> type.reflection reflection.reflection))
-(def: translate-runtime
+(def: translate_runtime
(Operation [Text Binary])
- (let [runtime-class (..reflection //.$Runtime)
- bytecode ($d.class #$.V1_6 #$.Public $.finalC runtime-class (list) (type.class "java.lang.Object" (list)) (list)
- (|>> adt-methods
- frac-methods
- pm-methods
- io-methods))
- directive [runtime-class bytecode]]
+ (let [runtime_class (..reflection //.$Runtime)
+ bytecode ($d.class #$.V1_6 #$.Public $.finalC runtime_class (list) (type.class "java.lang.Object" (list)) (list)
+ (|>> adt_methods
+ frac_methods
+ pm_methods
+ io_methods))
+ directive [runtime_class bytecode]]
(do phase.monad
[_ (generation.execute! directive)
_ (generation.save! "0" directive)]
(wrap ["0" bytecode]))))
-(def: translate-function
+(def: translate_function
(Operation [Text Binary])
- (let [applyI (|> (enum.range n.enum 2 num-apply-variants)
+ (let [applyI (|> (enum.range n.enum 2 num_apply_variants)
(list@map (function (_ arity)
- ($d.method #$.Public $.noneM apply-method (apply-signature arity)
+ ($d.method #$.Public $.noneM apply_method (apply_signature arity)
(let [preI (|> (enum.range n.enum 0 (dec arity))
(list@map _.ALOAD)
_.fuse)]
(|>> preI
- (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature (dec arity)))
+ (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature (dec arity)))
(_.CHECKCAST //.$Function)
(_.ALOAD arity)
- (_.INVOKEVIRTUAL //.$Function apply-method (apply-signature 1))
+ (_.INVOKEVIRTUAL //.$Function apply_method (apply_signature 1))
_.ARETURN)))))
- (list& ($d.abstract-method #$.Public $.noneM apply-method (apply-signature 1)))
+ (list& ($d.abstract_method #$.Public $.noneM apply_method (apply_signature 1)))
$d.fuse)
$Object (type.class "java.lang.Object" (list))
- function-class (..reflection //.$Function)
- bytecode ($d.abstract #$.V1_6 #$.Public $.noneC function-class (list) $Object (list)
- (|>> ($d.field #$.Public $.finalF partials-field type.int)
+ function_class (..reflection //.$Function)
+ bytecode ($d.abstract #$.V1_6 #$.Public $.noneC function_class (list) $Object (list)
+ (|>> ($d.field #$.Public $.finalF partials_field type.int)
($d.method #$.Public $.noneM "<init>" (type.method [(list type.int) type.void (list)])
(|>> (_.ALOAD 0)
- (_.INVOKESPECIAL $Object "<init>" nullary-init-methodT)
+ (_.INVOKESPECIAL $Object "<init>" nullary_init_methodT)
(_.ALOAD 0)
(_.ILOAD 1)
- (_.PUTFIELD //.$Function partials-field type.int)
+ (_.PUTFIELD //.$Function partials_field type.int)
_.RETURN))
applyI))
- directive [function-class bytecode]]
+ directive [function_class bytecode]]
(do phase.monad
[_ (generation.execute! directive)
_ (generation.save! "1" directive)]
@@ -385,12 +385,12 @@
(def: #export translate
(Operation [Registry Output])
(do phase.monad
- [runtime-payload ..translate-runtime
- function-payload ..translate-function]
+ [runtime_payload ..translate_runtime
+ function_payload ..translate_function]
(wrap [(|> artifact.empty
artifact.resource
product.right
artifact.resource
product.right)
- (row.row runtime-payload
- function-payload)])))
+ (row.row runtime_payload
+ function_payload)])))
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
index d91ed3d14..a93b4845f 100644
--- a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
+++ b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
@@ -35,7 +35,7 @@
["." //
["#." runtime]])
-(exception: #export (not-a-tuple {size Nat})
+(exception: #export (not_a_tuple {size Nat})
(exception.report
["Expected size" ">= 2"]
["Actual size" (%.nat size)]))
@@ -44,7 +44,7 @@
(Generator (List Synthesis))
(do {@ phase.monad}
[#let [size (list.size members)]
- _ (phase.assert not-a-tuple size
+ _ (phase.assert ..not_a_tuple size
(n.>= 2 size))
membersI (|> members
list.enumeration
diff --git a/lux-jvm/source/program.lux b/lux-jvm/source/program.lux
index c07ecd3e3..a7e2f395c 100644
--- a/lux-jvm/source/program.lux
+++ b/lux-jvm/source/program.lux
@@ -78,39 +78,39 @@
["#::."
(getClass [] (java/lang/Class java/lang/Object))])
-(def: _object-class
+(def: _object_class
(java/lang/Class java/lang/Object)
- (host.class-for java/lang/Object))
+ (host.class_for java/lang/Object))
-(def: _apply2-args
+(def: _apply2_args
(Array (java/lang/Class java/lang/Object))
(|> (host.array (java/lang/Class java/lang/Object) 2)
- (host.array-write 0 _object-class)
- (host.array-write 1 _object-class)))
+ (host.array_write 0 _object_class)
+ (host.array_write 1 _object_class)))
-(def: _apply5-args
+(def: _apply5_args
(Array (java/lang/Class java/lang/Object))
(|> (host.array (java/lang/Class java/lang/Object) 5)
- (host.array-write 0 _object-class)
- (host.array-write 1 _object-class)
- (host.array-write 2 _object-class)
- (host.array-write 3 _object-class)
- (host.array-write 4 _object-class)))
+ (host.array_write 0 _object_class)
+ (host.array_write 1 _object_class)
+ (host.array_write 2 _object_class)
+ (host.array_write 3 _object_class)
+ (host.array_write 4 _object_class)))
(def: #export (expander macro inputs lux)
Expander
(do try.monad
- [apply-method (|> macro
+ [apply_method (|> macro
(:coerce java/lang/Object)
(java/lang/Object::getClass)
- (java/lang/Class::getMethod "apply" _apply2-args))]
+ (java/lang/Class::getMethod "apply" _apply2_args))]
(:coerce (Try (Try [Lux (List Code)]))
(java/lang/reflect/Method::invoke
(:coerce java/lang/Object macro)
(|> (host.array java/lang/Object 2)
- (host.array-write 0 (:coerce java/lang/Object inputs))
- (host.array-write 1 (:coerce java/lang/Object lux)))
- apply-method))))
+ (host.array_write 0 (:coerce java/lang/Object inputs))
+ (host.array_write 1 (:coerce java/lang/Object lux)))
+ apply_method))))
(def: #export platform
## (IO (Platform Anchor (Bytecode Any) Definition))
@@ -118,7 +118,7 @@
(do io.monad
[## host jvm/host.host
host jvm.host]
- (wrap {#platform.&file-system (file.async file.default)
+ (wrap {#platform.&file_system (file.async file.default)
#platform.host host
## #platform.phase jvm.generate
#platform.phase expression.translate
@@ -144,38 +144,38 @@
[method (|> handler
(:coerce java/lang/Object)
(java/lang/Object::getClass)
- (java/lang/Class::getMethod "apply" _apply5-args))]
+ (java/lang/Class::getMethod "apply" _apply5_args))]
(java/lang/reflect/Method::invoke
(:coerce java/lang/Object handler)
(|> (host.array java/lang/Object 5)
- (host.array-write 0 (:coerce java/lang/Object name))
- (host.array-write 1 (:coerce java/lang/Object phase))
- (host.array-write 2 (:coerce java/lang/Object archive))
- (host.array-write 3 (:coerce java/lang/Object parameters))
- (host.array-write 4 (:coerce java/lang/Object state)))
+ (host.array_write 0 (:coerce java/lang/Object name))
+ (host.array_write 1 (:coerce java/lang/Object phase))
+ (host.array_write 2 (:coerce java/lang/Object archive))
+ (host.array_write 3 (:coerce java/lang/Object parameters))
+ (host.array_write 4 (:coerce java/lang/Object state)))
method))))
-(def: (declare-success! _)
+(def: (declare_success! _)
(-> Any (Promise Any))
(promise.future (\ world/program.default exit +0)))
(program: [{service /cli.service}]
(exec (do promise.monad
[_ (/.compiler {#/static.host @.jvm
- #/static.host-module-extension ".jvm"
+ #/static.host_module_extension ".jvm"
#/static.target (/cli.target service)
- #/static.artifact-extension ".class"}
+ #/static.artifact_extension ".class"}
..expander
analysis.bundle
..platform
## generation.bundle
translation.bundle
(directive.bundle ..extender)
- (jvm/program.program jvm/runtime.class-name)
+ (jvm/program.program jvm/runtime.class_name)
[_.Anchor _.Inst _.Definition]
..extender
service
[packager.package
(format (/cli.target service) (\ file.default separator) "program.jar")])]
- (..declare-success! []))
+ (..declare_success! []))
(io.io [])))