aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux
diff options
context:
space:
mode:
authorEduardo Julian2019-04-27 23:41:47 -0400
committerEduardo Julian2019-04-27 23:41:47 -0400
commitaf7f85c4eb724f2888ecce9c8b52d6d3bb1cd807 (patch)
tree9d2b80257b5c82ebcc9f17bd32e9771ea51cc708 /new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux
parentaa7f1d12ae98da9726bf8bbdd3c494a671e3f94b (diff)
Moved JVM type machinery to stdlib.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux70
1 files changed, 36 insertions, 34 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux
index aeaa1d664..cead0848e 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/common.lux
@@ -1,5 +1,5 @@
(.module:
- [lux #*
+ [lux (#- Type)
[abstract
["." monad (#+ do)]]
[control
@@ -10,6 +10,9 @@
format]
[collection
["." dictionary]]]
+ [target
+ [jvm
+ ["_t" type (#+ Type Method)]]]
[tool
[compiler
["." synthesis (#+ Synthesis)]
@@ -23,8 +26,7 @@
[luxc
[lang
[host
- ["$" jvm (#+ Label Inst Method Bundle)
- ["_t" type]
+ ["$" jvm (#+ Label Inst Bundle)
["_" inst]]]]]
["." ///
["." runtime]])
@@ -33,12 +35,12 @@
(#static MIN_VALUE Double)
(#static MAX_VALUE Double))
-(def: $Object-Array $.Type (_t.array 1 ///.$Object))
-(def: $String $.Type (_t.class "java.lang.String" (list)))
-(def: $CharSequence $.Type (_t.class "java.lang.CharSequence" (list)))
+(def: $Object-Array Type (_t.array 1 ///.$Object))
+(def: $String Type (_t.class "java.lang.String" (list)))
+(def: $CharSequence Type (_t.class "java.lang.CharSequence" (list)))
-(def: lux-intI Inst (|>> _.I2L (_.wrap #$.Long)))
-(def: jvm-intI Inst (|>> (_.unwrap #$.Long) _.L2I))
+(def: lux-intI Inst (|>> _.I2L (_.wrap #_t.Long)))
+(def: jvm-intI Inst (|>> (_.unwrap #_t.Long) _.L2I))
(def: check-stringI Inst (_.CHECKCAST "java.lang.String"))
(def: (predicateI tester)
@@ -73,9 +75,9 @@
(template [<name> <op>]
[(def: (<name> [maskI inputI])
(Binary Inst)
- (|>> inputI (_.unwrap #$.Long)
- maskI (_.unwrap #$.Long)
- <op> (_.wrap #$.Long)))]
+ (|>> inputI (_.unwrap #_t.Long)
+ maskI (_.unwrap #_t.Long)
+ <op> (_.wrap #_t.Long)))]
[bit::and _.LAND]
[bit::or _.LOR]
@@ -85,10 +87,10 @@
(template [<name> <op>]
[(def: (<name> [shiftI inputI])
(Binary Inst)
- (|>> inputI (_.unwrap #$.Long)
+ (|>> inputI (_.unwrap #_t.Long)
shiftI jvm-intI
<op>
- (_.wrap #$.Long)))]
+ (_.wrap #_t.Long)))]
[bit::left-shift _.LSHL]
[bit::arithmetic-right-shift _.LSHR]
@@ -100,9 +102,9 @@
(Nullary Inst)
(|>> <const> (_.wrap <type>)))]
- [frac::smallest (_.double (Double::MIN_VALUE)) #$.Double]
- [frac::min (_.double (f/* -1.0 (Double::MAX_VALUE))) #$.Double]
- [frac::max (_.double (Double::MAX_VALUE)) #$.Double]
+ [frac::smallest (_.double (Double::MIN_VALUE)) #_t.Double]
+ [frac::min (_.double (f/* -1.0 (Double::MAX_VALUE))) #_t.Double]
+ [frac::max (_.double (Double::MAX_VALUE)) #_t.Double]
)
(template [<name> <type> <op>]
@@ -113,17 +115,17 @@
<op>
(_.wrap <type>)))]
- [i64::+ #$.Long _.LADD]
- [i64::- #$.Long _.LSUB]
- [int::* #$.Long _.LMUL]
- [int::/ #$.Long _.LDIV]
- [int::% #$.Long _.LREM]
+ [i64::+ #_t.Long _.LADD]
+ [i64::- #_t.Long _.LSUB]
+ [int::* #_t.Long _.LMUL]
+ [int::/ #_t.Long _.LDIV]
+ [int::% #_t.Long _.LREM]
- [frac::+ #$.Double _.DADD]
- [frac::- #$.Double _.DSUB]
- [frac::* #$.Double _.DMUL]
- [frac::/ #$.Double _.DDIV]
- [frac::% #$.Double _.DREM]
+ [frac::+ #_t.Double _.DADD]
+ [frac::- #_t.Double _.DSUB]
+ [frac::* #_t.Double _.DMUL]
+ [frac::/ #_t.Double _.DDIV]
+ [frac::% #_t.Double _.DREM]
)
(template [<eq> <lt> <unwrap> <cmp>]
@@ -139,8 +141,8 @@
[<eq> +0]
[<lt> -1])]
- [i64::= int::< (_.unwrap #$.Long) _.LCMP]
- [frac::= frac::< (_.unwrap #$.Double) _.DCMPG]
+ [i64::= int::< (_.unwrap #_t.Long) _.LCMP]
+ [frac::= frac::< (_.unwrap #_t.Double) _.DCMPG]
)
(template [<name> <prepare> <transform>]
@@ -148,12 +150,12 @@
(Unary Inst)
(|>> inputI <prepare> <transform>))]
- [int::frac (_.unwrap #$.Long) (<| (_.wrap #$.Double) _.L2D)]
- [int::char (_.unwrap #$.Long)
+ [int::frac (_.unwrap #_t.Long) (<| (_.wrap #_t.Double) _.L2D)]
+ [int::char (_.unwrap #_t.Long)
((|>> _.L2I _.I2C (_.INVOKESTATIC "java.lang.Character" "toString" (_t.method (list _t.char) (#.Some $String) (list)) #0)))]
- [frac::int (_.unwrap #$.Double) (<| (_.wrap #$.Long) _.D2L)]
- [frac::encode (_.unwrap #$.Double)
+ [frac::int (_.unwrap #_t.Double) (<| (_.wrap #_t.Long) _.D2L)]
+ [frac::encode (_.unwrap #_t.Double)
(_.INVOKESTATIC "java.lang.Double" "toString" (_t.method (list _t.double) (#.Some $String) (list)) #0)]
[frac::decode ..check-stringI
(_.INVOKESTATIC ///.runtime-class "decode_frac" (_t.method (list $String) (#.Some $Object-Array) (list)) #0)]
@@ -175,7 +177,7 @@
[text::= (<|) (<|)
(_.INVOKEVIRTUAL "java.lang.Object" "equals" (_t.method (list ///.$Object) (#.Some _t.boolean) (list)) #0)
- (_.wrap #$.Boolean)]
+ (_.wrap #_t.Boolean)]
[text::< ..check-stringI ..check-stringI
(_.INVOKEVIRTUAL "java.lang.String" "compareTo" (_t.method (list $String) (#.Some _t.int) (list)) #0)
(predicateI _.IFLT)]
@@ -244,7 +246,7 @@
(def: (io::current-time _)
(Nullary Inst)
(|>> (_.INVOKESTATIC "java.lang.System" "currentTimeMillis" (_t.method (list) (#.Some _t.long) (list)) #0)
- (_.wrap #$.Long)))
+ (_.wrap #_t.Long)))
(def: bundle::lux
Bundle