From 0bd93d82eb7a50b9ce8be42800c388e87e6ca9bf Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Fri, 23 Feb 2018 23:10:28 -0400 Subject: - Added a code-generation utility module for JS. --- .../lang/translation/js/procedure/common.jvm.lux | 23 +++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'new-luxc/source/luxc/lang/translation/js/procedure/common.jvm.lux') 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] -- cgit v1.2.3