diff options
author | Eduardo Julian | 2018-04-25 22:50:15 -0400 |
---|---|---|
committer | Eduardo Julian | 2018-04-25 22:50:15 -0400 |
commit | fac2fa47c11db08596c890290bae09bf57a27089 (patch) | |
tree | 3ecf21857d43b5f630c114277e111682e493567a /new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux | |
parent | 7d539a83fd55f7ced7657302054e099955b55ae2 (diff) |
- Initial Common Lisp back-end implementation.
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux new file mode 100644 index 000000000..fe7009627 --- /dev/null +++ b/new-luxc/source/luxc/lang/translation/common-lisp/structure.jvm.lux @@ -0,0 +1,31 @@ +(.module: + lux + (lux (control [monad #+ do]) + (data [text] + text/format) + [macro]) + (luxc ["&" lang] + (lang [synthesis #+ Synthesis] + (host ["_" common-lisp #+ Expression]))) + [//] + (// [".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 (_.vector 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)))) |