From c7e53036704b1a89b740c023c7b4bcc74b7e956a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 14 Jun 2017 17:56:24 -0400 Subject: - Heavy refactoring. --- new-luxc/source/luxc/generator/primitive.jvm.lux | 45 +++++++++--------------- 1 file changed, 16 insertions(+), 29 deletions(-) (limited to 'new-luxc/source/luxc/generator/primitive.jvm.lux') 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/" Monad] - [host #+ jvm-import]) + [macro #+ Monad "Lux/" Monad]) (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 - [visitor &common;get-visitor - #let [_ (MethodVisitor.visitLdcInsn [(:! java.lang.Object &common;unit)] visitor)]] - (wrap []))) + (Lux $;Inst) + (Lux/wrap ($i;string &common;unit))) -(do-template [ ] +(do-template [ ] [(def: #export ( value) - (-> (Lux Unit)) - (do Monad - [visitor &common;get-visitor - #let [_ (MethodVisitor.visitLdcInsn [(:! java.lang.Object value)] visitor) - _ ( visitor)]] - (wrap [])))] + (-> (Lux $;Inst)) + (Lux/wrap (|>. ( value) )))] - [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] ) -- cgit v1.2.3