diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux index 4c50a7aef..e9653547d 100644 --- a/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux @@ -1,8 +1,11 @@ (.module: lux - (lux (data text/format) + (lux (control [monad #+ do]) + (data text/format) + [macro] (macro [code] - ["s" syntax #+ syntax:])) + ["s" syntax #+ syntax:]) + [io #+ Process]) [//]) (def: prefix Text "LuxRuntime") @@ -56,6 +59,18 @@ (function [(~' @)] <js-definition>))))) +(def: #export (int-constant value) + (-> Int //.Expression) + (format "{" + //.int-high-field " : " (|> value int-to-nat //.high nat-to-int %i) + ", " + //.int-low-field " : " (|> value int-to-nat //.low nat-to-int %i) + "}")) + +(def: #export (frac-constant value) + (-> Frac //.Expression) + (%f value)) + (runtime: lux//try "runTry" (format "(function " @ "(op) {" (format "try {" @@ -1109,6 +1124,8 @@ (def: #export artifact Text (format prefix ".js")) -## (def: #export generate -## (Meta Unit) -## (&&/save-js! artifact runtime)) +(def: #export translate + (Meta (Process Unit)) + (do macro.Monad<Meta> + [_ (//.save-js runtime)] + (//.save-module! artifact))) |