diff options
Diffstat (limited to 'new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux | 57 |
1 files changed, 29 insertions, 28 deletions
diff --git a/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux index bc4a3cb95..4c29260f5 100644 --- a/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/jvm/structure.jvm.lux @@ -1,23 +1,24 @@ (.module: [lux #* [control - [monad (#+ do)] + ["." monad (#+ do)] ["ex" exception (#+ exception:)]] [data [text format] [collection ["." list]]] - [language - ["." compiler - [synthesis (#+ Synthesis)]]]] + [compiler + [default + ["." phase + [synthesis (#+ Synthesis)]]]]] [luxc [lang [host - ["." jvm (#+ Inst Operation Compiler) + ["." jvm (#+ Inst Operation Phase) ["$t" type] - ["$i" inst]]]]] - [//]) + ["_" inst]]]]] + ["." //]) (exception: #export (not-a-tuple {size Nat}) (ex.report ["Expected size" ">= 2"] @@ -26,41 +27,41 @@ (def: $Object jvm.Type ($t.class "java.lang.Object" (list))) (def: #export (tuple translate members) - (-> Compiler (List Synthesis) (Operation Inst)) - (do compiler.Monad<Operation> + (-> Phase (List Synthesis) (Operation Inst)) + (do phase.Monad<Operation> [#let [size (list.size members)] - _ (compiler.assert not-a-tuple size - (n/>= +2 size)) + _ (phase.assert not-a-tuple size + (n/>= +2 size)) membersI (|> members list.enumerate (monad.map @ (function (_ [idx member]) (do @ [memberI (translate member)] - (wrap (|>> $i.DUP - ($i.int (.int idx)) + (wrap (|>> _.DUP + (_.int (.int idx)) memberI - $i.AASTORE))))) - (:: @ map $i.fuse))] - (wrap (|>> ($i.int (.int size)) - ($i.array $Object) + _.AASTORE))))) + (:: @ map _.fuse))] + (wrap (|>> (_.int (.int size)) + (_.array $Object) membersI)))) (def: (flagI tail?) (-> Bit Inst) (if tail? - ($i.string "") - $i.NULL)) + (_.string "") + _.NULL)) (def: #export (variant translate tag tail? member) - (-> Compiler Nat Bit Synthesis (Operation Inst)) - (do compiler.Monad<Operation> + (-> Phase Nat Bit Synthesis (Operation Inst)) + (do phase.Monad<Operation> [memberI (translate member)] - (wrap (|>> ($i.int (.int tag)) + (wrap (|>> (_.int (.int tag)) (flagI tail?) memberI - ($i.INVOKESTATIC //.runtime-class - "variant_make" - ($t.method (list $t.int $Object $Object) - (#.Some ($t.array +1 $Object)) - (list)) - #0))))) + (_.INVOKESTATIC //.runtime-class + "variant_make" + ($t.method (list $t.int $Object $Object) + (#.Some ($t.array +1 $Object)) + (list)) + #0))))) |