diff options
author | Eduardo Julian | 2020-05-30 15:19:28 -0400 |
---|---|---|
committer | Eduardo Julian | 2020-05-30 15:19:28 -0400 |
commit | b4d0eba7485caf0c6cf58de1193a9114fa273d8b (patch) | |
tree | f6f7fa2967bb5923347db1ed1d4c9b08e56bf8c6 /lux-jvm/source/luxc/lang/translation/jvm/primitive.lux | |
parent | 6eaa3b57f3f1ea2ce13b942bdb4ef502fc1729bc (diff) |
Split new-luxc into lux-jvm and lux-r.
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation/jvm/primitive.lux')
-rw-r--r-- | lux-jvm/source/luxc/lang/translation/jvm/primitive.lux | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux new file mode 100644 index 000000000..873c363bd --- /dev/null +++ b/lux-jvm/source/luxc/lang/translation/jvm/primitive.lux @@ -0,0 +1,30 @@ +(.module: + [lux (#- i64) + [target + [jvm + ["." type]]] + [tool + [compiler + [phase ("operation@." monad)]]]] + [luxc + [lang + [host + ["." jvm (#+ Inst Operation) + ["_" inst]]]]]) + +(def: #export bit + (-> Bit (Operation Inst)) + (let [Boolean (type.class "java.lang.Boolean" (list))] + (function (_ value) + (operation@wrap (_.GETSTATIC Boolean (if value "TRUE" "FALSE") Boolean))))) + +(template [<name> <type> <load> <wrap>] + [(def: #export (<name> value) + (-> <type> (Operation Inst)) + (let [loadI (|> value <load>)] + (operation@wrap (|>> loadI <wrap>))))] + + [i64 (I64 Any) (<| _.long .int) (_.wrap type.long)] + [f64 Frac _.double (_.wrap type.double)] + [text Text _.string (<|)] + ) |