From 901b09dada43ec6f3b21618800ec7400fda54a0d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Wed, 18 Oct 2017 12:42:46 -0400 Subject: - Updated to the latest changes in stdlib. --- new-luxc/source/luxc/generator/case.jvm.lux | 76 +++++++++++----------- new-luxc/source/luxc/generator/common.jvm.lux | 24 +++---- new-luxc/source/luxc/generator/eval.jvm.lux | 10 +-- new-luxc/source/luxc/generator/expr.jvm.lux | 14 ++-- new-luxc/source/luxc/generator/function.jvm.lux | 22 +++---- new-luxc/source/luxc/generator/host/jvm.lux | 6 +- new-luxc/source/luxc/generator/host/jvm/def.lux | 4 +- new-luxc/source/luxc/generator/host/jvm/inst.lux | 10 +-- new-luxc/source/luxc/generator/primitive.jvm.lux | 18 ++--- new-luxc/source/luxc/generator/procedure.jvm.lux | 5 +- .../source/luxc/generator/procedure/common.jvm.lux | 16 ++--- .../source/luxc/generator/procedure/host.jvm.lux | 24 +++---- new-luxc/source/luxc/generator/reference.jvm.lux | 10 +-- new-luxc/source/luxc/generator/runtime.jvm.lux | 16 ++--- new-luxc/source/luxc/generator/statement.jvm.lux | 10 +-- new-luxc/source/luxc/generator/structure.jvm.lux | 11 ++-- 16 files changed, 137 insertions(+), 139 deletions(-) (limited to 'new-luxc/source/luxc/generator') diff --git a/new-luxc/source/luxc/generator/case.jvm.lux b/new-luxc/source/luxc/generator/case.jvm.lux index 88b3dd5d3..53912f5d0 100644 --- a/new-luxc/source/luxc/generator/case.jvm.lux +++ b/new-luxc/source/luxc/generator/case.jvm.lux @@ -1,7 +1,7 @@ (;module: lux (lux (control [monad #+ do]) - [macro "lux/" Monad]) + [meta "meta/" Monad]) (luxc (lang ["ls" synthesis]) (generator [expr] (host ["$" jvm] @@ -50,60 +50,60 @@ false))) (def: (generate-pattern' stack-depth @else @end path) - (-> Nat $;Label $;Label ls;Path (Lux $;Inst)) + (-> Nat $;Label $;Label ls;Path (Meta $;Inst)) (case path (#ls;ExecP bodyS) - (do macro;Monad + (do meta;Monad [bodyI (expr;generate bodyS)] (wrap (|>. (pop-altI stack-depth) bodyI ($i;GOTO @end)))) #ls;UnitP - (lux/wrap popI) + (meta/wrap popI) (#ls;BindP register) - (lux/wrap (|>. peekI - ($i;ASTORE register) - popI)) + (meta/wrap (|>. peekI + ($i;ASTORE register) + popI)) (#ls;BoolP value) - (lux/wrap (let [jumpI (if value $i;IFEQ $i;IFNE)] - (|>. peekI - ($i;unwrap #$;Boolean) - (jumpI @else)))) + (meta/wrap (let [jumpI (if value $i;IFEQ $i;IFNE)] + (|>. peekI + ($i;unwrap #$;Boolean) + (jumpI @else)))) (^template [ ] ( value) - (lux/wrap (|>. peekI - ($i;unwrap #$;Long) - ($i;long (|> value )) - $i;LCMP - ($i;IFNE @else)))) + (meta/wrap (|>. peekI + ($i;unwrap #$;Long) + ($i;long (|> value )) + $i;LCMP + ($i;IFNE @else)))) ([#ls;NatP (:! Int)] [#ls;IntP (: Int)] [#ls;DegP (:! Int)]) (#ls;FracP value) - (lux/wrap (|>. peekI - ($i;unwrap #$;Double) - ($i;double value) - $i;DCMPL - ($i;IFNE @else))) + (meta/wrap (|>. peekI + ($i;unwrap #$;Double) + ($i;double value) + $i;DCMPL + ($i;IFNE @else))) (#ls;TextP value) - (lux/wrap (|>. peekI - ($i;string value) - ($i;INVOKEVIRTUAL "java.lang.Object" - "equals" - ($t;method (list $Object) - (#;Some $t;boolean) - (list)) - false) - ($i;IFEQ @else))) + (meta/wrap (|>. peekI + ($i;string value) + ($i;INVOKEVIRTUAL "java.lang.Object" + "equals" + ($t;method (list $Object) + (#;Some $t;boolean) + (list)) + false) + ($i;IFEQ @else))) (#ls;TupleP idx subP) - (do macro;Monad + (do meta;Monad [subI (generate-pattern' stack-depth @else @end subP) #let [[idx tail?] (case idx (#;Left idx) @@ -134,7 +134,7 @@ subI)))) (#ls;VariantP idx subP) - (do macro;Monad + (do meta;Monad [subI (generate-pattern' stack-depth @else @end subP) #let [[idx last?] (case idx (#;Left idx) @@ -167,14 +167,14 @@ subI)))) (#ls;SeqP leftP rightP) - (do macro;Monad + (do meta;Monad [leftI (generate-pattern' stack-depth @else @end leftP) rightI (generate-pattern' stack-depth @else @end rightP)] (wrap (|>. leftI rightI))) (#ls;AltP leftP rightP) - (do macro;Monad + (do meta;Monad [@alt-else $i;make-label leftI (generate-pattern' (n.inc stack-depth) @alt-else @end leftP) rightI (generate-pattern' stack-depth @else @end rightP)] @@ -186,8 +186,8 @@ )) (def: (generate-pattern path @end) - (-> ls;Path $;Label (Lux $;Inst)) - (do macro;Monad + (-> ls;Path $;Label (Meta $;Inst)) + (do meta;Monad [@else $i;make-label pathI (generate-pattern' +1 @else @end path)] (wrap (|>. pathI @@ -201,8 +201,8 @@ ($i;GOTO @end))))) (def: #export (generate valueS path) - (-> ls;Synthesis ls;Path (Lux $;Inst)) - (do macro;Monad + (-> ls;Synthesis ls;Path (Meta $;Inst)) + (do meta;Monad [@end $i;make-label valueI (expr;generate valueS) pathI (generate-pattern path @end)] diff --git a/new-luxc/source/luxc/generator/common.jvm.lux b/new-luxc/source/luxc/generator/common.jvm.lux index 054d11098..150e68e4f 100644 --- a/new-luxc/source/luxc/generator/common.jvm.lux +++ b/new-luxc/source/luxc/generator/common.jvm.lux @@ -3,7 +3,7 @@ (lux (control ["ex" exception #+ exception:]) [io] (concurrency ["A" atom]) - (data ["R" result] + (data ["e" error] (coll ["d" dict])) [host]) (luxc (generator (host ["$" jvm] @@ -35,27 +35,27 @@ (exception: No-Function-Being-Compiled) (def: #export (store-class name byte-code) - (-> Text Bytecode (Lux Unit)) + (-> Text Bytecode (Meta Unit)) (;function [compiler] (let [store (|> (get@ #;host compiler) (:! Host) (get@ #store))] (if (d;contains? name (|> store A;get io;run)) (ex;throw Class-Already-Stored name) - (#R;Success [compiler (io;run (A;update (d;put name byte-code) store))]) + (#e;Success [compiler (io;run (A;update (d;put name byte-code) store))]) )))) (def: #export (load-class name) - (-> Text (Lux (Class Object))) + (-> Text (Meta (Class Object))) (;function [compiler] (let [host (:! Host (get@ #;host compiler)) store (|> host (get@ #store) A;get io;run)] (if (d;contains? name store) - (#R;Success [compiler (ClassLoader.loadClass [name] (get@ #loader host))]) + (#e;Success [compiler (ClassLoader.loadClass [name] (get@ #loader host))]) (ex;throw Unknown-Class name))))) (def: #export (with-function class expr) - (All [a] (-> Text (Lux a) (Lux a))) + (All [a] (-> Text (Meta a) (Meta a))) (;function [compiler] (let [host (:! Host (get@ #;host compiler)) old-function-class (get@ #function-class host)] @@ -64,19 +64,19 @@ (#;Some class) host)) compiler)) - (#R;Success [compiler' output]) - (#R;Success [(update@ #;host + (#e;Success [compiler' output]) + (#e;Success [(update@ #;host (|>. (:! Host) (set@ #function-class old-function-class) (:! Void)) compiler') output]) - (#R;Error error) - (#R;Error error))))) + (#e;Error error) + (#e;Error error))))) (def: #export function - (Lux Text) + (Meta Text) (;function [compiler] (let [host (:! Host (get@ #;host compiler))] (case (get@ #function-class host) @@ -84,6 +84,6 @@ (ex;throw No-Function-Being-Compiled "") (#;Some function-class) - (#R;Success [compiler function-class]))))) + (#e;Success [compiler function-class]))))) (def: #export bytecode-version Int Opcodes.V1_6) diff --git a/new-luxc/source/luxc/generator/eval.jvm.lux b/new-luxc/source/luxc/generator/eval.jvm.lux index 4f02dcffb..20c02af4c 100644 --- a/new-luxc/source/luxc/generator/eval.jvm.lux +++ b/new-luxc/source/luxc/generator/eval.jvm.lux @@ -1,9 +1,9 @@ (;module: lux (lux (control monad) - (data ["R" result] + (data ["R" error] text/format) - [macro #+ Monad "Lux/" Monad] + [meta #+ Monad "Meta/" Monad] [host #+ do-to]) (luxc ["&" base] (lang ["la" analysis] @@ -60,9 +60,9 @@ (def: $Object $;Type ($t;class "java.lang.Object" (list))) (def: #export (eval valueI) - (-> $;Inst (Lux Top)) - (do Monad - [class-name (:: @ map %code (macro;gensym "eval")) + (-> $;Inst (Meta Top)) + (do Monad + [class-name (:: @ map %code (meta;gensym "eval")) #let [writer (|> (do-to (ClassWriter.new ClassWriter.COMPUTE_MAXS) (ClassWriter.visit [&common;bytecode-version (i.+ Opcodes.ACC_PUBLIC Opcodes.ACC_SUPER) diff --git a/new-luxc/source/luxc/generator/expr.jvm.lux b/new-luxc/source/luxc/generator/expr.jvm.lux index 6b6c68fde..c7fdcf2af 100644 --- a/new-luxc/source/luxc/generator/expr.jvm.lux +++ b/new-luxc/source/luxc/generator/expr.jvm.lux @@ -2,7 +2,7 @@ lux (lux (control monad) (data text/format) - [macro #+ Monad "Lux/" Monad]) + [meta #+ Monad "Meta/" Monad]) (luxc ["&" base] (lang ["ls" synthesis]) ["&;" analyser] @@ -18,7 +18,7 @@ (host ["$" jvm])))) (def: #export (generate synthesis) - (-> ls;Synthesis (Lux $;Inst)) + (-> ls;Synthesis (Meta $;Inst)) (case synthesis #ls;Unit &primitive;generate-unit @@ -54,11 +54,11 @@ (&procedure;generate-procedure generate name args) _ - (macro;fail "Unrecognized synthesis."))) + (meta;fail "Unrecognized synthesis."))) ## (def: #export (eval type code) -## (-> Type Code (Lux Top)) -## (do Monad +## (-> Type Code (Meta Top)) +## (do Monad ## [analysis (&;with-expected-type leftT ## (&analyser;analyser eval code)) ## #let [synthesis (&synthesizer;synthesize analysis)] @@ -70,8 +70,8 @@ ## (&analyser;analyser eval)) ## (def: #export (generate input) -## (-> Code (Lux Unit)) -## (do Monad +## (-> Code (Meta Unit)) +## (do Monad ## [analysis (analyse input) ## #let [synthesis (&synthesizer;synthesize analysis)]] ## (generate-synthesis synthesis))) diff --git a/new-luxc/source/luxc/generator/function.jvm.lux b/new-luxc/source/luxc/generator/function.jvm.lux index e3582e183..97d3a7c91 100644 --- a/new-luxc/source/luxc/generator/function.jvm.lux +++ b/new-luxc/source/luxc/generator/function.jvm.lux @@ -3,7 +3,7 @@ (lux (control [monad #+ do]) (data text/format (coll [list "list/" Functor Monoid])) - [macro]) + [meta]) (luxc ["&" base] (lang ["la" analysis] ["ls" synthesis]) @@ -268,10 +268,10 @@ )))) (def: #export (with-function generate class env arity body) - (-> (-> ls;Synthesis (Lux $;Inst)) + (-> (-> ls;Synthesis (Meta $;Inst)) Text (List ls;Variable) ls;Arity ls;Synthesis - (Lux [$;Def $;Inst])) - (do macro;Monad + (Meta [$;Def $;Inst])) + (do meta;Monad [@begin $i;make-label bodyI (&common;with-function class (generate body)) #let [env-size (list;size env) @@ -297,11 +297,11 @@ (wrap [functionD instanceI]))) (def: #export (generate-function generate env arity body) - (-> (-> ls;Synthesis (Lux $;Inst)) + (-> (-> ls;Synthesis (Meta $;Inst)) (List ls;Variable) ls;Arity ls;Synthesis - (Lux $;Inst)) - (do macro;Monad - [function-class (:: @ map %code (macro;gensym "function")) + (Meta $;Inst)) + (do meta;Monad + [function-class (:: @ map %code (meta;gensym "function")) [functionD instanceI] (with-function generate function-class env arity body) _ (&common;store-class function-class ($d;class #$;V1.6 #$;Public $;finalC @@ -318,10 +318,10 @@ (list& pre (segment size post))))) (def: #export (generate-call generate functionS argsS) - (-> (-> ls;Synthesis (Lux $;Inst)) + (-> (-> ls;Synthesis (Meta $;Inst)) ls;Synthesis (List ls;Synthesis) - (Lux $;Inst)) - (do macro;Monad + (Meta $;Inst)) + (do meta;Monad [functionI (generate functionS) argsI (monad;map @ generate argsS) #let [applyI (|> (segment &runtime;num-apply-variants argsI) diff --git a/new-luxc/source/luxc/generator/host/jvm.lux b/new-luxc/source/luxc/generator/host/jvm.lux index 4fb3fa77d..c985efc9a 100644 --- a/new-luxc/source/luxc/generator/host/jvm.lux +++ b/new-luxc/source/luxc/generator/host/jvm.lux @@ -3,9 +3,9 @@ (lux (control monad ["p" parser]) (data (coll [list "list/" Functor])) - [macro] - (macro [code] - ["s" syntax #+ syntax:]) + [meta] + (meta [code] + ["s" syntax #+ syntax:]) [host])) ## [Host] diff --git a/new-luxc/source/luxc/generator/host/jvm/def.lux b/new-luxc/source/luxc/generator/host/jvm/def.lux index 7dd78ceb3..1d50ba9f6 100644 --- a/new-luxc/source/luxc/generator/host/jvm/def.lux +++ b/new-luxc/source/luxc/generator/host/jvm/def.lux @@ -60,7 +60,7 @@ ## [Defs] (def: (string-array values) - (-> (List Text) (a;Array Text)) + (-> (List Text) (Array Text)) (let [output (host;array String (list;size values))] (exec (list/map (function [[idx value]] (host;array-write idx value output)) @@ -68,7 +68,7 @@ output))) (def: exceptions-array - (-> $;Method (a;Array Text)) + (-> $;Method (Array Text)) (|>. (get@ #$;exceptions) (list/map (|>. #$;Generic $t;descriptor)) string-array)) diff --git a/new-luxc/source/luxc/generator/host/jvm/inst.lux b/new-luxc/source/luxc/generator/host/jvm/inst.lux index d5df6a9f7..1951076c3 100644 --- a/new-luxc/source/luxc/generator/host/jvm/inst.lux +++ b/new-luxc/source/luxc/generator/host/jvm/inst.lux @@ -3,12 +3,12 @@ (lux (control monad ["p" parser]) (data [maybe] - ["R" result] + ["e" error] text/format (coll [list "L/" Functor])) [host #+ do-to] - [macro] - (macro [code] + [meta] + (meta [code] ["s" syntax #+ syntax:])) ["$" ..] (.. ["$t" type])) @@ -115,9 +115,9 @@ ## [Insts] (def: #export make-label - (Lux Label) + (Meta Label) (function [compiler] - (#R;Success [compiler (Label.new [])]))) + (#e;Success [compiler (Label.new [])]))) (def: #export (with-label action) (-> (-> Label $;Inst) $;Inst) diff --git a/new-luxc/source/luxc/generator/primitive.jvm.lux b/new-luxc/source/luxc/generator/primitive.jvm.lux index a63aa8596..fc6ffae1f 100644 --- a/new-luxc/source/luxc/generator/primitive.jvm.lux +++ b/new-luxc/source/luxc/generator/primitive.jvm.lux @@ -2,7 +2,7 @@ lux (lux (control monad) (data text/format) - [macro #+ Monad "Lux/" Monad]) + [meta #+ Monad "Meta/" Monad]) (luxc ["&" base] (lang ["la" analysis] ["ls" synthesis]) @@ -15,19 +15,19 @@ [../runtime]) (def: #export generate-unit - (Lux $;Inst) - (Lux/wrap ($i;string ../runtime;unit))) + (Meta $;Inst) + (Meta/wrap ($i;string ../runtime;unit))) (def: #export (generate-bool value) - (-> Bool (Lux $;Inst)) - (Lux/wrap ($i;GETSTATIC "java.lang.Boolean" - (if value "TRUE" "FALSE") - ($t;class "java.lang.Boolean" (list))))) + (-> Bool (Meta $;Inst)) + (Meta/wrap ($i;GETSTATIC "java.lang.Boolean" + (if value "TRUE" "FALSE") + ($t;class "java.lang.Boolean" (list))))) (do-template [ ] [(def: #export ( value) - (-> (Lux $;Inst)) - (Lux/wrap (|>. ( value) )))] + (-> (Meta $;Inst)) + (Meta/wrap (|>. ( value) )))] [generate-nat Nat (|>. (:! Int) $i;long) ($i;wrap #$;Long)] [generate-int Int $i;long ($i;wrap #$;Long)] diff --git a/new-luxc/source/luxc/generator/procedure.jvm.lux b/new-luxc/source/luxc/generator/procedure.jvm.lux index c564a668a..cc10e45aa 100644 --- a/new-luxc/source/luxc/generator/procedure.jvm.lux +++ b/new-luxc/source/luxc/generator/procedure.jvm.lux @@ -1,4 +1,3 @@ - (;module: lux (lux (control [monad #+ do]) @@ -17,8 +16,8 @@ (dict;merge ./host;procedures))) (def: #export (generate-procedure generate name args) - (-> (-> ls;Synthesis (Lux $;Inst)) Text (List ls;Synthesis) - (Lux $;Inst)) + (-> (-> ls;Synthesis (Meta $;Inst)) Text (List ls;Synthesis) + (Meta $;Inst)) (<| (maybe;default (&;fail (format "Unknown procedure: " (%t name)))) (do maybe;Monad [proc (dict;get name procedures)] diff --git a/new-luxc/source/luxc/generator/procedure/common.jvm.lux b/new-luxc/source/luxc/generator/procedure/common.jvm.lux index e3a46a9ea..48a820663 100644 --- a/new-luxc/source/luxc/generator/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/generator/procedure/common.jvm.lux @@ -5,9 +5,9 @@ text/format (coll [list "list/" Functor] [dict #+ Dict])) - [macro #+ with-gensyms] - (macro [code] - ["s" syntax #+ syntax:]) + [meta #+ with-gensyms] + (meta [code] + ["s" syntax #+ syntax:]) [host]) (luxc ["&" base] (lang ["la" analysis] @@ -35,10 +35,10 @@ ## [Types] (type: #export Generator - (-> ls;Synthesis (Lux $;Inst))) + (-> ls;Synthesis (Meta $;Inst))) (type: #export Proc - (-> Generator (List ls;Synthesis) (Lux $;Inst))) + (-> Generator (List ls;Synthesis) (Meta $;Inst))) (type: #export Bundle (Dict Text Proc)) @@ -79,7 +79,7 @@ (syntax: (arity: [name s;local-symbol] [arity s;nat]) (with-gensyms [g!proc g!name g!generate g!inputs] (do @ - [g!input+ (monad;seq @ (list;repeat arity (macro;gensym "input")))] + [g!input+ (monad;seq @ (list;repeat arity (meta;gensym "input")))] (wrap (list (` (def: #export ((~ (code;local-symbol name)) (~ g!proc)) (-> (-> (;;Vector (~ (code;nat arity)) $;Inst) $;Inst) (-> Text ;;Proc)) @@ -87,7 +87,7 @@ (function [(~ g!generate) (~ g!inputs)] (case (~ g!inputs) (^ (list (~@ g!input+))) - (do macro;Monad + (do meta;Monad [(~@ (|> g!input+ (list/map (function [g!input] (list g!input (` ((~ g!generate) (~ g!input)))))) @@ -95,7 +95,7 @@ ((~' wrap) ((~ g!proc) [(~@ g!input+)]))) (~' _) - (macro;fail (wrong-arity (~ g!name) +1 (list;size (~ g!inputs)))))))))))))) + (meta;fail (wrong-arity (~ g!name) +1 (list;size (~ g!inputs)))))))))))))) (arity: nullary +0) (arity: unary +1) diff --git a/new-luxc/source/luxc/generator/procedure/host.jvm.lux b/new-luxc/source/luxc/generator/procedure/host.jvm.lux index d99694554..f754422c3 100644 --- a/new-luxc/source/luxc/generator/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/generator/procedure/host.jvm.lux @@ -5,9 +5,9 @@ text/format (coll [list "list/" Functor] [dict #+ Dict])) - [macro #+ with-gensyms] - (macro [code] - ["s" syntax #+ syntax:]) + [meta #+ with-gensyms] + (meta [code] + ["s" syntax #+ syntax:]) [host]) (luxc ["&" base] (lang ["la" analysis] @@ -273,7 +273,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Nat level) (#ls;Text class) lengthS)) - (do macro;Monad + (do meta;Monad [lengthI (generate lengthS) #let [arrayJT ($t;array level (case class "boolean" $t;boolean @@ -297,7 +297,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class) idxS arrayS)) - (do macro;Monad + (do meta;Monad [arrayI (generate arrayS) idxI (generate idxS) #let [loadI (case class @@ -323,7 +323,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class) idxS valueS arrayS)) - (do macro;Monad + (do meta;Monad [arrayI (generate arrayS) idxI (generate idxS) valueI (generate valueS) @@ -392,7 +392,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class))) - (do macro;Monad + (do meta;Monad [] (wrap (|>. ($i;string class) ($i;INVOKESTATIC "java.lang.Class" "forName" @@ -408,7 +408,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class) objectS)) - (do macro;Monad + (do meta;Monad [objectI (generate objectS)] (wrap (|>. objectI ($i;INSTANCEOF class) @@ -445,7 +445,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class) (#ls;Text field) (#ls;Text unboxed))) - (do macro;Monad + (do meta;Monad [] (case (dict;get unboxed primitives) (#;Some primitive) @@ -472,7 +472,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class) (#ls;Text field) (#ls;Text unboxed) valueS)) - (do macro;Monad + (do meta;Monad [valueI (generate valueS)] (case (dict;get unboxed primitives) (#;Some primitive) @@ -504,7 +504,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class) (#ls;Text field) (#ls;Text unboxed) objectS)) - (do macro;Monad + (do meta;Monad [objectI (generate objectS)] (case (dict;get unboxed primitives) (#;Some primitive) @@ -535,7 +535,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class) (#ls;Text field) (#ls;Text unboxed) valueS objectS)) - (do macro;Monad + (do meta;Monad [valueI (generate valueS) objectI (generate objectS)] (case (dict;get unboxed primitives) diff --git a/new-luxc/source/luxc/generator/reference.jvm.lux b/new-luxc/source/luxc/generator/reference.jvm.lux index 28c936036..063994bac 100644 --- a/new-luxc/source/luxc/generator/reference.jvm.lux +++ b/new-luxc/source/luxc/generator/reference.jvm.lux @@ -2,7 +2,7 @@ lux (lux (control [monad #+ do]) (data text/format) - [macro "lux/" Monad]) + [meta "meta/" Monad]) (luxc (lang ["ls" synthesis]) (generator [";G" common] [";G" function] @@ -13,8 +13,8 @@ (def: $Object $;Type ($t;class "java.lang.Object" (list))) (def: #export (generate-captured variable) - (-> ls;Variable (Lux $;Inst)) - (do macro;Monad + (-> ls;Variable (Meta $;Inst)) + (do meta;Monad [function-class commonG;function] (wrap (|>. ($i;ALOAD +0) ($i;GETFIELD function-class @@ -22,5 +22,5 @@ $Object))))) (def: #export (generate-variable variable) - (-> ls;Variable (Lux $;Inst)) - (lux/wrap ($i;ALOAD (int-to-nat variable)))) + (-> ls;Variable (Meta $;Inst)) + (meta/wrap ($i;ALOAD (int-to-nat variable)))) diff --git a/new-luxc/source/luxc/generator/runtime.jvm.lux b/new-luxc/source/luxc/generator/runtime.jvm.lux index 4c8784364..32e792638 100644 --- a/new-luxc/source/luxc/generator/runtime.jvm.lux +++ b/new-luxc/source/luxc/generator/runtime.jvm.lux @@ -1,11 +1,11 @@ (;module: lux (lux (control monad) - (data ["R" result] + (data ["R" error] text/format (coll [list "L/" Functor])) [math] - [macro #+ Monad "Lux/" Monad] + [meta #+ Monad "Meta/" Monad] [host #+ do-to]) (luxc ["&" base] (lang ["la" analysis] @@ -448,8 +448,8 @@ ))) (def: generate-runtime - (Lux &common;Bytecode) - (do Monad + (Meta &common;Bytecode) + (do Monad [_ (wrap []) #let [bytecode ($d;class #$;V1.6 #$;Public $;finalC runtime-class (list) ["java.lang.Object" (list)] (list) (|>. adt-methods @@ -469,8 +469,8 @@ ($t;method (list;repeat arity $Object) (#;Some $Object) (list))) (def: generate-function - (Lux &common;Bytecode) - (do Monad + (Meta &common;Bytecode) + (do Monad [_ (wrap []) #let [applyI (|> (list;n.range +2 num-apply-variants) (L/map (function [arity] @@ -504,8 +504,8 @@ (wrap bytecode))) (def: #export generate - (Lux Unit) - (do Monad + (Meta Unit) + (do Monad [_ generate-runtime _ generate-function] (wrap []))) diff --git a/new-luxc/source/luxc/generator/statement.jvm.lux b/new-luxc/source/luxc/generator/statement.jvm.lux index b091a2f37..ed66f3ecb 100644 --- a/new-luxc/source/luxc/generator/statement.jvm.lux +++ b/new-luxc/source/luxc/generator/statement.jvm.lux @@ -4,22 +4,22 @@ [io #- run] (data [text "T/" Eq] text/format) - [macro #+ Monad]) + [meta #+ Monad]) (luxc ["&" base] ["&;" module] ["&;" scope] (compiler ["&;" expr]))) (def: #export (compile-def def-name def-value def-meta) - (-> Text Code Code (Lux Unit)) - (do Monad + (-> Text Code Code (Meta Unit)) + (do Monad [=def-value (&expr;compile def-value) =def-meta (&expr;compile def-meta)] (undefined))) (def: #export (compile-program prog-args prog-body) - (-> Text Code (Lux Unit)) - (do Monad + (-> Text Code (Meta Unit)) + (do Monad [=prog-body (&scope;with-local [prog-args (type (List Text))] (&expr;compile prog-body))] (undefined))) diff --git a/new-luxc/source/luxc/generator/structure.jvm.lux b/new-luxc/source/luxc/generator/structure.jvm.lux index 6aca0dca1..cee5800cd 100644 --- a/new-luxc/source/luxc/generator/structure.jvm.lux +++ b/new-luxc/source/luxc/generator/structure.jvm.lux @@ -1,10 +1,9 @@ - (;module: lux (lux (control [monad #+ do]) (data text/format (coll [list])) - [macro #+ Monad "Lux/" Monad] + [meta #+ Monad "Meta/" Monad] [host #+ do-to]) (luxc ["&" base] (lang ["la" analysis] @@ -21,8 +20,8 @@ (def: $Object $;Type ($t;class "java.lang.Object" (list))) (def: #export (generate-tuple generate members) - (-> (-> ls;Synthesis (Lux $;Inst)) (List ls;Synthesis) (Lux $;Inst)) - (do Monad + (-> (-> ls;Synthesis (Meta $;Inst)) (List ls;Synthesis) (Meta $;Inst)) + (do Monad [#let [size (list;size members)] _ (&;assert "Cannot generate tuples with less than 2 elements." (n.>= +2 size)) @@ -47,8 +46,8 @@ $i;NULL)) (def: #export (generate-variant generate tag tail? member) - (-> (-> ls;Synthesis (Lux $;Inst)) Nat Bool ls;Synthesis (Lux $;Inst)) - (do Monad + (-> (-> ls;Synthesis (Meta $;Inst)) Nat Bool ls;Synthesis (Meta $;Inst)) + (do Monad [memberI (generate member)] (wrap (|>. ($i;int (nat-to-int tag)) (flagI tail?) -- cgit v1.2.3