aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/js/procedure
diff options
context:
space:
mode:
authorEduardo Julian2018-02-23 23:10:28 -0400
committerEduardo Julian2018-02-23 23:10:28 -0400
commit0bd93d82eb7a50b9ce8be42800c388e87e6ca9bf (patch)
tree847453417dbf6bf76be82efd498074029162d38b /new-luxc/source/luxc/lang/translation/js/procedure
parentc8e2898611fa759cbe7c2ac84738b5b403575664 (diff)
- Added a code-generation utility module for JS.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux7
-rw-r--r--new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux23
2 files changed, 16 insertions, 14 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux
index 66c7fe6f5..afedc42e0 100644
--- a/new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux
@@ -6,7 +6,8 @@
text/format
(coll [dict])))
(luxc ["&" lang]
- (lang ["ls" synthesis]))
+ (lang ["ls" synthesis]
+ (host [js #+ JS Expression Statement])))
[//]
(/ ["/." common]
["/." host]))
@@ -19,8 +20,8 @@
(dict.merge /host.procedures)))
(def: #export (translate-procedure translate name args)
- (-> (-> ls.Synthesis (Meta //.Expression)) Text (List ls.Synthesis)
- (Meta //.Expression))
+ (-> (-> ls.Synthesis (Meta Expression)) Text (List ls.Synthesis)
+ (Meta Expression))
(<| (maybe.default (&.throw Unknown-Procedure (%t name)))
(do maybe.Monad<Maybe>
[proc (dict.get name procedures)]
diff --git a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
index efef6084c..49bf7fe27 100644
--- a/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
+++ b/new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux
@@ -14,7 +14,8 @@
[host])
(luxc ["&" lang]
(lang ["la" analysis]
- ["ls" synthesis]))
+ ["ls" synthesis]
+ (host [js #+ JS Expression Statement])))
[///]
(/// [".T" runtime]
[".T" case]
@@ -23,10 +24,10 @@
## [Types]
(type: #export Translator
- (-> ls.Synthesis (Meta ///.Expression)))
+ (-> ls.Synthesis (Meta Expression)))
(type: #export Proc
- (-> Translator (List ls.Synthesis) (Meta ///.Expression)))
+ (-> Translator (List ls.Synthesis) (Meta Expression)))
(type: #export Bundle
(Dict Text Proc))
@@ -34,11 +35,11 @@
(syntax: (Vector [size s.nat] elemT)
(wrap (list (` [(~+ (list.repeat size elemT))]))))
-(type: #export Nullary (-> (Vector +0 ///.Expression) ///.Expression))
-(type: #export Unary (-> (Vector +1 ///.Expression) ///.Expression))
-(type: #export Binary (-> (Vector +2 ///.Expression) ///.Expression))
-(type: #export Trinary (-> (Vector +3 ///.Expression) ///.Expression))
-(type: #export Variadic (-> (List ///.Expression) ///.Expression))
+(type: #export Nullary (-> (Vector +0 Expression) Expression))
+(type: #export Unary (-> (Vector +1 Expression) Expression))
+(type: #export Binary (-> (Vector +2 Expression) Expression))
+(type: #export Trinary (-> (Vector +3 Expression) Expression))
+(type: #export Variadic (-> (List Expression) Expression))
## [Utils]
(def: #export (install name unnamed)
@@ -64,7 +65,7 @@
(do @
[g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))]
(wrap (list (` (def: #export ((~ (code.local-symbol name)) (~ g!proc))
- (-> (-> (..Vector (~ (code.nat arity)) ///.Expression) ///.Expression)
+ (-> (-> (..Vector (~ (code.nat arity)) Expression) Expression)
(-> Text ..Proc))
(function [(~ g!name)]
(function [(~ g!translate) (~ g!inputs)]
@@ -94,11 +95,11 @@
(wrap (proc inputsI))))))
(def: (self-contained content)
- (-> ///.Expression ///.Expression)
+ (-> Expression Expression)
(format "(" content ")"))
(def: (void action)
- (-> ///.Expression ///.Expression)
+ (-> Expression Expression)
(format "(" action "," runtimeT.unit ")"))
## [Procedures]