aboutsummaryrefslogtreecommitdiff
path: root/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
diff options
context:
space:
mode:
Diffstat (limited to 'lux-jvm/source/luxc/lang/translation/jvm/structure.lux')
-rw-r--r--lux-jvm/source/luxc/lang/translation/jvm/structure.lux118
1 files changed, 0 insertions, 118 deletions
diff --git a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux b/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
deleted file mode 100644
index 878658efe..000000000
--- a/lux-jvm/source/luxc/lang/translation/jvm/structure.lux
+++ /dev/null
@@ -1,118 +0,0 @@
-(.using
- [library
- [lux {"-" Type Primitive}
- ["[0]" ffi {"+" import:}]
- [abstract
- ["[0]" monad {"+" do}]]
- [control
- ["[0]" exception {"+" exception:}]]
- [data
- [text
- ["%" format {"+" format}]]
- [collection
- ["[0]" list]]]
- [math
- [number
- ["n" nat]
- ["i" int]]]
- [target
- [jvm
- ["[0]" type {"+" Type}
- ["[0]" category {"+" Void Value Return Primitive Object Class Array Var Parameter Method}]
- ["[0]" descriptor {"+" Descriptor}]
- ["[0]" signature {"+" Signature}]]]]
- [tool
- [compiler
- ["[0]" phase]
- [meta
- [archive {"+" Archive}]]
- [language
- [lux
- [synthesis {"+" Synthesis}]]]]]]]
- [luxc
- [lang
- [host
- [jvm {"+" Inst Operation Phase Generator}
- ["_" inst]]]]]
- ["[0]" //
- ["[1][0]" runtime]])
-
-(exception: .public (not_a_tuple [size Nat])
- (exception.report
- "Expected size" ">= 2"
- "Actual size" (%.nat size)))
-
-(def: .public (tuple generate archive members)
- (Generator (List Synthesis))
- (do [@ phase.monad]
- [.let [size (list.size members)]
- _ (phase.assertion ..not_a_tuple size
- (n.>= 2 size))
- membersI (|> members
- list.enumeration
- (monad.each @ (function (_ [idx member])
- (do @
- [memberI (generate archive member)]
- (in (|>> _.DUP
- (_.int (.int idx))
- memberI
- _.AASTORE)))))
- (# @ each _.fuse))]
- (in (|>> (_.int (.int size))
- (_.array //runtime.$Value)
- membersI))))
-
-(import: java/lang/Byte
- "[1]::[0]"
- ("static" MAX_VALUE byte)
- ("static" MIN_VALUE byte))
-
-(import: java/lang/Short
- "[1]::[0]"
- ("static" MAX_VALUE short)
- ("static" MIN_VALUE short))
-
-(def: .public (tagI lefts right?)
- (-> Nat Bit Inst)
- (case lefts
- 0 _.ICONST_0
- 1 _.ICONST_1
- 2 _.ICONST_2
- 3 _.ICONST_3
- 4 _.ICONST_4
- 5 _.ICONST_5
- tag (let [tag (.int tag)]
- (cond (and (i.>= (java/lang/Byte::MIN_VALUE) tag)
- (i.<= (java/lang/Byte::MAX_VALUE) tag))
- (_.BIPUSH tag)
-
- (and (i.>= (java/lang/Short::MIN_VALUE) tag)
- (i.<= (java/lang/Short::MAX_VALUE) tag))
- (_.SIPUSH tag)
-
- ... else
- (_.int tag)))))
-
-(def: .public leftI _.NULL)
-(def: .public rightI (_.string ""))
-
-(def: .public (flagI right?)
- (-> Bit Inst)
- (if right?
- ..rightI
- ..leftI))
-
-(def: .public (variant generate archive [lefts right? member])
- (Generator [Nat Bit Synthesis])
- (do phase.monad
- [memberI (generate archive member)
- .let [tagI (..tagI lefts right?)]]
- (in (|>> tagI
- (flagI right?)
- memberI
- (_.INVOKESTATIC //.$Runtime
- "variant_make"
- (type.method [(list)
- (list //runtime.$Lefts //runtime.$Right? //runtime.$Value)
- //.$Variant
- (list)]))))))