aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/procedure
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/procedure')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux282
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux366
2 files changed, 324 insertions, 324 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux
index 6447ec20a..2334f9cc2 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.jvm.lux
@@ -20,7 +20,7 @@
(host ["$" jvm]
(jvm ["$t" type]
["$d" def]
- ["$i" inst]))))
+ ["_" inst]))))
(/// [".T" runtime]
[".T" case]
[".T" function]
@@ -110,32 +110,32 @@
(wrap (proc inputsI))))))
## [Instructions]
-(def: lux-intI $.Inst (|>> $i.I2L ($i.wrap #$.Long)))
-(def: jvm-intI $.Inst (|>> ($i.unwrap #$.Long) $i.L2I))
+(def: lux-intI $.Inst (|>> _.I2L (_.wrap #$.Long)))
+(def: jvm-intI $.Inst (|>> (_.unwrap #$.Long) _.L2I))
(def: (array-writeI arrayI idxI elemI)
(-> $.Inst $.Inst $.Inst
$.Inst)
- (|>> arrayI ($i.CHECKCAST ($t.descriptor $Object-Array))
- $i.DUP
+ (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array))
+ _.DUP
idxI jvm-intI
elemI
- $i.AASTORE))
+ _.AASTORE))
(def: (predicateI tester)
(-> (-> $.Label $.Inst)
$.Inst)
- (<| $i.with-label (function (_ @then))
- $i.with-label (function (_ @end))
+ (<| _.with-label (function (_ @then))
+ _.with-label (function (_ @end))
(|>> (tester @then)
- ($i.GETSTATIC "java.lang.Boolean" "FALSE" ($t.class "java.lang.Boolean" (list)))
- ($i.GOTO @end)
- ($i.label @then)
- ($i.GETSTATIC "java.lang.Boolean" "TRUE" ($t.class "java.lang.Boolean" (list)))
- ($i.label @end)
+ (_.GETSTATIC "java.lang.Boolean" "FALSE" ($t.class "java.lang.Boolean" (list)))
+ (_.GOTO @end)
+ (_.label @then)
+ (_.GETSTATIC "java.lang.Boolean" "TRUE" ($t.class "java.lang.Boolean" (list)))
+ (_.label @end)
)))
-(def: unitI $.Inst ($i.string hostL.unit))
+(def: unitI $.Inst (_.string hostL.unit))
## [Procedures]
## [[Lux]]
@@ -143,7 +143,7 @@
Binary
(|>> leftI
rightI
- (predicateI $i.IF_ACMPEQ)))
+ (predicateI _.IF_ACMPEQ)))
(def: (lux//if [testI thenI elseI])
Trinary
@@ -152,10 +152,10 @@
(def: (lux//try riskyI)
Unary
(|>> riskyI
- ($i.CHECKCAST hostL.function-class)
- ($i.INVOKESTATIC hostL.runtime-class "try"
- ($t.method (list $Function) (#.Some $Object-Array) (list))
- #0)))
+ (_.CHECKCAST hostL.function-class)
+ (_.INVOKESTATIC hostL.runtime-class "try"
+ ($t.method (list $Function) (#.Some $Object-Array) (list))
+ #0)))
(exception: #export (Wrong-Syntax {message Text})
message)
@@ -187,48 +187,48 @@
(do-template [<name> <op>]
[(def: (<name> [inputI maskI])
Binary
- (|>> inputI ($i.unwrap #$.Long)
- maskI ($i.unwrap #$.Long)
- <op> ($i.wrap #$.Long)))]
+ (|>> inputI (_.unwrap #$.Long)
+ maskI (_.unwrap #$.Long)
+ <op> (_.wrap #$.Long)))]
- [bit//and $i.LAND]
- [bit//or $i.LOR]
- [bit//xor $i.LXOR]
+ [bit//and _.LAND]
+ [bit//or _.LOR]
+ [bit//xor _.LXOR]
)
(do-template [<name> <op>]
[(def: (<name> [inputI shiftI])
Binary
- (|>> inputI ($i.unwrap #$.Long)
+ (|>> inputI (_.unwrap #$.Long)
shiftI jvm-intI
<op>
- ($i.wrap #$.Long)))]
+ (_.wrap #$.Long)))]
- [bit//left-shift $i.LSHL]
- [bit//arithmetic-right-shift $i.LSHR]
- [bit//logical-right-shift $i.LUSHR]
+ [bit//left-shift _.LSHL]
+ [bit//arithmetic-right-shift _.LSHR]
+ [bit//logical-right-shift _.LUSHR]
)
## [[Arrays]]
(def: (array//new lengthI)
Unary
- (|>> lengthI jvm-intI ($i.ANEWARRAY ($t.binary-name "java.lang.Object"))))
+ (|>> lengthI jvm-intI (_.ANEWARRAY ($t.binary-name "java.lang.Object"))))
(def: (array//get [arrayI idxI])
Binary
- (<| $i.with-label (function (_ @is-null))
- $i.with-label (function (_ @end))
- (|>> arrayI ($i.CHECKCAST ($t.descriptor $Object-Array))
+ (<| _.with-label (function (_ @is-null))
+ _.with-label (function (_ @end))
+ (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array))
idxI jvm-intI
- $i.AALOAD
- $i.DUP
- ($i.IFNULL @is-null)
+ _.AALOAD
+ _.DUP
+ (_.IFNULL @is-null)
runtimeT.someI
- ($i.GOTO @end)
- ($i.label @is-null)
- $i.POP
+ (_.GOTO @end)
+ (_.label @is-null)
+ _.POP
runtimeT.noneI
- ($i.label @end))))
+ (_.label @end))))
(def: (array//put [arrayI idxI elemI])
Trinary
@@ -236,12 +236,12 @@
(def: (array//remove [arrayI idxI])
Binary
- (array-writeI arrayI idxI $i.NULL))
+ (array-writeI arrayI idxI _.NULL))
(def: (array//size arrayI)
Unary
- (|>> arrayI ($i.CHECKCAST ($t.descriptor $Object-Array))
- $i.ARRAYLENGTH
+ (|>> arrayI (_.CHECKCAST ($t.descriptor $Object-Array))
+ _.ARRAYLENGTH
lux-intI))
## [[Numbers]]
@@ -252,32 +252,32 @@
(do-template [<name> <const> <type>]
[(def: (<name> _)
Nullary
- (|>> <const> ($i.wrap <type>)))]
+ (|>> <const> (_.wrap <type>)))]
- [frac//smallest ($i.double Double::MIN_VALUE) #$.Double]
- [frac//min ($i.double (f/* -1.0 Double::MAX_VALUE)) #$.Double]
- [frac//max ($i.double Double::MAX_VALUE) #$.Double]
+ [frac//smallest (_.double Double::MIN_VALUE) #$.Double]
+ [frac//min (_.double (f/* -1.0 Double::MAX_VALUE)) #$.Double]
+ [frac//max (_.double Double::MAX_VALUE) #$.Double]
)
(do-template [<name> <type> <op>]
[(def: (<name> [subjectI paramI])
Binary
- (|>> subjectI ($i.unwrap <type>)
- paramI ($i.unwrap <type>)
+ (|>> subjectI (_.unwrap <type>)
+ paramI (_.unwrap <type>)
<op>
- ($i.wrap <type>)))]
+ (_.wrap <type>)))]
- [int//add #$.Long $i.LADD]
- [int//sub #$.Long $i.LSUB]
- [int//mul #$.Long $i.LMUL]
- [int//div #$.Long $i.LDIV]
- [int//rem #$.Long $i.LREM]
+ [int//add #$.Long _.LADD]
+ [int//sub #$.Long _.LSUB]
+ [int//mul #$.Long _.LMUL]
+ [int//div #$.Long _.LDIV]
+ [int//rem #$.Long _.LREM]
- [frac//add #$.Double $i.DADD]
- [frac//sub #$.Double $i.DSUB]
- [frac//mul #$.Double $i.DMUL]
- [frac//div #$.Double $i.DDIV]
- [frac//rem #$.Double $i.DREM]
+ [frac//add #$.Double _.DADD]
+ [frac//sub #$.Double _.DSUB]
+ [frac//mul #$.Double _.DMUL]
+ [frac//div #$.Double _.DDIV]
+ [frac//rem #$.Double _.DREM]
)
(do-template [<eq> <lt> <unwrap> <cmp>]
@@ -287,13 +287,13 @@
(|>> subjectI <unwrap>
paramI <unwrap>
<cmp>
- ($i.int <reference>)
- (predicateI $i.IF_ICMPEQ)))]
+ (_.int <reference>)
+ (predicateI _.IF_ICMPEQ)))]
[<eq> 0]
[<lt> -1])]
- [int//eq int//lt ($i.unwrap #$.Long) $i.LCMP]
- [frac//eq frac//lt ($i.unwrap #$.Double) $i.DCMPG]
+ [int//eq int//lt (_.unwrap #$.Long) _.LCMP]
+ [frac//eq frac//lt (_.unwrap #$.Double) _.DCMPG]
)
(do-template [<name> <prepare> <transform>]
@@ -301,15 +301,15 @@
Unary
(|>> inputI <prepare> <transform>))]
- [int//to-frac ($i.unwrap #$.Long) (<| ($i.wrap #$.Double) $i.L2D)]
- [int//char ($i.unwrap #$.Long)
- ((|>> $i.L2I $i.I2C ($i.INVOKESTATIC "java.lang.Character" "toString" ($t.method (list $t.char) (#.Some $String) (list)) #0)))]
+ [int//to-frac (_.unwrap #$.Long) (<| (_.wrap #$.Double) _.L2D)]
+ [int//char (_.unwrap #$.Long)
+ ((|>> _.L2I _.I2C (_.INVOKESTATIC "java.lang.Character" "toString" ($t.method (list $t.char) (#.Some $String) (list)) #0)))]
- [frac//to-int ($i.unwrap #$.Double) (<| ($i.wrap #$.Long) $i.D2L)]
- [frac//encode ($i.unwrap #$.Double)
- ($i.INVOKESTATIC "java.lang.Double" "toString" ($t.method (list $t.double) (#.Some $String) (list)) #0)]
- [frac//decode ($i.CHECKCAST "java.lang.String")
- ($i.INVOKESTATIC hostL.runtime-class "decode_frac" ($t.method (list $String) (#.Some $Object-Array) (list)) #0)]
+ [frac//to-int (_.unwrap #$.Double) (<| (_.wrap #$.Long) _.D2L)]
+ [frac//encode (_.unwrap #$.Double)
+ (_.INVOKESTATIC "java.lang.Double" "toString" ($t.method (list $t.double) (#.Some $String) (list)) #0)]
+ [frac//decode (_.CHECKCAST "java.lang.String")
+ (_.INVOKESTATIC hostL.runtime-class "decode_frac" ($t.method (list $String) (#.Some $Object-Array) (list)) #0)]
)
## [[Text]]
@@ -317,8 +317,8 @@
[(def: (<name> inputI)
Unary
(|>> inputI
- ($i.CHECKCAST "java.lang.String")
- ($i.INVOKEVIRTUAL <class> <method> ($t.method (list) (#.Some <outputT>) (list)) #0)
+ (_.CHECKCAST "java.lang.String")
+ (_.INVOKEVIRTUAL <class> <method> ($t.method (list) (#.Some <outputT>) (list)) #0)
<post>))]
[text//size "java.lang.String" "length" lux-intI $t.int]
@@ -332,16 +332,16 @@
<op> <post>))]
[text//eq id id
- ($i.INVOKEVIRTUAL "java.lang.Object" "equals" ($t.method (list $Object) (#.Some $t.boolean) (list)) #0)
- ($i.wrap #$.Boolean)]
- [text//lt ($i.CHECKCAST "java.lang.String") ($i.CHECKCAST "java.lang.String")
- ($i.INVOKEVIRTUAL "java.lang.String" "compareTo" ($t.method (list $String) (#.Some $t.int) (list)) #0)
- (<| (predicateI $i.IF_ICMPEQ) ($i.int -1))]
- [text//concat ($i.CHECKCAST "java.lang.String") ($i.CHECKCAST "java.lang.String")
- ($i.INVOKEVIRTUAL "java.lang.String" "concat" ($t.method (list $String) (#.Some $String) (list)) #0)
+ (_.INVOKEVIRTUAL "java.lang.Object" "equals" ($t.method (list $Object) (#.Some $t.boolean) (list)) #0)
+ (_.wrap #$.Boolean)]
+ [text//lt (_.CHECKCAST "java.lang.String") (_.CHECKCAST "java.lang.String")
+ (_.INVOKEVIRTUAL "java.lang.String" "compareTo" ($t.method (list $String) (#.Some $t.int) (list)) #0)
+ (<| (predicateI _.IF_ICMPEQ) (_.int -1))]
+ [text//concat (_.CHECKCAST "java.lang.String") (_.CHECKCAST "java.lang.String")
+ (_.INVOKEVIRTUAL "java.lang.String" "concat" ($t.method (list $String) (#.Some $String) (list)) #0)
id]
- [text//char ($i.CHECKCAST "java.lang.String") jvm-intI
- ($i.INVOKESTATIC hostL.runtime-class "text_char" ($t.method (list $String $t.int) (#.Some $Variant) (list)) #0)
+ [text//char (_.CHECKCAST "java.lang.String") jvm-intI
+ (_.INVOKESTATIC hostL.runtime-class "text_char" ($t.method (list $String $t.int) (#.Some $Variant) (list)) #0)
id]
)
@@ -353,30 +353,30 @@
extraI <pre-extra>
<op>))]
- [text//clip ($i.CHECKCAST "java.lang.String") jvm-intI jvm-intI
- ($i.INVOKESTATIC hostL.runtime-class "text_clip"
- ($t.method (list $String $t.int $t.int) (#.Some $Variant) (list)) #0)]
+ [text//clip (_.CHECKCAST "java.lang.String") jvm-intI jvm-intI
+ (_.INVOKESTATIC hostL.runtime-class "text_clip"
+ ($t.method (list $String $t.int $t.int) (#.Some $Variant) (list)) #0)]
)
(def: index-method $.Method ($t.method (list $String $t.int) (#.Some $t.int) (list)))
(def: (text//index [textI partI startI])
Trinary
- (<| $i.with-label (function (_ @not-found))
- $i.with-label (function (_ @end))
- (|>> textI ($i.CHECKCAST "java.lang.String")
- partI ($i.CHECKCAST "java.lang.String")
+ (<| _.with-label (function (_ @not-found))
+ _.with-label (function (_ @end))
+ (|>> textI (_.CHECKCAST "java.lang.String")
+ partI (_.CHECKCAST "java.lang.String")
startI jvm-intI
- ($i.INVOKEVIRTUAL "java.lang.String" "indexOf" index-method #0)
- $i.DUP
- ($i.int -1)
- ($i.IF_ICMPEQ @not-found)
+ (_.INVOKEVIRTUAL "java.lang.String" "indexOf" index-method #0)
+ _.DUP
+ (_.int -1)
+ (_.IF_ICMPEQ @not-found)
lux-intI
runtimeT.someI
- ($i.GOTO @end)
- ($i.label @not-found)
- $i.POP
+ (_.GOTO @end)
+ (_.label @not-found)
+ _.POP
runtimeT.noneI
- ($i.label @end))))
+ (_.label @end))))
## [[Math]]
(def: math-unary-method ($t.method (list $t.double) (#.Some $t.double) (list)))
@@ -386,9 +386,9 @@
[(def: (<name> inputI)
Unary
(|>> inputI
- ($i.unwrap #$.Double)
- ($i.INVOKESTATIC "java.lang.Math" <method> math-unary-method #0)
- ($i.wrap #$.Double)))]
+ (_.unwrap #$.Double)
+ (_.INVOKESTATIC "java.lang.Math" <method> math-unary-method #0)
+ (_.wrap #$.Double)))]
[math//cos "cos"]
[math//sin "sin"]
@@ -408,10 +408,10 @@
(do-template [<name> <method>]
[(def: (<name> [inputI paramI])
Binary
- (|>> inputI ($i.unwrap #$.Double)
- paramI ($i.unwrap #$.Double)
- ($i.INVOKESTATIC "java.lang.Math" <method> math-binary-method #0)
- ($i.wrap #$.Double)))]
+ (|>> inputI (_.unwrap #$.Double)
+ paramI (_.unwrap #$.Double)
+ (_.INVOKESTATIC "java.lang.Math" <method> math-binary-method #0)
+ (_.wrap #$.Double)))]
[math//atan2 "atan2"]
[math//pow "pow"]
@@ -420,103 +420,103 @@
(def: (math//round inputI)
Unary
(|>> inputI
- ($i.unwrap #$.Double)
- ($i.INVOKESTATIC "java.lang.Math" "round" ($t.method (list $t.double) (#.Some $t.long) (list)) #0)
- $i.L2D
- ($i.wrap #$.Double)))
+ (_.unwrap #$.Double)
+ (_.INVOKESTATIC "java.lang.Math" "round" ($t.method (list $t.double) (#.Some $t.long) (list)) #0)
+ _.L2D
+ (_.wrap #$.Double)))
## [[IO]]
(def: string-method $.Method ($t.method (list $String) #.None (list)))
(def: (io//log messageI)
Unary
- (|>> ($i.GETSTATIC "java.lang.System" "out" ($t.class "java.io.PrintStream" (list)))
+ (|>> (_.GETSTATIC "java.lang.System" "out" ($t.class "java.io.PrintStream" (list)))
messageI
- ($i.CHECKCAST "java.lang.String")
- ($i.INVOKEVIRTUAL "java.io.PrintStream" "println" string-method #0)
+ (_.CHECKCAST "java.lang.String")
+ (_.INVOKEVIRTUAL "java.io.PrintStream" "println" string-method #0)
unitI))
(def: (io//error messageI)
Unary
- (|>> ($i.NEW "java.lang.Error")
- $i.DUP
+ (|>> (_.NEW "java.lang.Error")
+ _.DUP
messageI
- ($i.CHECKCAST "java.lang.String")
- ($i.INVOKESPECIAL "java.lang.Error" "<init>" string-method #0)
- $i.ATHROW))
+ (_.CHECKCAST "java.lang.String")
+ (_.INVOKESPECIAL "java.lang.Error" "<init>" string-method #0)
+ _.ATHROW))
(def: (io//exit codeI)
Unary
(|>> codeI jvm-intI
- ($i.INVOKESTATIC "java.lang.System" "exit" ($t.method (list $t.int) #.None (list)) #0)
- $i.NULL))
+ (_.INVOKESTATIC "java.lang.System" "exit" ($t.method (list $t.int) #.None (list)) #0)
+ _.NULL))
(def: (io//current-time [])
Nullary
- (|>> ($i.INVOKESTATIC "java.lang.System" "currentTimeMillis" ($t.method (list) (#.Some $t.long) (list)) #0)
- ($i.wrap #$.Long)))
+ (|>> (_.INVOKESTATIC "java.lang.System" "currentTimeMillis" ($t.method (list) (#.Some $t.long) (list)) #0)
+ (_.wrap #$.Long)))
## [[Atoms]]
(def: atom-class Text "java.util.concurrent.atomic.AtomicReference")
(def: (atom//new initI)
Unary
- (|>> ($i.NEW atom-class)
- $i.DUP
+ (|>> (_.NEW atom-class)
+ _.DUP
initI
- ($i.INVOKESPECIAL atom-class "<init>" ($t.method (list $Object) #.None (list)) #0)))
+ (_.INVOKESPECIAL atom-class "<init>" ($t.method (list $Object) #.None (list)) #0)))
(def: (atom//read atomI)
Unary
(|>> atomI
- ($i.CHECKCAST atom-class)
- ($i.INVOKEVIRTUAL atom-class "get" ($t.method (list) (#.Some $Object) (list)) #0)))
+ (_.CHECKCAST atom-class)
+ (_.INVOKEVIRTUAL atom-class "get" ($t.method (list) (#.Some $Object) (list)) #0)))
(def: (atom//compare-and-swap [atomI oldI newI])
Trinary
(|>> atomI
- ($i.CHECKCAST atom-class)
+ (_.CHECKCAST atom-class)
oldI
newI
- ($i.INVOKEVIRTUAL atom-class "compareAndSet" ($t.method (list $Object $Object) (#.Some $t.boolean) (list)) #0)
- ($i.wrap #$.Boolean)))
+ (_.INVOKEVIRTUAL atom-class "compareAndSet" ($t.method (list $Object $Object) (#.Some $t.boolean) (list)) #0)
+ (_.wrap #$.Boolean)))
## [[Box]]
(def: empty-boxI
$.Inst
- (|>> ($i.int 1) ($i.ANEWARRAY ($t.binary-name "java.lang.Object"))))
+ (|>> (_.int 1) (_.ANEWARRAY ($t.binary-name "java.lang.Object"))))
(def: check-boxI
$.Inst
- ($i.CHECKCAST ($t.descriptor $Object-Array)))
+ (_.CHECKCAST ($t.descriptor $Object-Array)))
(def: (box//new initI)
Unary
(|>> empty-boxI
- $i.DUP ($i.int 0) initI $i.AASTORE))
+ _.DUP (_.int 0) initI _.AASTORE))
(def: (box//read boxI)
Unary
(|>> boxI check-boxI
- ($i.int 0) $i.AALOAD))
+ (_.int 0) _.AALOAD))
(def: (box//write [valueI boxI])
Binary
(|>> boxI check-boxI
- ($i.int 0) valueI $i.AASTORE
+ (_.int 0) valueI _.AASTORE
unitI))
## [[Processes]]
(def: (process//parallelism-level [])
Nullary
- (|>> ($i.INVOKESTATIC "java.lang.Runtime" "getRuntime" ($t.method (list) (#.Some ($t.class "java.lang.Runtime" (list))) (list)) #0)
- ($i.INVOKEVIRTUAL "java.lang.Runtime" "availableProcessors" ($t.method (list) (#.Some $t.int) (list)) #0)
+ (|>> (_.INVOKESTATIC "java.lang.Runtime" "getRuntime" ($t.method (list) (#.Some ($t.class "java.lang.Runtime" (list))) (list)) #0)
+ (_.INVOKEVIRTUAL "java.lang.Runtime" "availableProcessors" ($t.method (list) (#.Some $t.int) (list)) #0)
lux-intI))
(def: (process//schedule [millisecondsI procedureI])
Binary
- (|>> millisecondsI ($i.unwrap #$.Long)
- procedureI ($i.CHECKCAST hostL.function-class)
- ($i.INVOKESTATIC hostL.runtime-class "schedule"
- ($t.method (list $t.long $Function) (#.Some $Object) (list)) #0)))
+ (|>> millisecondsI (_.unwrap #$.Long)
+ procedureI (_.CHECKCAST hostL.function-class)
+ (_.INVOKESTATIC hostL.runtime-class "schedule"
+ ($t.method (list $t.long $Function) (#.Some $Object) (list)) #0)))
## [Bundles]
(def: lux-procs
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux
index ddf345a13..370f07f82 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.jvm.lux
@@ -19,7 +19,7 @@
(host ["$" jvm]
(jvm ["$t" type]
["$d" def]
- ["$i" inst]))
+ ["_" inst]))
["la" analysis]
(extension (analysis ["&." host]))
["ls" synthesis]))
@@ -38,47 +38,47 @@
$.Inst
<inst>)]
- [L2S (|>> $i.L2I $i.I2S)]
- [L2B (|>> $i.L2I $i.I2B)]
- [L2C (|>> $i.L2I $i.I2C)]
+ [L2S (|>> _.L2I _.I2S)]
+ [L2B (|>> _.L2I _.I2B)]
+ [L2C (|>> _.L2I _.I2C)]
)
(do-template [<name> <unwrap> <conversion> <wrap>]
[(def: (<name> inputI)
@.Unary
- (if (is? $i.NOP <conversion>)
+ (if (is? _.NOP <conversion>)
(|>> inputI
- ($i.unwrap <unwrap>)
- ($i.wrap <wrap>))
+ (_.unwrap <unwrap>)
+ (_.wrap <wrap>))
(|>> inputI
- ($i.unwrap <unwrap>)
+ (_.unwrap <unwrap>)
<conversion>
- ($i.wrap <wrap>))))]
+ (_.wrap <wrap>))))]
- [convert//double-to-float #$.Double $i.D2F #$.Float]
- [convert//double-to-int #$.Double $i.D2I #$.Int]
- [convert//double-to-long #$.Double $i.D2L #$.Long]
- [convert//float-to-double #$.Float $i.F2D #$.Double]
- [convert//float-to-int #$.Float $i.F2I #$.Int]
- [convert//float-to-long #$.Float $i.F2L #$.Long]
- [convert//int-to-byte #$.Int $i.I2B #$.Byte]
- [convert//int-to-char #$.Int $i.I2C #$.Char]
- [convert//int-to-double #$.Int $i.I2D #$.Double]
- [convert//int-to-float #$.Int $i.I2F #$.Float]
- [convert//int-to-long #$.Int $i.I2L #$.Long]
- [convert//int-to-short #$.Int $i.I2S #$.Short]
- [convert//long-to-double #$.Long $i.L2D #$.Double]
- [convert//long-to-float #$.Long $i.L2F #$.Float]
- [convert//long-to-int #$.Long $i.L2I #$.Int]
+ [convert//double-to-float #$.Double _.D2F #$.Float]
+ [convert//double-to-int #$.Double _.D2I #$.Int]
+ [convert//double-to-long #$.Double _.D2L #$.Long]
+ [convert//float-to-double #$.Float _.F2D #$.Double]
+ [convert//float-to-int #$.Float _.F2I #$.Int]
+ [convert//float-to-long #$.Float _.F2L #$.Long]
+ [convert//int-to-byte #$.Int _.I2B #$.Byte]
+ [convert//int-to-char #$.Int _.I2C #$.Char]
+ [convert//int-to-double #$.Int _.I2D #$.Double]
+ [convert//int-to-float #$.Int _.I2F #$.Float]
+ [convert//int-to-long #$.Int _.I2L #$.Long]
+ [convert//int-to-short #$.Int _.I2S #$.Short]
+ [convert//long-to-double #$.Long _.L2D #$.Double]
+ [convert//long-to-float #$.Long _.L2F #$.Float]
+ [convert//long-to-int #$.Long _.L2I #$.Int]
[convert//long-to-short #$.Long L2S #$.Short]
[convert//long-to-byte #$.Long L2B #$.Byte]
[convert//long-to-char #$.Long L2C #$.Char]
- [convert//char-to-byte #$.Char $i.I2B #$.Byte]
- [convert//char-to-short #$.Char $i.I2S #$.Short]
- [convert//char-to-int #$.Char $i.NOP #$.Int]
- [convert//char-to-long #$.Char $i.I2L #$.Long]
- [convert//byte-to-long #$.Byte $i.I2L #$.Long]
- [convert//short-to-long #$.Short $i.I2L #$.Long]
+ [convert//char-to-byte #$.Char _.I2B #$.Byte]
+ [convert//char-to-short #$.Char _.I2S #$.Short]
+ [convert//char-to-int #$.Char _.NOP #$.Int]
+ [convert//char-to-long #$.Char _.I2L #$.Long]
+ [convert//byte-to-long #$.Byte _.I2L #$.Long]
+ [convert//short-to-long #$.Short _.I2L #$.Long]
)
(def: conversion-procs
@@ -114,96 +114,96 @@
(do-template [<name> <op> <unwrapX> <unwrapY> <wrap>]
[(def: (<name> [xI yI])
@.Binary
- (|>> xI ($i.unwrap <unwrapX>)
- yI ($i.unwrap <unwrapY>)
- <op> ($i.wrap <wrap>)))]
-
- [int//+ $i.IADD #$.Int #$.Int #$.Int]
- [int//- $i.ISUB #$.Int #$.Int #$.Int]
- [int//* $i.IMUL #$.Int #$.Int #$.Int]
- [int/// $i.IDIV #$.Int #$.Int #$.Int]
- [int//% $i.IREM #$.Int #$.Int #$.Int]
- [int//and $i.IAND #$.Int #$.Int #$.Int]
- [int//or $i.IOR #$.Int #$.Int #$.Int]
- [int//xor $i.IXOR #$.Int #$.Int #$.Int]
- [int//shl $i.ISHL #$.Int #$.Int #$.Int]
- [int//shr $i.ISHR #$.Int #$.Int #$.Int]
- [int//ushr $i.IUSHR #$.Int #$.Int #$.Int]
+ (|>> xI (_.unwrap <unwrapX>)
+ yI (_.unwrap <unwrapY>)
+ <op> (_.wrap <wrap>)))]
+
+ [int//+ _.IADD #$.Int #$.Int #$.Int]
+ [int//- _.ISUB #$.Int #$.Int #$.Int]
+ [int//* _.IMUL #$.Int #$.Int #$.Int]
+ [int/// _.IDIV #$.Int #$.Int #$.Int]
+ [int//% _.IREM #$.Int #$.Int #$.Int]
+ [int//and _.IAND #$.Int #$.Int #$.Int]
+ [int//or _.IOR #$.Int #$.Int #$.Int]
+ [int//xor _.IXOR #$.Int #$.Int #$.Int]
+ [int//shl _.ISHL #$.Int #$.Int #$.Int]
+ [int//shr _.ISHR #$.Int #$.Int #$.Int]
+ [int//ushr _.IUSHR #$.Int #$.Int #$.Int]
- [long//+ $i.LADD #$.Long #$.Long #$.Long]
- [long//- $i.LSUB #$.Long #$.Long #$.Long]
- [long//* $i.LMUL #$.Long #$.Long #$.Long]
- [long/// $i.LDIV #$.Long #$.Long #$.Long]
- [long//% $i.LREM #$.Long #$.Long #$.Long]
- [long//and $i.LAND #$.Long #$.Long #$.Long]
- [long//or $i.LOR #$.Long #$.Long #$.Long]
- [long//xor $i.LXOR #$.Long #$.Long #$.Long]
- [long//shl $i.LSHL #$.Long #$.Int #$.Long]
- [long//shr $i.LSHR #$.Long #$.Int #$.Long]
- [long//ushr $i.LUSHR #$.Long #$.Int #$.Long]
-
- [float//+ $i.FADD #$.Float #$.Float #$.Float]
- [float//- $i.FSUB #$.Float #$.Float #$.Float]
- [float//* $i.FMUL #$.Float #$.Float #$.Float]
- [float/// $i.FDIV #$.Float #$.Float #$.Float]
- [float//% $i.FREM #$.Float #$.Float #$.Float]
+ [long//+ _.LADD #$.Long #$.Long #$.Long]
+ [long//- _.LSUB #$.Long #$.Long #$.Long]
+ [long//* _.LMUL #$.Long #$.Long #$.Long]
+ [long/// _.LDIV #$.Long #$.Long #$.Long]
+ [long//% _.LREM #$.Long #$.Long #$.Long]
+ [long//and _.LAND #$.Long #$.Long #$.Long]
+ [long//or _.LOR #$.Long #$.Long #$.Long]
+ [long//xor _.LXOR #$.Long #$.Long #$.Long]
+ [long//shl _.LSHL #$.Long #$.Int #$.Long]
+ [long//shr _.LSHR #$.Long #$.Int #$.Long]
+ [long//ushr _.LUSHR #$.Long #$.Int #$.Long]
+
+ [float//+ _.FADD #$.Float #$.Float #$.Float]
+ [float//- _.FSUB #$.Float #$.Float #$.Float]
+ [float//* _.FMUL #$.Float #$.Float #$.Float]
+ [float/// _.FDIV #$.Float #$.Float #$.Float]
+ [float//% _.FREM #$.Float #$.Float #$.Float]
- [double//+ $i.DADD #$.Double #$.Double #$.Double]
- [double//- $i.DSUB #$.Double #$.Double #$.Double]
- [double//* $i.DMUL #$.Double #$.Double #$.Double]
- [double/// $i.DDIV #$.Double #$.Double #$.Double]
- [double//% $i.DREM #$.Double #$.Double #$.Double]
+ [double//+ _.DADD #$.Double #$.Double #$.Double]
+ [double//- _.DSUB #$.Double #$.Double #$.Double]
+ [double//* _.DMUL #$.Double #$.Double #$.Double]
+ [double/// _.DDIV #$.Double #$.Double #$.Double]
+ [double//% _.DREM #$.Double #$.Double #$.Double]
)
(def: boolean-class ($t.class "java.lang.Boolean" (list)))
-(def: falseI ($i.GETSTATIC "java.lang.Boolean" "FALSE" boolean-class))
-(def: trueI ($i.GETSTATIC "java.lang.Boolean" "TRUE" boolean-class))
+(def: falseI (_.GETSTATIC "java.lang.Boolean" "FALSE" boolean-class))
+(def: trueI (_.GETSTATIC "java.lang.Boolean" "TRUE" boolean-class))
(do-template [<name> <op> <unwrapX> <unwrapY> <wrap>]
[(def: (<name> [xI yI])
@.Binary
- (<| $i.with-label (function (_ @then))
- $i.with-label (function (_ @end))
- (|>> xI ($i.unwrap <unwrapX>)
- yI ($i.unwrap <unwrapY>)
+ (<| _.with-label (function (_ @then))
+ _.with-label (function (_ @end))
+ (|>> xI (_.unwrap <unwrapX>)
+ yI (_.unwrap <unwrapY>)
(<op> @then)
falseI
- ($i.GOTO @end)
- ($i.label @then)
+ (_.GOTO @end)
+ (_.label @then)
trueI
- ($i.label @end))))]
+ (_.label @end))))]
- [int//= $i.IF_ICMPEQ #$.Int #$.Int #$.Boolean]
- [int//< $i.IF_ICMPLT #$.Int #$.Int #$.Boolean]
+ [int//= _.IF_ICMPEQ #$.Int #$.Int #$.Boolean]
+ [int//< _.IF_ICMPLT #$.Int #$.Int #$.Boolean]
- [char//= $i.IF_ICMPEQ #$.Char #$.Char #$.Boolean]
- [char//< $i.IF_ICMPLT #$.Char #$.Char #$.Boolean]
+ [char//= _.IF_ICMPEQ #$.Char #$.Char #$.Boolean]
+ [char//< _.IF_ICMPLT #$.Char #$.Char #$.Boolean]
)
(do-template [<name> <op> <reference> <unwrapX> <unwrapY> <wrap>]
[(def: (<name> [xI yI])
@.Binary
- (<| $i.with-label (function (_ @then))
- $i.with-label (function (_ @end))
- (|>> xI ($i.unwrap <unwrapX>)
- yI ($i.unwrap <unwrapY>)
+ (<| _.with-label (function (_ @then))
+ _.with-label (function (_ @end))
+ (|>> xI (_.unwrap <unwrapX>)
+ yI (_.unwrap <unwrapY>)
<op>
- ($i.int <reference>)
- ($i.IF_ICMPEQ @then)
+ (_.int <reference>)
+ (_.IF_ICMPEQ @then)
falseI
- ($i.GOTO @end)
- ($i.label @then)
+ (_.GOTO @end)
+ (_.label @then)
trueI
- ($i.label @end))))]
+ (_.label @end))))]
- [long//= $i.LCMP 0 #$.Long #$.Long #$.Boolean]
- [long//< $i.LCMP -1 #$.Long #$.Long #$.Boolean]
+ [long//= _.LCMP 0 #$.Long #$.Long #$.Boolean]
+ [long//< _.LCMP -1 #$.Long #$.Long #$.Boolean]
- [float//= $i.FCMPG 0 #$.Float #$.Float #$.Boolean]
- [float//< $i.FCMPG -1 #$.Float #$.Float #$.Boolean]
+ [float//= _.FCMPG 0 #$.Float #$.Float #$.Boolean]
+ [float//< _.FCMPG -1 #$.Float #$.Float #$.Boolean]
- [double//= $i.DCMPG 0 #$.Double #$.Double #$.Boolean]
- [double//< $i.DCMPG -1 #$.Double #$.Double #$.Boolean]
+ [double//= _.DCMPG 0 #$.Double #$.Double #$.Boolean]
+ [double//< _.DCMPG -1 #$.Double #$.Double #$.Boolean]
)
(def: int-procs
@@ -281,9 +281,9 @@
(def: (array//length arrayI)
@.Unary
(|>> arrayI
- $i.ARRAYLENGTH
- $i.I2L
- ($i.wrap #$.Long)))
+ _.ARRAYLENGTH
+ _.I2L
+ (_.wrap #$.Long)))
(def: (array//new proc translate inputs)
(-> Text @.Proc)
@@ -302,9 +302,9 @@
"char" $t.char
_ ($t.class class (list))))]]
(wrap (|>> lengthI
- ($i.unwrap #$.Long)
- $i.L2I
- ($i.array arrayJT))))
+ (_.unwrap #$.Long)
+ _.L2I
+ (_.array arrayJT))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))
@@ -317,19 +317,19 @@
[arrayI (translate arrayS)
idxI (translate idxS)
#let [loadI (case class
- "boolean" (|>> $i.BALOAD ($i.wrap #$.Boolean))
- "byte" (|>> $i.BALOAD ($i.wrap #$.Byte))
- "short" (|>> $i.SALOAD ($i.wrap #$.Short))
- "int" (|>> $i.IALOAD ($i.wrap #$.Int))
- "long" (|>> $i.LALOAD ($i.wrap #$.Long))
- "float" (|>> $i.FALOAD ($i.wrap #$.Float))
- "double" (|>> $i.DALOAD ($i.wrap #$.Double))
- "char" (|>> $i.CALOAD ($i.wrap #$.Char))
- _ $i.AALOAD)]]
+ "boolean" (|>> _.BALOAD (_.wrap #$.Boolean))
+ "byte" (|>> _.BALOAD (_.wrap #$.Byte))
+ "short" (|>> _.SALOAD (_.wrap #$.Short))
+ "int" (|>> _.IALOAD (_.wrap #$.Int))
+ "long" (|>> _.LALOAD (_.wrap #$.Long))
+ "float" (|>> _.FALOAD (_.wrap #$.Float))
+ "double" (|>> _.DALOAD (_.wrap #$.Double))
+ "char" (|>> _.CALOAD (_.wrap #$.Char))
+ _ _.AALOAD)]]
(wrap (|>> arrayI
idxI
- ($i.unwrap #$.Long)
- $i.L2I
+ (_.unwrap #$.Long)
+ _.L2I
loadI)))
_
@@ -344,20 +344,20 @@
idxI (translate idxS)
valueI (translate valueS)
#let [storeI (case class
- "boolean" (|>> ($i.unwrap #$.Boolean) $i.BASTORE)
- "byte" (|>> ($i.unwrap #$.Byte) $i.BASTORE)
- "short" (|>> ($i.unwrap #$.Short) $i.SASTORE)
- "int" (|>> ($i.unwrap #$.Int) $i.IASTORE)
- "long" (|>> ($i.unwrap #$.Long) $i.LASTORE)
- "float" (|>> ($i.unwrap #$.Float) $i.FASTORE)
- "double" (|>> ($i.unwrap #$.Double) $i.DASTORE)
- "char" (|>> ($i.unwrap #$.Char) $i.CASTORE)
- _ $i.AASTORE)]]
+ "boolean" (|>> (_.unwrap #$.Boolean) _.BASTORE)
+ "byte" (|>> (_.unwrap #$.Byte) _.BASTORE)
+ "short" (|>> (_.unwrap #$.Short) _.SASTORE)
+ "int" (|>> (_.unwrap #$.Int) _.IASTORE)
+ "long" (|>> (_.unwrap #$.Long) _.LASTORE)
+ "float" (|>> (_.unwrap #$.Float) _.FASTORE)
+ "double" (|>> (_.unwrap #$.Double) _.DASTORE)
+ "char" (|>> (_.unwrap #$.Char) _.CASTORE)
+ _ _.AASTORE)]]
(wrap (|>> arrayI
- $i.DUP
+ _.DUP
idxI
- ($i.unwrap #$.Long)
- $i.L2I
+ (_.unwrap #$.Long)
+ _.L2I
valueI
storeI)))
@@ -376,33 +376,33 @@
(def: (object//null _)
@.Nullary
- $i.NULL)
+ _.NULL)
(def: (object//null? objectI)
@.Unary
- (<| $i.with-label (function (_ @then))
- $i.with-label (function (_ @end))
+ (<| _.with-label (function (_ @then))
+ _.with-label (function (_ @end))
(|>> objectI
- ($i.IFNULL @then)
+ (_.IFNULL @then)
falseI
- ($i.GOTO @end)
- ($i.label @then)
+ (_.GOTO @end)
+ (_.label @then)
trueI
- ($i.label @end))))
+ (_.label @end))))
(def: (object//synchronized [monitorI exprI])
@.Binary
(|>> monitorI
- $i.DUP
- $i.MONITORENTER
+ _.DUP
+ _.MONITORENTER
exprI
- $i.SWAP
- $i.MONITOREXIT))
+ _.SWAP
+ _.MONITOREXIT))
(def: (object//throw exceptionI)
@.Unary
(|>> exceptionI
- $i.ATHROW))
+ _.ATHROW))
(def: (object//class proc translate inputs)
(-> Text @.Proc)
@@ -410,12 +410,12 @@
(^ (list [_ (#.Text class)]))
(do macro.Monad<Meta>
[]
- (wrap (|>> ($i.string class)
- ($i.INVOKESTATIC "java.lang.Class" "forName"
- ($t.method (list ($t.class "java.lang.String" (list)))
- (#.Some ($t.class "java.lang.Class" (list)))
- (list))
- #0))))
+ (wrap (|>> (_.string class)
+ (_.INVOKESTATIC "java.lang.Class" "forName"
+ ($t.method (list ($t.class "java.lang.String" (list)))
+ (#.Some ($t.class "java.lang.Class" (list)))
+ (list))
+ #0))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))
@@ -427,8 +427,8 @@
(do macro.Monad<Meta>
[objectI (translate objectS)]
(wrap (|>> objectI
- ($i.INSTANCEOF class)
- ($i.wrap #$.Boolean))))
+ (_.INSTANCEOF class)
+ (_.wrap #$.Boolean))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))
@@ -443,10 +443,10 @@
## Wrap
(^template [<primitive> <object> <type>]
[<primitive> <object>]
- (wrap (|>> valueI ($i.wrap <type>)))
+ (wrap (|>> valueI (_.wrap <type>)))
[<object> <primitive>]
- (wrap (|>> valueI ($i.unwrap <type>))))
+ (wrap (|>> valueI (_.unwrap <type>))))
(["boolean" "java.lang.Boolean" #$.Boolean]
["byte" "java.lang.Byte" #$.Byte]
["short" "java.lang.Short" #$.Short]
@@ -505,11 +505,11 @@
"double" #$.Double
"char" #$.Char
_ (undefined))]
- (wrap (|>> ($i.GETSTATIC class field (#$.Primitive primitive))
- ($i.wrap primitive))))
+ (wrap (|>> (_.GETSTATIC class field (#$.Primitive primitive))
+ (_.wrap primitive))))
#.None
- (wrap ($i.GETSTATIC class field ($t.class unboxed (list))))))
+ (wrap (_.GETSTATIC class field ($t.class unboxed (list))))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))
@@ -533,15 +533,15 @@
"char" #$.Char
_ (undefined))]
(wrap (|>> valueI
- ($i.unwrap primitive)
- ($i.PUTSTATIC class field (#$.Primitive primitive))
- ($i.string hostL.unit))))
+ (_.unwrap primitive)
+ (_.PUTSTATIC class field (#$.Primitive primitive))
+ (_.string hostL.unit))))
#.None
(wrap (|>> valueI
- ($i.CHECKCAST class)
- ($i.PUTSTATIC class field ($t.class class (list)))
- ($i.string hostL.unit)))))
+ (_.CHECKCAST class)
+ (_.PUTSTATIC class field ($t.class class (list)))
+ (_.string hostL.unit)))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))
@@ -565,14 +565,14 @@
"char" #$.Char
_ (undefined))]
(wrap (|>> objectI
- ($i.CHECKCAST class)
- ($i.GETFIELD class field (#$.Primitive primitive))
- ($i.wrap primitive))))
+ (_.CHECKCAST class)
+ (_.GETFIELD class field (#$.Primitive primitive))
+ (_.wrap primitive))))
#.None
(wrap (|>> objectI
- ($i.CHECKCAST class)
- ($i.GETFIELD class field ($t.class unboxed (list)))))))
+ (_.CHECKCAST class)
+ (_.GETFIELD class field ($t.class unboxed (list)))))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))
@@ -597,19 +597,19 @@
"char" #$.Char
_ (undefined))]
(wrap (|>> objectI
- ($i.CHECKCAST class)
- $i.DUP
+ (_.CHECKCAST class)
+ _.DUP
valueI
- ($i.unwrap primitive)
- ($i.PUTFIELD class field (#$.Primitive primitive)))))
+ (_.unwrap primitive)
+ (_.PUTFIELD class field (#$.Primitive primitive)))))
#.None
(wrap (|>> objectI
- ($i.CHECKCAST class)
- $i.DUP
+ (_.CHECKCAST class)
+ _.DUP
valueI
- ($i.CHECKCAST unboxed)
- ($i.PUTFIELD class field ($t.class unboxed (list)))))))
+ (_.CHECKCAST unboxed)
+ (_.PUTFIELD class field ($t.class unboxed (list)))))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))
@@ -676,10 +676,10 @@
(do macro.Monad<Meta>
[argsTI (monad.map @ (translate-arg translate) argsS)
returnT (method-return-type unboxed)]
- (wrap (|>> ($i.fuse (list/map product.right argsTI))
- ($i.INVOKESTATIC class method
- ($t.method (list/map product.left argsTI) returnT (list))
- #0))))
+ (wrap (|>> (_.fuse (list/map product.right argsTI))
+ (_.INVOKESTATIC class method
+ ($t.method (list/map product.left argsTI) returnT (list))
+ #0))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))
@@ -695,8 +695,8 @@
argsTI (monad.map @ (translate-arg translate) argsS)
returnT (method-return-type unboxed)]
(wrap (|>> objectI
- ($i.CHECKCAST class)
- ($i.fuse (list/map product.right argsTI))
+ (_.CHECKCAST class)
+ (_.fuse (list/map product.right argsTI))
(<invoke> class method
($t.method (list/map product.left argsTI) returnT (list))
<interface?>))))
@@ -704,9 +704,9 @@
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))]
- [invoke//virtual $i.INVOKEVIRTUAL #0]
- [invoke//special $i.INVOKESPECIAL #0]
- [invoke//interface $i.INVOKEINTERFACE #1]
+ [invoke//virtual _.INVOKEVIRTUAL #0]
+ [invoke//special _.INVOKESPECIAL #0]
+ [invoke//interface _.INVOKEINTERFACE #1]
)
(def: (invoke//constructor proc translate inputs)
@@ -715,12 +715,12 @@
(^ (list& [_ (#.Text class)] argsS))
(do macro.Monad<Meta>
[argsTI (monad.map @ (translate-arg translate) argsS)]
- (wrap (|>> ($i.NEW class)
- $i.DUP
- ($i.fuse (list/map product.right argsTI))
- ($i.INVOKESPECIAL class "<init>"
- ($t.method (list/map product.left argsTI) #.None (list))
- #0))))
+ (wrap (|>> (_.NEW class)
+ _.DUP
+ (_.fuse (list/map product.right argsTI))
+ (_.INVOKESPECIAL class "<init>"
+ ($t.method (list/map product.left argsTI) #.None (list))
+ #0))))
_
(&.throw @.Wrong-Syntax (@.wrong-syntax proc inputs))))