diff options
Diffstat (limited to '')
17 files changed, 173 insertions, 175 deletions
diff --git a/new-luxc/source/luxc/generator.lux b/new-luxc/source/luxc/generator.lux index 00a50fbed..107b2f3f9 100644 --- a/new-luxc/source/luxc/generator.lux +++ b/new-luxc/source/luxc/generator.lux @@ -3,12 +3,12 @@ (lux (control monad) (concurrency ["A" atom] ["P" promise]) - (data ["R" result] + (data ["e" error] [text "T/" Hash<Text>] text/format (coll ["D" dict] - [array #+ Array])) - [macro #+ Monad<Lux>] + [array])) + [meta #+ Monad<Meta>] [host] [io]) (luxc ["&" base] @@ -22,7 +22,7 @@ )) (def: (compile ast) - (-> Code (Lux Unit)) + (-> Code (Meta Unit)) (case ast (^ [_ (#;Form (list [_ (#;Symbol ["" "_lux_def"])] [_ (#;Symbol ["" def-name])] @@ -39,16 +39,16 @@ (&;fail (format "Unrecognized statement: " (%code ast))))) (def: (exhaust action) - (All [a] (-> (Lux a) (Lux Unit))) - (do Monad<Lux> + (All [a] (-> (Meta a) (Meta Unit))) + (do Monad<Meta> [result action] (exhaust action))) (def: (ensure-new-module! file-hash module-name) - (-> Nat Text (Lux Unit)) - (do Monad<Lux> - [module-exists? (macro;module-exists? module-name) - _ (: (Lux Unit) + (-> Nat Text (Meta Unit)) + (do Monad<Meta> + [module-exists? (meta;module-exists? module-name) + _ (: (Meta Unit) (if module-exists? (&;fail (format "Cannot re-define a module: " module-name)) (wrap []))) @@ -58,8 +58,8 @@ (def: prelude Text "lux") (def: (with-active-compilation [module-name file-name source-code] action) - (All [a] (-> [Text Text Text] (Lux a) (Lux a))) - (do Monad<Lux> + (All [a] (-> [Text Text Text] (Meta a) (Meta a))) + (do Monad<Meta> [_ (ensure-new-module! (T/hash source-code) module-name) #let [init-cursor [file-name +0 +0]] output (&;with-source-code [init-cursor source-code] @@ -68,23 +68,23 @@ (wrap output))) (def: parse - (Lux Code) + (Meta Code) (function [compiler] (case (&parser;parse (get@ #;source compiler)) - (#R;Error error) - (#R;Error error) + (#e;Error error) + (#e;Error error) - (#R;Success [source' output]) - (#R;Success [(set@ #;source source' compiler) + (#e;Success [source' output]) + (#e;Success [(set@ #;source source' compiler) output])))) (def: (compile-module source-dirs module-name compiler) - (-> (List &;Path) Text Compiler (P;Promise (R;Result Compiler))) + (-> (List &;Path) Text Compiler (P;Promise (e;Error Compiler))) (do P;Monad<Promise> [?input (&io;read-module source-dirs module-name)] (case ?input - (#R;Success [file-name file-content]) - (let [compilation (do Monad<Lux> + (#e;Success [file-name file-content]) + (let [compilation (do Monad<Meta> [_ (with-active-compilation [module-name file-name file-content] @@ -95,18 +95,18 @@ (wrap []) ## (&module;generate-descriptor module-name) )] - (case (macro;run' compiler compilation) - (#R;Success [compiler module-descriptor]) + (case (meta;run' compiler compilation) + (#e;Success [compiler module-descriptor]) (do @ [## _ (&io;write-module module-name module-descriptor) ] - (wrap (#R;Success compiler))) + (wrap (#e;Success compiler))) - (#R;Error error) - (wrap (#R;Error error)))) + (#e;Error error) + (wrap (#e;Error error)))) - (#R;Error error) - (wrap (#R;Error error))))) + (#e;Error error) + (wrap (#e;Error error))))) (host;import org.objectweb.asm.MethodVisitor) @@ -118,15 +118,15 @@ #;var-counter +0 #;var-bindings (list)}) -(def: #export init-compiler-info - Compiler-Info - {#;compiler-name "Lux/JVM" - #;compiler-version &;compiler-version - #;compiler-mode #;Build}) +(def: #export init-info + Info + {#;target "JVM" + #;version &;version + #;mode #;Build}) (def: #export (init-compiler host) (-> &&common;Host Compiler) - {#;info init-compiler-info + {#;info init-info #;source [init-cursor ""] #;cursor init-cursor #;modules (list) @@ -138,14 +138,14 @@ #;host (:! Void host)}) (def: (or-crash! action) - (All [a] (-> (P;Promise (R;Result a)) (P;Promise a))) + (All [a] (-> (P;Promise (e;Error a)) (P;Promise a))) (do P;Monad<Promise> [?output action] (case ?output - (#R;Error error) + (#e;Error error) (error! error) - (#R;Success output) + (#e;Success output) (wrap output)))) (def: #export (compile-program program target sources) 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<Lux>]) + [meta "meta/" Monad<Meta>]) (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<Lux> + (do meta;Monad<Meta> [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 [<tag> <prep>] (<tag> value) - (lux/wrap (|>. peekI - ($i;unwrap #$;Long) - ($i;long (|> value <prep>)) - $i;LCMP - ($i;IFNE @else)))) + (meta/wrap (|>. peekI + ($i;unwrap #$;Long) + ($i;long (|> value <prep>)) + $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<Lux> + (do meta;Monad<Meta> [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<Lux> + (do meta;Monad<Meta> [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<Lux> + (do meta;Monad<Meta> [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<Lux> + (do meta;Monad<Meta> [@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<Lux> + (-> ls;Path $;Label (Meta $;Inst)) + (do meta;Monad<Meta> [@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<Lux> + (-> ls;Synthesis ls;Path (Meta $;Inst)) + (do meta;Monad<Meta> [@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> "Lux/" Monad<Lux>] + [meta #+ Monad<Meta> "Meta/" Monad<Meta>] [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<Lux> - [class-name (:: @ map %code (macro;gensym "eval")) + (-> $;Inst (Meta Top)) + (do Monad<Meta> + [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> "Lux/" Monad<Lux>]) + [meta #+ Monad<Meta> "Meta/" Monad<Meta>]) (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<Lux> +## (-> Type Code (Meta Top)) +## (do Monad<Meta> ## [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<Lux> +## (-> Code (Meta Unit)) +## (do Monad<Meta> ## [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<List> Monoid<List>])) - [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<Lux> + (Meta [$;Def $;Inst])) + (do meta;Monad<Meta> [@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<Lux> - [function-class (:: @ map %code (macro;gensym "function")) + (Meta $;Inst)) + (do meta;Monad<Meta> + [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<Lux> + (Meta $;Inst)) + (do meta;Monad<Meta> [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<List>])) - [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<List>])) [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> "Lux/" Monad<Lux>]) + [meta #+ Monad<Meta> "Meta/" Monad<Meta>]) (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 [<name> <type> <load> <wrap>] [(def: #export (<name> value) - (-> <type> (Lux $;Inst)) - (Lux/wrap (|>. (<load> value) <wrap>)))] + (-> <type> (Meta $;Inst)) + (Meta/wrap (|>. (<load> value) <wrap>)))] [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<Maybe> [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<List>] [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<Lux> + (do meta;Monad<Meta> [(~@ (|> 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<List>] [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<Lux> + (do meta;Monad<Meta> [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<Lux> + (do meta;Monad<Meta> [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<Lux> + (do meta;Monad<Meta> [arrayI (generate arrayS) idxI (generate idxS) valueI (generate valueS) @@ -392,7 +392,7 @@ (-> Text @;Proc) (case inputs (^ (list (#ls;Text class))) - (do macro;Monad<Lux> + (do meta;Monad<Meta> [] (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<Lux> + (do meta;Monad<Meta> [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<Lux> + (do meta;Monad<Meta> [] (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<Lux> + (do meta;Monad<Meta> [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<Lux> + (do meta;Monad<Meta> [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<Lux> + (do meta;Monad<Meta> [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<Lux>]) + [meta "meta/" Monad<Meta>]) (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<Lux> + (-> ls;Variable (Meta $;Inst)) + (do meta;Monad<Meta> [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<List>])) [math] - [macro #+ Monad<Lux> "Lux/" Monad<Lux>] + [meta #+ Monad<Meta> "Meta/" Monad<Meta>] [host #+ do-to]) (luxc ["&" base] (lang ["la" analysis] @@ -448,8 +448,8 @@ ))) (def: generate-runtime - (Lux &common;Bytecode) - (do Monad<Lux> + (Meta &common;Bytecode) + (do Monad<Meta> [_ (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<Lux> + (Meta &common;Bytecode) + (do Monad<Meta> [_ (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<Lux> + (Meta Unit) + (do Monad<Meta> [_ 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>] text/format) - [macro #+ Monad<Lux>]) + [meta #+ Monad<Meta>]) (luxc ["&" base] ["&;" module] ["&;" scope] (compiler ["&;" expr]))) (def: #export (compile-def def-name def-value def-meta) - (-> Text Code Code (Lux Unit)) - (do Monad<Lux> + (-> Text Code Code (Meta Unit)) + (do Monad<Meta> [=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<Lux> + (-> Text Code (Meta Unit)) + (do Monad<Meta> [=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> "Lux/" Monad<Lux>] + [meta #+ Monad<Meta> "Meta/" Monad<Meta>] [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<Lux> + (-> (-> ls;Synthesis (Meta $;Inst)) (List ls;Synthesis) (Meta $;Inst)) + (do Monad<Meta> [#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<Lux> + (-> (-> ls;Synthesis (Meta $;Inst)) Nat Bool ls;Synthesis (Meta $;Inst)) + (do Monad<Meta> [memberI (generate member)] (wrap (|>. ($i;int (nat-to-int tag)) (flagI tail?) |