aboutsummaryrefslogtreecommitdiff
path: root/new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux
diff options
context:
space:
mode:
authorEduardo Julian2018-03-13 23:28:19 -0400
committerEduardo Julian2018-03-13 23:28:19 -0400
commitb14f95ca68887d9e6cea211b47e04e5ec00c05fa (patch)
tree4fad118bec9800bfae885dcb6311e8755b98918a /new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux
parent38bd6f35d81705ab0c04c85601ac5b236b62605a (diff)
- Initial Ruby back-end implementation.
Diffstat (limited to '')
-rw-r--r--new-luxc/source/luxc/lang/translation/ruby/procedure.jvm.lux28
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)))))