diff options
Diffstat (limited to 'stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux')
-rw-r--r-- | stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux b/stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux new file mode 100644 index 000000000..a11434594 --- /dev/null +++ b/stdlib/source/lux/lang/compiler/translation/scheme/structure.jvm.lux @@ -0,0 +1,29 @@ +(.module: + lux + (lux (control [monad #+ do])) + (//// [compiler] + [analysis #+ Variant Tuple] + [synthesis #+ Synthesis] + (host ["_" scheme #+ Expression])) + [//runtime #+ Operation Translator] + [//primitive]) + +(def: #export (tuple translate elemsS+) + (-> Translator (Tuple Synthesis) (Operation Expression)) + (case elemsS+ + #.Nil + (//primitive.text synthesis.unit) + + (#.Cons singletonS #.Nil) + (translate singletonS) + + _ + (do compiler.Monad<Operation> + [elemsT+ (monad.map @ translate elemsS+)] + (wrap (_.vector/* elemsT+))))) + +(def: #export (variant translate [lefts right? valueS]) + (-> Translator (Variant Synthesis) (Operation Expression)) + (do compiler.Monad<Operation> + [valueT (translate valueS)] + (wrap (//runtime.variant [lefts right? valueT])))) |