diff options
author | Eduardo Julian | 2018-01-21 12:58:48 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-01-21 12:58:48 -0400 |
commit | 498af2e0123c1ce65e46bf15fe3854266ad58f53 (patch) | |
tree | e8235092c959b91c4328c838450a9ac391e0cbcc /new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux | |
parent | 002ee0418195afccd1a1b500a36cc5b2adc44791 (diff) |
- WIP: Host procedures for JS.
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux | 27 |
1 files changed, 27 insertions, 0 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 new file mode 100644 index 000000000..66c7fe6f5 --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/js/procedure.jvm.lux @@ -0,0 +1,27 @@ +(.module: + lux + (lux (control [monad #+ do] + ["ex" exception #+ exception:]) + (data [maybe] + text/format + (coll [dict]))) + (luxc ["&" lang] + (lang ["ls" synthesis])) + [//] + (/ ["/." common] + ["/." host])) + +(exception: #export Unknown-Procedure) + +(def: procedures + /common.Bundle + (|> /common.procedures + (dict.merge /host.procedures))) + +(def: #export (translate-procedure translate name args) + (-> (-> 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)] + (wrap (proc translate args))))) |