diff options
author | Eduardo Julian | 2018-01-28 19:41:01 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-01-28 19:41:01 -0400 |
commit | 6b6901b31bbec9947522a94274cd11c8e7683168 (patch) | |
tree | ac984159a7c23bbdfab8a2fa1ddde1f625d7dae0 /new-luxc/source/luxc/lang/translation/js/runtime.jvm.lux | |
parent | 6e829294381d504656d904dc71b7c6729750db5e (diff) |
- Got JS backend to build with the rest of the new-luxc code.
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))) |