diff options
author | Eduardo Julian | 2018-04-14 02:02:13 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-14 02:02:13 -0400 |
commit | 4ef2dbc49cd6dae1b8235dfd13dcd298c8aa3bfe (patch) | |
tree | db12bd62ab3e1c9767bfe43edc030e3bfc77ef95 /new-luxc/source/luxc/lang/translation/r/structure.jvm.lux | |
parent | ca238f9c89d3156842b0a3d5fe24a5d69b2eedb0 (diff) |
- Initial R back-end implementation.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/r/structure.jvm.lux | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux new file mode 100644 index 000000000..16d144f93 --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/r/structure.jvm.lux @@ -0,0 +1,31 @@ +(.module: + lux + (lux (control [monad #+ do]) + (data [text] + text/format) + [macro]) + (luxc ["&" lang] + (lang [synthesis #+ Synthesis] + (host [r #+ Expression Statement]))) + [//] + (// [".T" runtime])) + +(def: #export (translate-tuple translate elemsS+) + (-> (-> Synthesis (Meta Expression)) (List Synthesis) (Meta Expression)) + (case elemsS+ + #.Nil + (:: macro.Monad<Meta> wrap runtimeT.unit) + + (#.Cons singletonS #.Nil) + (translate singletonS) + + _ + (do macro.Monad<Meta> + [elemsT+ (monad.map @ translate elemsS+)] + (wrap (r.list elemsT+))))) + +(def: #export (translate-variant translate tag tail? valueS) + (-> (-> Synthesis (Meta Expression)) Nat Bool Synthesis (Meta Expression)) + (do macro.Monad<Meta> + [valueT (translate valueS)] + (wrap (runtimeT.variant tag tail? valueT)))) |