From b14f95ca68887d9e6cea211b47e04e5ec00c05fa Mon Sep 17 00:00:00 2001
From: Eduardo Julian
Date: Tue, 13 Mar 2018 23:28:19 -0400
Subject: - Initial Ruby back-end implementation.
---
.../luxc/lang/translation/ruby/structure.jvm.lux | 31 ++++++++++++++++++++++
1 file changed, 31 insertions(+)
create mode 100644 new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux
(limited to 'new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux')
diff --git a/new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux
new file mode 100644
index 000000000..5bf7c9e8b
--- /dev/null
+++ b/new-luxc/source/luxc/lang/translation/ruby/structure.jvm.lux
@@ -0,0 +1,31 @@
+(.module:
+ lux
+ (lux (control [monad #+ do])
+ (data [text]
+ text/format)
+ [macro])
+ (luxc ["&" lang]
+ (lang [synthesis #+ Synthesis]
+ (host [ruby #+ Ruby Expression Statement])))
+ [//]
+ (// [".T" runtime]))
+
+(def: #export (translate-tuple translate elemsS+)
+ (-> (-> Synthesis (Meta Expression)) (List Synthesis) (Meta Expression))
+ (case elemsS+
+ #.Nil
+ (:: macro.Monad wrap runtimeT.unit)
+
+ (#.Cons singletonS #.Nil)
+ (translate singletonS)
+
+ _
+ (do macro.Monad
+ [elemsT+ (monad.map @ translate elemsS+)]
+ (wrap (ruby.array elemsT+)))))
+
+(def: #export (translate-variant translate tag tail? valueS)
+ (-> (-> Synthesis (Meta Expression)) Nat Bool Synthesis (Meta Expression))
+ (do macro.Monad
+ [valueT (translate valueS)]
+ (wrap (runtimeT.variant tag tail? valueT))))
--
cgit v1.2.3