diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux')
-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))))) |