From 9eaaaf953ba7ce1eeb805603f4e113aa15f5178f Mon Sep 17 00:00:00 2001
From: Eduardo Julian
Date: Mon, 8 Jan 2018 21:40:06 -0400
Subject: - Moved all translation code under the JVM path (in preparation for
porting the JS back-end).
---
.../luxc/lang/translation/jvm/primitive.jvm.lux | 35 ++++++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux
(limited to 'new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux')
diff --git a/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux
new file mode 100644
index 000000000..f92c7025a
--- /dev/null
+++ b/new-luxc/source/luxc/lang/translation/jvm/primitive.jvm.lux
@@ -0,0 +1,35 @@
+(.module:
+ lux
+ (lux (control monad)
+ (data text/format)
+ [macro "macro/" Monad])
+ (luxc ["&" lang]
+ (lang [".L" host]
+ (host ["$" jvm]
+ (jvm ["$i" inst]
+ ["$t" type]))
+ ["la" analysis]
+ ["ls" synthesis]))
+ (// [".T" common]))
+
+(def: #export translate-unit
+ (Meta $.Inst)
+ (macro/wrap ($i.string hostL.unit)))
+
+(def: #export (translate-bool value)
+ (-> Bool (Meta $.Inst))
+ (macro/wrap ($i.GETSTATIC "java.lang.Boolean"
+ (if value "TRUE" "FALSE")
+ ($t.class "java.lang.Boolean" (list)))))
+
+(do-template [ ]
+ [(def: #export ( value)
+ (-> (Meta $.Inst))
+ (macro/wrap (|>> ( value) )))]
+
+ [translate-nat Nat (|>> (:! Int) $i.long) ($i.wrap #$.Long)]
+ [translate-int Int $i.long ($i.wrap #$.Long)]
+ [translate-deg Deg (|>> (:! Int) $i.long) ($i.wrap #$.Long)]
+ [translate-frac Frac $i.double ($i.wrap #$.Double)]
+ [translate-text Text $i.string id]
+ )
--
cgit v1.2.3