aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/js/reference.jvm.lux
diff options
context:
space:
mode:
authorEduardo Julian2018-01-21 12:58:48 -0400
committerEduardo Julian2018-01-21 12:58:48 -0400
commit498af2e0123c1ce65e46bf15fe3854266ad58f53 (patch)
treee8235092c959b91c4328c838450a9ac391e0cbcc /new-luxc/source/luxc/lang/translation/js/reference.jvm.lux
parent002ee0418195afccd1a1b500a36cc5b2adc44791 (diff)
- WIP: Host procedures for JS.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/js/reference.jvm.lux28
1 files changed, 28 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/js/reference.jvm.lux
new file mode 100644
index 000000000..33cf3ed7d
--- /dev/null
+++ b/new-luxc/source/luxc/lang/translation/js/reference.jvm.lux
@@ -0,0 +1,28 @@
+(.module:
+ lux
+ (lux [macro]
+ (data [text]
+ text/format))
+ (luxc ["&" lang])
+ [//]
+ (// [".T" runtime]))
+
+(do-template [<register> <translation> <prefix>]
+ [(def: #export (<register> register)
+ (-> Nat //.Expression)
+ (format <prefix> (%n register)))
+
+ (def: #export (<translation> register)
+ (-> Nat (Meta //.Expression))
+ (:: macro.Monad<Meta> wrap (<register> register)))]
+
+ [closure translate-local "c"]
+ [variable translate-captured "v"])
+
+(def: #export (global [module name])
+ (-> Ident //.Expression)
+ (format (text.replace-all "/" "_" module) "$" (&.normalize-name name)))
+
+(def: #export (translate-definition name)
+ (-> Ident (Meta //.Expression))
+ (:: macro.Monad<Meta> wrap (global name)))