diff options
author | Eduardo Julian | 2017-06-14 17:56:24 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-06-14 17:56:24 -0400 |
commit | c7e53036704b1a89b740c023c7b4bcc74b7e956a (patch) | |
tree | fa75c05b4233e654c17edd4de2d2b0b6fb3cece9 /new-luxc/source/luxc/generator/primitive.jvm.lux | |
parent | 9cd2927a4f6175784e081d6b512d3e900c8069e7 (diff) |
- Heavy refactoring.
Diffstat (limited to 'new-luxc/source/luxc/generator/primitive.jvm.lux')
-rw-r--r-- | new-luxc/source/luxc/generator/primitive.jvm.lux | 45 |
1 files changed, 16 insertions, 29 deletions
diff --git a/new-luxc/source/luxc/generator/primitive.jvm.lux b/new-luxc/source/luxc/generator/primitive.jvm.lux index 2c879dd48..18ce2e24a 100644 --- a/new-luxc/source/luxc/generator/primitive.jvm.lux +++ b/new-luxc/source/luxc/generator/primitive.jvm.lux @@ -2,43 +2,30 @@ lux (lux (control monad) (data text/format) - [macro #+ Monad<Lux> "Lux/" Monad<Lux>] - [host #+ jvm-import]) + [macro #+ Monad<Lux> "Lux/" Monad<Lux>]) (luxc ["&" base] (lang ["la" analysis] ["ls" synthesis]) ["&;" analyser] ["&;" synthesizer] - (generator ["&;" common]))) - -(jvm-import #long java.lang.Object) - -(jvm-import org.objectweb.asm.Opcodes) - -(jvm-import org.objectweb.asm.MethodVisitor - (visitLdcInsn [Object] void)) + (generator ["&;" common] + (host ["$" jvm] + (jvm ["$i" inst]))))) (def: #export generate-unit - (Lux Unit) - (do Monad<Lux> - [visitor &common;get-visitor - #let [_ (MethodVisitor.visitLdcInsn [(:! java.lang.Object &common;unit)] visitor)]] - (wrap []))) + (Lux $;Inst) + (Lux/wrap ($i;string &common;unit))) -(do-template [<name> <type> <wrap>] +(do-template [<name> <type> <load> <wrap>] [(def: #export (<name> value) - (-> <type> (Lux Unit)) - (do Monad<Lux> - [visitor &common;get-visitor - #let [_ (MethodVisitor.visitLdcInsn [(:! java.lang.Object value)] visitor) - _ (<wrap> visitor)]] - (wrap [])))] + (-> <type> (Lux $;Inst)) + (Lux/wrap (|>. (<load> value) <wrap>)))] - [generate-bool Bool &common;wrap-boolean] - [generate-nat Nat &common;wrap-long] - [generate-int Int &common;wrap-long] - [generate-deg Deg &common;wrap-long] - [generate-real Real &common;wrap-double] - [generate-char Char &common;wrap-char] - [generate-text Text id] + [generate-bool Bool $i;boolean $i;wrap-boolean] + [generate-nat Nat (|>. (:! Int) $i;long) $i;wrap-long] + [generate-int Int $i;long $i;wrap-long] + [generate-deg Deg (|>. (:! Int) $i;long) $i;wrap-long] + [generate-real Real $i;double $i;wrap-double] + [generate-char Char $i;char $i;wrap-char] + [generate-text Text $i;string id] ) |