diff options
author | Eduardo Julian | 2018-03-13 23:28:19 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-03-13 23:28:19 -0400 |
commit | b14f95ca68887d9e6cea211b47e04e5ec00c05fa (patch) | |
tree | 4fad118bec9800bfae885dcb6311e8755b98918a /new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux | |
parent | 38bd6f35d81705ab0c04c85601ac5b236b62605a (diff) |
- Initial Ruby back-end implementation.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux new file mode 100644 index 000000000..e7121ac98 --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux @@ -0,0 +1,28 @@ +(.module: + lux + (lux (control [monad #+ do] + ["ex" exception #+ exception:]) + (data [maybe] + text/format + (coll [dict]))) + (luxc ["&" lang] + (lang ["ls" synthesis] + (host [ruby #+ Ruby Expression Statement]))) + [//] + (/ ["/." 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))))) |