aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
diff options
context:
space:
mode:
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux')
-rw-r--r--new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux112
1 files changed, 57 insertions, 55 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
index c4bc66923..7d9cd9cc5 100644
--- a/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
+++ b/new-luxc/source/luxc/lang/translation/jvm/procedure/host.lux
@@ -1,5 +1,5 @@
(.module:
- [lux (#- int char)
+ [lux (#- Type int char)
[abstract
["." monad (#+ do)]]
[control
@@ -14,6 +14,9 @@
[collection
["." list ("#@." functor)]
["." dictionary (#+ Dictionary)]]]
+ [target
+ [jvm
+ ["_t" type (#+ Primitive Type Method)]]]
[tool
[compiler
["." synthesis (#+ Synthesis %synthesis)]
@@ -27,8 +30,7 @@
[luxc
[lang
[host
- ["$" jvm (#+ Primitive Label Inst Method Handler Bundle Operation)
- ["_t" type]
+ ["$" jvm (#+ Label Inst Handler Bundle Operation)
["_" inst]]]]])
(template [<name>]
@@ -57,30 +59,30 @@
(|>> inputI
<conversion>)))]
- [conversion::double-to-float #$.Double _.D2F #$.Float]
- [conversion::double-to-int #$.Double _.D2I #$.Int]
- [conversion::double-to-long #$.Double _.D2L #$.Long]
- [conversion::float-to-double #$.Float _.F2D #$.Double]
- [conversion::float-to-int #$.Float _.F2I #$.Int]
- [conversion::float-to-long #$.Float _.F2L #$.Long]
- [conversion::int-to-byte #$.Int _.I2B #$.Byte]
- [conversion::int-to-char #$.Int _.I2C #$.Char]
- [conversion::int-to-double #$.Int _.I2D #$.Double]
- [conversion::int-to-float #$.Int _.I2F #$.Float]
- [conversion::int-to-long #$.Int _.I2L #$.Long]
- [conversion::int-to-short #$.Int _.I2S #$.Short]
- [conversion::long-to-double #$.Long _.L2D #$.Double]
- [conversion::long-to-float #$.Long _.L2F #$.Float]
- [conversion::long-to-int #$.Long _.L2I #$.Int]
- [conversion::long-to-short #$.Long L2S #$.Short]
- [conversion::long-to-byte #$.Long L2B #$.Byte]
- [conversion::long-to-char #$.Long L2C #$.Char]
- [conversion::char-to-byte #$.Char _.I2B #$.Byte]
- [conversion::char-to-short #$.Char _.I2S #$.Short]
- [conversion::char-to-int #$.Char _.NOP #$.Int]
- [conversion::char-to-long #$.Char _.I2L #$.Long]
- [conversion::byte-to-long #$.Byte _.I2L #$.Long]
- [conversion::short-to-long #$.Short _.I2L #$.Long]
+ [conversion::double-to-float #_t.Double _.D2F #_t.Float]
+ [conversion::double-to-int #_t.Double _.D2I #_t.Int]
+ [conversion::double-to-long #_t.Double _.D2L #_t.Long]
+ [conversion::float-to-double #_t.Float _.F2D #_t.Double]
+ [conversion::float-to-int #_t.Float _.F2I #_t.Int]
+ [conversion::float-to-long #_t.Float _.F2L #_t.Long]
+ [conversion::int-to-byte #_t.Int _.I2B #_t.Byte]
+ [conversion::int-to-char #_t.Int _.I2C #_t.Char]
+ [conversion::int-to-double #_t.Int _.I2D #_t.Double]
+ [conversion::int-to-float #_t.Int _.I2F #_t.Float]
+ [conversion::int-to-long #_t.Int _.I2L #_t.Long]
+ [conversion::int-to-short #_t.Int _.I2S #_t.Short]
+ [conversion::long-to-double #_t.Long _.L2D #_t.Double]
+ [conversion::long-to-float #_t.Long _.L2F #_t.Float]
+ [conversion::long-to-int #_t.Long _.L2I #_t.Int]
+ [conversion::long-to-short #_t.Long L2S #_t.Short]
+ [conversion::long-to-byte #_t.Long L2B #_t.Byte]
+ [conversion::long-to-char #_t.Long L2C #_t.Char]
+ [conversion::char-to-byte #_t.Char _.I2B #_t.Byte]
+ [conversion::char-to-short #_t.Char _.I2S #_t.Short]
+ [conversion::char-to-int #_t.Char _.NOP #_t.Int]
+ [conversion::char-to-long #_t.Char _.I2L #_t.Long]
+ [conversion::byte-to-long #_t.Byte _.I2L #_t.Long]
+ [conversion::short-to-long #_t.Short _.I2L #_t.Long]
)
(def: conversion
@@ -281,7 +283,7 @@
)))
(def: (array-java-type nesting elem-class)
- (-> Nat Text $.Type)
+ (-> Nat Text Type)
(_t.array nesting
(case elem-class
"boolean" _t.boolean
@@ -447,7 +449,7 @@
[objectI (generate objectS)]
(wrap (|>> objectI
(_.INSTANCEOF class)
- (_.wrap #$.Boolean))))
+ (_.wrap #_t.Boolean))))
_
(phase.throw extension.invalid-syntax [proc %synthesis inputs])))
@@ -466,14 +468,14 @@
[<object> <primitive>]
(wrap (|>> valueI (_.unwrap <type>))))
- (["boolean" "java.lang.Boolean" #$.Boolean]
- ["byte" "java.lang.Byte" #$.Byte]
- ["short" "java.lang.Short" #$.Short]
- ["int" "java.lang.Integer" #$.Int]
- ["long" "java.lang.Long" #$.Long]
- ["float" "java.lang.Float" #$.Float]
- ["double" "java.lang.Double" #$.Double]
- ["char" "java.lang.Character" #$.Char])
+ (["boolean" "java.lang.Boolean" #_t.Boolean]
+ ["byte" "java.lang.Byte" #_t.Byte]
+ ["short" "java.lang.Short" #_t.Short]
+ ["int" "java.lang.Integer" #_t.Int]
+ ["long" "java.lang.Long" #_t.Long]
+ ["float" "java.lang.Float" #_t.Float]
+ ["double" "java.lang.Double" #_t.Double]
+ ["char" "java.lang.Character" #_t.Char])
_
(wrap valueI)))
@@ -496,14 +498,14 @@
(def: primitives
(Dictionary Text Primitive)
- (|> (list ["boolean" #$.Boolean]
- ["byte" #$.Byte]
- ["short" #$.Short]
- ["int" #$.Int]
- ["long" #$.Long]
- ["float" #$.Float]
- ["double" #$.Double]
- ["char" #$.Char])
+ (|> (list ["boolean" #_t.Boolean]
+ ["byte" #_t.Byte]
+ ["short" #_t.Short]
+ ["int" #_t.Int]
+ ["long" #_t.Long]
+ ["float" #_t.Float]
+ ["double" #_t.Double]
+ ["char" #_t.Char])
(dictionary.from-list text.hash)))
(def: (static::get proc generate inputs)
@@ -516,7 +518,7 @@
[]
(case (dictionary.get unboxed primitives)
(#.Some primitive)
- (wrap (_.GETSTATIC class field (#$.Primitive primitive)))
+ (wrap (_.GETSTATIC class field (#_t.Primitive primitive)))
#.None
(wrap (_.GETSTATIC class field (_t.class unboxed (list))))))
@@ -536,7 +538,7 @@
(case (dictionary.get unboxed primitives)
(#.Some primitive)
(wrap (|>> valueI
- (_.PUTSTATIC class field (#$.Primitive primitive))
+ (_.PUTSTATIC class field (#_t.Primitive primitive))
(_.string synthesis.unit)))
#.None
@@ -561,7 +563,7 @@
(#.Some primitive)
(wrap (|>> objectI
(_.CHECKCAST class)
- (_.GETFIELD class field (#$.Primitive primitive))))
+ (_.GETFIELD class field (#_t.Primitive primitive))))
#.None
(wrap (|>> objectI
@@ -588,7 +590,7 @@
(_.CHECKCAST class)
_.DUP
valueI
- (_.PUTFIELD class field (#$.Primitive primitive))))
+ (_.PUTFIELD class field (#_t.Primitive primitive))))
#.None
(wrap (|>> objectI
@@ -602,7 +604,7 @@
(phase.throw extension.invalid-syntax [proc %synthesis inputs])))
(def: base-type
- (l.Parser $.Type)
+ (l.Parser Type)
($_ p.either
(p.after (l.this "boolean") (p@wrap _t.boolean))
(p.after (l.this "byte") (p@wrap _t.byte))
@@ -618,14 +620,14 @@
))
(def: java-type
- (l.Parser $.Type)
+ (l.Parser Type)
(do p.monad
[raw base-type
nesting (p.some (l.this "[]"))]
(wrap (_t.array (list.size nesting) raw))))
(def: (generate-type argD)
- (-> Text (Operation $.Type))
+ (-> Text (Operation Type))
(case (l.run argD java-type)
(#error.Failure error)
(phase.throw invalid-syntax-for-jvm-type argD)
@@ -635,7 +637,7 @@
(def: (generate-arg generate argS)
(-> (-> Synthesis (Operation Inst)) Synthesis
- (Operation [$.Type Inst]))
+ (Operation [Type Inst]))
(case argS
(^ (synthesis.tuple (list (synthesis.text argD) argS)))
(do phase.monad
@@ -647,7 +649,7 @@
(phase.throw invalid-syntax-for-argument-generation "")))
(def: (method-return-type description)
- (-> Text (Operation (Maybe $.Type)))
+ (-> Text (Operation (Maybe Type)))
(case description
"void"
(phase@wrap #.None)
@@ -656,7 +658,7 @@
(phase@map (|>> #.Some) (generate-type description))))
(def: (prepare-argI [type argI])
- (-> [$.Type Inst] Inst)
+ (-> [Type Inst] Inst)
(case (_t.class-name type)
(#.Some class-name)
(|>> argI