diff options
Diffstat (limited to 'new-luxc/source/luxc/lang')
36 files changed, 368 insertions, 368 deletions
diff --git a/new-luxc/source/luxc/lang/analysis.lux b/new-luxc/source/luxc/lang/analysis.lux index 03e4c867f..f6163feb1 100644 --- a/new-luxc/source/luxc/lang/analysis.lux +++ b/new-luxc/source/luxc/lang/analysis.lux @@ -2,7 +2,7 @@ lux (lux [function] (data (coll [list "list/" Fold<List>])) - (meta [code])) + (macro [code])) (luxc (lang [";L" variable #+ Variable]))) (type: #export Pattern Code) diff --git a/new-luxc/source/luxc/lang/analysis/case.lux b/new-luxc/source/luxc/lang/analysis/case.lux index 69a975b52..5d4c592aa 100644 --- a/new-luxc/source/luxc/lang/analysis/case.lux +++ b/new-luxc/source/luxc/lang/analysis/case.lux @@ -11,8 +11,8 @@ [text] text/format (coll [list "list/" Fold<List> Monoid<List> Functor<List>])) - [meta] - (meta [code]) + [macro] + (macro [code]) (lang [type] (type ["tc" check]))) (luxc ["&" lang] @@ -46,7 +46,7 @@ (-> Type (Meta Type)) (case caseT (#;Var id) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [?caseT' (&;with-type-env (tc;read id))] (case ?caseT' @@ -60,7 +60,7 @@ (simplify-case-type unnamedT) (^or (#;UnivQ _) (#;ExQ _)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[ex-id exT] (&;with-type-env tc;existential)] (simplify-case-type (maybe;assume (type;apply (list exT) caseT)))) @@ -68,7 +68,7 @@ (#;Apply inputT funcT) (case funcT (#;Var funcT-id) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [funcT' (&;with-type-env (do tc;Monad<Check> [?funct' (tc;read funcT-id)] @@ -83,13 +83,13 @@ _ (case (type;apply (list inputT) funcT) (#;Some outputT) - (:: meta;Monad<Meta> wrap outputT) + (:: macro;Monad<Meta> wrap outputT) #;None (&;throw Cannot-Simplify-Type-For-Pattern-Matching (%type caseT)))) _ - (:: meta;Monad<Meta> wrap caseT))) + (:: macro;Monad<Meta> wrap caseT))) ## This function handles several concerns at once, but it must be that ## way because those concerns are interleaved when doing @@ -112,7 +112,7 @@ (case pattern [cursor (#;Symbol ["" name])] (&;with-cursor cursor - (do meta;Monad<Meta> + (do macro;Monad<Meta> [outputA (&scope;with-local [name inputT] next) idx &scope;next-local] @@ -125,7 +125,7 @@ (^template [<type> <code-tag>] [cursor (<code-tag> test)] (&;with-cursor cursor - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;with-type-env (tc;check inputT <type>)) outputA next] @@ -139,7 +139,7 @@ (^ [cursor (#;Tuple (list))]) (&;with-cursor cursor - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;with-type-env (tc;check inputT Unit)) outputA next] @@ -150,7 +150,7 @@ [cursor (#;Tuple sub-patterns)] (&;with-cursor cursor - (do meta;Monad<Meta> + (do macro;Monad<Meta> [inputT' (simplify-case-type inputT)] (case inputT' (#;Product _) @@ -191,7 +191,7 @@ ))) [cursor (#;Record record)] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [record (structureA;normalize record) [members recordT] (structureA;order record) _ (&;with-type-env @@ -204,7 +204,7 @@ (^ [cursor (#;Form (list& [_ (#;Nat idx)] values))]) (&;with-cursor cursor - (do meta;Monad<Meta> + (do macro;Monad<Meta> [inputT' (simplify-case-type inputT)] (case inputT' (#;Sum _) @@ -216,14 +216,14 @@ (n.< num-cases idx)) (if (and (n.> num-cases size-sum) (n.= (n.dec num-cases) idx)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[testP nextA] (analyse-pattern #;None (type;variant (list;drop (n.dec num-cases) flat-sum)) (` [(~@ values)]) next)] (wrap [(` ("lux case variant" (~ (code;nat idx)) (~ (code;nat num-cases)) (~ testP))) nextA])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[testP nextA] (analyse-pattern #;None case-type (` [(~@ values)]) next)] (wrap [(` ("lux case variant" (~ (code;nat idx)) (~ (code;nat num-cases)) (~ testP))) nextA]))) @@ -238,9 +238,9 @@ (^ [cursor (#;Form (list& [_ (#;Tag tag)] values))]) (&;with-cursor cursor - (do meta;Monad<Meta> - [tag (meta;normalize tag) - [idx group variantT] (meta;resolve-tag tag) + (do macro;Monad<Meta> + [tag (macro;normalize tag) + [idx group variantT] (macro;resolve-tag tag) _ (&;with-type-env (tc;check inputT variantT))] (analyse-pattern (#;Some (list;size group)) inputT (` ((~ (code;nat idx)) (~@ values))) next))) @@ -256,7 +256,7 @@ (&;throw Cannot-Have-Empty-Branches "") (#;Cons [patternH bodyH] branchesT) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[inputT inputA] (commonA;with-unknown-type (analyse inputC)) outputH (analyse-pattern #;None inputT patternH (analyse bodyH)) diff --git a/new-luxc/source/luxc/lang/analysis/case/coverage.lux b/new-luxc/source/luxc/lang/analysis/case/coverage.lux index c41cfb2a4..283e21d02 100644 --- a/new-luxc/source/luxc/lang/analysis/case/coverage.lux +++ b/new-luxc/source/luxc/lang/analysis/case/coverage.lux @@ -9,7 +9,7 @@ text/format (coll [list "list/" Fold<List>] [dict #+ Dict])) - [meta "meta/" Monad<Meta>]) + [macro "macro/" Monad<Meta>]) (luxc ["&" lang] (lang ["la" analysis]))) @@ -52,7 +52,7 @@ ## Unit [] amounts to exhaustive coverage because there is only one ## possible value, so matching against it covers all cases. (^or (^code ("lux case bind" (~ _))) (^code ("lux case tuple" []))) - (meta/wrap #Exhaustive) + (macro/wrap #Exhaustive) (^code ("lux case tuple" [(~ singleton)])) (determine singleton) @@ -61,13 +61,13 @@ ## are too many possibilities as far as values go. (^or [_ (#;Nat _)] [_ (#;Int _)] [_ (#;Deg _)] [_ (#;Frac _)] [_ (#;Text _)]) - (meta/wrap #Partial) + (macro/wrap #Partial) ## Bools are the exception, since there is only "true" and ## "false", which means it is possible for boolean ## pattern-matching to become exhaustive if complementary parts meet. [_ (#;Bool value)] - (meta/wrap (#Bool value)) + (macro/wrap (#Bool value)) ## Tuple patterns can be exhaustive if there is exhaustiveness for all of ## their sub-patterns. @@ -75,10 +75,10 @@ (loop [subs subs] (case subs #;Nil - (meta/wrap #Exhaustive) + (macro/wrap #Exhaustive) (#;Cons sub subs') - (do meta;Monad<Meta> + (do macro;Monad<Meta> [pre (determine sub) post (recur subs')] (if (exhaustive? post) @@ -88,7 +88,7 @@ ## Variant patterns can be shown to be exhaustive if all the possible ## cases are handled exhaustively. (^code ("lux case variant" (~ [_ (#;Nat tag-id)]) (~ [_ (#;Nat num-tags)]) (~ sub))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [=sub (determine sub)] (wrap (#Variant num-tags (|> (dict;new number;Hash<Nat>) diff --git a/new-luxc/source/luxc/lang/analysis/common.lux b/new-luxc/source/luxc/lang/analysis/common.lux index b67e8e268..c1a2a4f5b 100644 --- a/new-luxc/source/luxc/lang/analysis/common.lux +++ b/new-luxc/source/luxc/lang/analysis/common.lux @@ -4,7 +4,7 @@ ["ex" exception #+ exception:]) (data text/format [product]) - [meta] + [macro] (lang [type] (type ["tc" check]))) (luxc ["&" lang] @@ -12,7 +12,7 @@ (def: #export (with-unknown-type action) (All [a] (-> (Meta a) (Meta [Type a]))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[_ varT] (&;with-type-env tc;var) analysis (&;with-type varT action) diff --git a/new-luxc/source/luxc/lang/analysis/expression.lux b/new-luxc/source/luxc/lang/analysis/expression.lux index 98addd197..5157848ec 100644 --- a/new-luxc/source/luxc/lang/analysis/expression.lux +++ b/new-luxc/source/luxc/lang/analysis/expression.lux @@ -5,7 +5,7 @@ (data ["e" error] [product] text/format) - [meta] + [macro] (lang [type] (type ["tc" check])) [host]) @@ -30,8 +30,8 @@ (-> &;Eval &;Analyser) (: (-> Code (Meta la;Analysis)) (function analyse [ast] - (do meta;Monad<Meta> - [expectedT meta;expected-type] + (do macro;Monad<Meta> + [expectedT macro;expected-type] (let [[cursor ast'] ast] ## The cursor must be set in the compiler for the sake ## of having useful error messages. @@ -82,14 +82,14 @@ (structureA;analyse-tagged-sum analyse tag (' [])) (^ (#;Form (list& func args))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[funcT =func] (commonA;with-unknown-type (analyse func))] (case =func [_ (#;Symbol def-name)] (do @ - [[def-type def-anns def-value] (meta;find-def def-name)] - (if (meta;macro? def-anns) + [[def-type def-anns def-value] (macro;find-def def-name)] + (if (macro;macro? def-anns) (do @ [expansion (function [compiler] (case (macroH;expand (:! Macro def-value) args compiler) diff --git a/new-luxc/source/luxc/lang/analysis/function.lux b/new-luxc/source/luxc/lang/analysis/function.lux index 7f2787e6f..a2aa95c08 100644 --- a/new-luxc/source/luxc/lang/analysis/function.lux +++ b/new-luxc/source/luxc/lang/analysis/function.lux @@ -6,8 +6,8 @@ [text] text/format (coll [list "list/" Fold<List> Monoid<List> Monad<List>])) - [meta] - (meta [code]) + [macro] + (macro [code]) (lang [type] (type ["tc" check]))) (luxc ["&" lang] @@ -23,8 +23,8 @@ ## [Analysers] (def: #export (analyse-function analyse func-name arg-name body) (-> &;Analyser Text Text Code (Meta Analysis)) - (do meta;Monad<Meta> - [functionT meta;expected-type] + (do macro;Monad<Meta> + [functionT macro;expected-type] (loop [expectedT functionT] (&;with-stacked-errors (function [_] (Invalid-Function-Type (%type expectedT))) @@ -94,6 +94,6 @@ (list/map (function [[idx argC]] (format "\n " (%n idx) " " (%code argC)))) (text;join-with ""))))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[applyT argsA] (&inference;general analyse funcT args)] (wrap (la;apply argsA funcA))))) diff --git a/new-luxc/source/luxc/lang/analysis/inference.lux b/new-luxc/source/luxc/lang/analysis/inference.lux index 910d5093a..c6f0323f7 100644 --- a/new-luxc/source/luxc/lang/analysis/inference.lux +++ b/new-luxc/source/luxc/lang/analysis/inference.lux @@ -6,7 +6,7 @@ [text] text/format (coll [list "list/" Functor<List>])) - [meta "meta/" Monad<Meta>] + [macro "macro/" Monad<Meta>] (lang [type] (type ["tc" check]))) (luxc ["&" lang] @@ -71,7 +71,7 @@ (-> &;Analyser Type (List Code) (Meta [Type (List Analysis)])) (case args #;Nil - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer inferT)] (wrap [inferT (list)])) @@ -81,12 +81,12 @@ (general analyse unnamedT args) (#;UnivQ _) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var)] (general analyse (maybe;assume (type;apply (list varT) inferT)) args)) (#;ExQ _) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[ex-id exT] (&;with-type-env tc;existential)] (general analyse (maybe;assume (type;apply (list exT) inferT)) args)) @@ -107,7 +107,7 @@ ## avoided in Lux code, since the inference algorithm can piece ## things together more easily. (#;Function inputT outputT) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[outputT' args'A] (general analyse outputT args') argA (&;with-stacked-errors (function [_] (Cannot-Infer-Argument @@ -118,7 +118,7 @@ (wrap [outputT' (list& argA args'A)])) (#;Var infer-id) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [?inferT' (&;with-type-env (tc;read infer-id))] (case ?inferT' (#;Some inferT') @@ -140,14 +140,14 @@ (^template [<tag>] (<tag> env bodyT) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [bodyT+ (record bodyT)] (wrap (<tag> env bodyT+)))) ([#;UnivQ] [#;ExQ]) (#;Product _) - (meta/wrap (type;function (type;flatten-tuple type) type)) + (macro/wrap (type;function (type;flatten-tuple type) type)) _ (&;throw Not-A-Record-Type (%type type)))) @@ -159,13 +159,13 @@ currentT type] (case currentT (#;Named name unnamedT) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [unnamedT+ (recur depth unnamedT)] (wrap unnamedT+)) (^template [<tag>] (<tag> env bodyT) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [bodyT+ (recur (n.inc depth) bodyT)] (wrap (<tag> env bodyT+)))) ([#;UnivQ] @@ -180,11 +180,11 @@ (n.< boundary tag))) (case (list;nth tag cases) (#;Some caseT) - (meta/wrap (if (n.= +0 depth) - (type;function (list caseT) currentT) - (let [replace! (replace-bound (|> depth n.dec (n.* +2)) type)] - (type;function (list (replace! caseT)) - (replace! currentT))))) + (macro/wrap (if (n.= +0 depth) + (type;function (list caseT) currentT) + (let [replace! (replace-bound (|> depth n.dec (n.* +2)) type)] + (type;function (list (replace! caseT)) + (replace! currentT))))) #;None (&common;variant-out-of-bounds-error type expected-size tag)) @@ -196,11 +196,11 @@ (n.= boundary tag) (let [caseT (type;variant (list;drop boundary cases))] - (meta/wrap (if (n.= +0 depth) - (type;function (list caseT) currentT) - (let [replace! (replace-bound (|> depth n.dec (n.* +2)) type)] - (type;function (list (replace! caseT)) - (replace! currentT)))))) + (macro/wrap (if (n.= +0 depth) + (type;function (list caseT) currentT) + (let [replace! (replace-bound (|> depth n.dec (n.* +2)) type)] + (type;function (list (replace! caseT)) + (replace! currentT)))))) ## else (&common;variant-out-of-bounds-error type expected-size tag))) diff --git a/new-luxc/source/luxc/lang/analysis/primitive.lux b/new-luxc/source/luxc/lang/analysis/primitive.lux index 2a0fbfbe5..9124ca271 100644 --- a/new-luxc/source/luxc/lang/analysis/primitive.lux +++ b/new-luxc/source/luxc/lang/analysis/primitive.lux @@ -1,8 +1,8 @@ (;module: lux (lux (control monad) - [meta] - (meta [code]) + [macro] + (macro [code]) (lang (type ["tc" check]))) (luxc ["&" lang] (lang ["la" analysis #+ Analysis]))) @@ -11,7 +11,7 @@ (do-template [<name> <type> <tag>] [(def: #export (<name> value) (-> <type> (Meta Analysis)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer <type>)] (wrap (<tag> value))))] @@ -25,6 +25,6 @@ (def: #export analyse-unit (Meta Analysis) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer Unit)] (wrap (` [])))) diff --git a/new-luxc/source/luxc/lang/analysis/procedure/common.lux b/new-luxc/source/luxc/lang/analysis/procedure/common.lux index a394c554c..747e9f61d 100644 --- a/new-luxc/source/luxc/lang/analysis/procedure/common.lux +++ b/new-luxc/source/luxc/lang/analysis/procedure/common.lux @@ -8,8 +8,8 @@ (coll [list "list/" Functor<List>] [array] [dict #+ Dict])) - [meta] - (meta [code]) + [macro] + (macro [code]) (lang (type ["tc" check])) [io]) (luxc ["&" lang] @@ -52,7 +52,7 @@ (function [analyse eval args] (let [num-actual (list;size args)] (if (n.= num-expected num-actual) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer outputT) argsA (monad;map @ (function [[argT argC]] @@ -83,7 +83,7 @@ (def: (lux-is proc) (-> Text Proc) (function [analyse eval args] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var)] ((binary varT varT Bool proc) analyse eval args)))) @@ -95,7 +95,7 @@ (function [analyse eval args] (case args (^ (list opC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var) _ (&;infer (type (Either Text varT))) opA (&;with-type (type (io;IO varT)) @@ -146,7 +146,7 @@ (function [analyse eval args] (case args (^ (list valueC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer (type Type)) valueA (&;with-type Type (analyse valueC))] @@ -278,7 +278,7 @@ (def: (array-get proc) (-> Text Proc) (function [analyse eval args] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var)] ((binary Nat (type (Array varT)) varT proc) analyse eval args)))) @@ -286,7 +286,7 @@ (def: (array-put proc) (-> Text Proc) (function [analyse eval args] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var)] ((trinary Nat varT (type (Array varT)) (type (Array varT)) proc) analyse eval args)))) @@ -294,7 +294,7 @@ (def: (array-remove proc) (-> Text Proc) (function [analyse eval args] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var)] ((binary Nat (type (Array varT)) (type (Array varT)) proc) analyse eval args)))) @@ -339,7 +339,7 @@ (function [analyse eval args] (case args (^ (list initC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var) _ (&;infer (type (Atom varT))) initA (&;with-type varT @@ -352,7 +352,7 @@ (def: (atom-read proc) (-> Text Proc) (function [analyse eval args] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var)] ((unary (type (Atom varT)) varT proc) analyse eval args)))) @@ -360,7 +360,7 @@ (def: (atom-compare-and-swap proc) (-> Text Proc) (function [analyse eval args] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var)] ((trinary varT varT (type (Atom varT)) Bool proc) analyse eval args)))) diff --git a/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux index 827f3213d..fad31eca0 100644 --- a/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/analysis/procedure/host.jvm.lux @@ -14,9 +14,9 @@ (coll [list "list/" Fold<List> Functor<List> Monoid<List>] [array] [dict #+ Dict])) - [meta "meta/" Monad<Meta>] - (meta [code] - ["s" syntax]) + [macro "macro/" Monad<Meta>] + (macro [code] + ["s" syntax]) (lang [type] (type ["tc" check])) [host]) @@ -194,7 +194,7 @@ (function [analyse eval args] (case args (^ (list arrayC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer Nat) [var-id varT] (&;with-type-env tc;var) arrayA (&;with-type (type (Array varT)) @@ -209,10 +209,10 @@ (function [analyse eval args] (case args (^ (list lengthC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [lengthA (&;with-type Nat (analyse lengthC)) - expectedT meta;expected-type + expectedT macro;expected-type [level elem-class] (: (Meta [Nat Text]) (loop [analysisT expectedT level +0] @@ -245,13 +245,13 @@ (-> Type (Meta Text)) (case objectT (#;Primitive name _) - (meta/wrap name) + (macro/wrap name) (#;Named name unnamed) (check-jvm unnamed) (#;Var id) - (meta/wrap "java.lang.Object") + (macro/wrap "java.lang.Object") (^template [<tag>] (<tag> env unquantified) @@ -272,11 +272,11 @@ (def: (check-object objectT) (-> Type (Meta Text)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [name (check-jvm objectT)] (if (dict;contains? name boxes) (&;throw Primitives-Are-Not-Objects name) - (meta/wrap name)))) + (macro/wrap name)))) (def: (box-array-element-type elemT) (-> Type (Meta [Type Text])) @@ -284,13 +284,13 @@ (#;Primitive name #;Nil) (let [boxed-name (|> (dict;get name boxes) (maybe;default name))] - (meta/wrap [(#;Primitive boxed-name #;Nil) - boxed-name])) + (macro/wrap [(#;Primitive boxed-name #;Nil) + boxed-name])) (#;Primitive name _) (if (dict;contains? name boxes) (&;throw Primitives-Cannot-Have-Type-Parameters name) - (meta/wrap [elemT name])) + (macro/wrap [elemT name])) _ (&;throw Invalid-Type-For-Array-Element (%type elemT)))) @@ -300,7 +300,7 @@ (function [analyse eval args] (case args (^ (list arrayC idxC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var) _ (&;infer varT) arrayA (&;with-type (type (Array varT)) @@ -320,7 +320,7 @@ (function [analyse eval args] (case args (^ (list arrayC idxC valueC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[var-id varT] (&;with-type-env tc;var) _ (&;infer (type (Array varT))) arrayA (&;with-type (type (Array varT)) @@ -352,8 +352,8 @@ (function [analyse eval args] (case args (^ (list)) - (do meta;Monad<Meta> - [expectedT meta;expected-type + (do macro;Monad<Meta> + [expectedT macro;expected-type _ (check-object expectedT)] (wrap (la;procedure proc (list)))) @@ -365,7 +365,7 @@ (function [analyse eval args] (case args (^ (list objectC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer Bool) [objectT objectA] (&common;with-unknown-type (analyse objectC)) @@ -380,7 +380,7 @@ (function [analyse eval args] (case args (^ (list monitorC exprC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[monitorT monitorA] (&common;with-unknown-type (analyse monitorC)) _ (check-object monitorT) @@ -454,7 +454,7 @@ (def: (load-class name) (-> Text (Meta (Class Object))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [class-loader &host;class-loader] (case (Class.forName [name false class-loader]) (#e;Success [class]) @@ -465,7 +465,7 @@ (def: (sub-class? super sub) (-> Text Text (Meta Bool)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [super (load-class super) sub (load-class sub)] (wrap (Class.isAssignableFrom [sub] super)))) @@ -475,7 +475,7 @@ (function [analyse eval args] (case args (^ (list exceptionC)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer Bottom) [exceptionT exceptionA] (&common;with-unknown-type (analyse exceptionC)) @@ -497,7 +497,7 @@ (^ (list classC)) (case classC [_ (#;Text class)] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer (#;Primitive "java.lang.Class" (list (#;Primitive class (list))))) _ (load-class class)] (wrap (la;procedure proc (list (code;text class))))) @@ -515,7 +515,7 @@ (^ (list classC objectC)) (case classC [_ (#;Text class)] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer Bool) [objectT objectA] (&common;with-unknown-type (analyse objectC)) @@ -550,7 +550,7 @@ (def: (java-type-to-class type) (-> java.lang.reflect.Type (Meta Text)) (cond (host;instance? Class type) - (meta/wrap (Class.getName [] (:! Class type))) + (macro/wrap (Class.getName [] (:! Class type))) (host;instance? ParameterizedType type) (java-type-to-class (ParameterizedType.getRawType [] (:! ParameterizedType type))) @@ -569,7 +569,7 @@ (let [var-name (TypeVariable.getName [] (:! TypeVariable java-type))] (case (dict;get var-name mappings) (#;Some var-type) - (meta/wrap var-type) + (macro/wrap var-type) #;None (&;throw Unknown-Type-Var var-name))) @@ -582,37 +582,37 @@ (java-type-to-lux-type mappings bound) _ - (meta/wrap Top))) + (macro/wrap Top))) (host;instance? Class java-type) (let [java-type (:! (Class Object) java-type) class-name (Class.getName [] java-type)] - (meta/wrap (case (array;size (Class.getTypeParameters [] java-type)) - +0 - (#;Primitive class-name (list)) - - arity - (|> (list;n.range +0 (n.dec arity)) - list;reverse - (list/map (|>. (n.* +2) n.inc #;Bound)) - (#;Primitive class-name) - (type;univ-q arity))))) + (macro/wrap (case (array;size (Class.getTypeParameters [] java-type)) + +0 + (#;Primitive class-name (list)) + + arity + (|> (list;n.range +0 (n.dec arity)) + list;reverse + (list/map (|>. (n.* +2) n.inc #;Bound)) + (#;Primitive class-name) + (type;univ-q arity))))) (host;instance? ParameterizedType java-type) (let [java-type (:! ParameterizedType java-type) raw (ParameterizedType.getRawType [] java-type)] (if (host;instance? Class raw) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [paramsT (|> java-type (ParameterizedType.getActualTypeArguments []) array;to-list (monad;map @ (java-type-to-lux-type mappings)))] - (meta/wrap (#;Primitive (Class.getName [] (:! (Class Object) raw)) - paramsT))) + (macro/wrap (#;Primitive (Class.getName [] (:! (Class Object) raw)) + paramsT))) (&;throw JVM-Type-Is-Not-Class (type-descriptor raw)))) (host;instance? GenericArrayType java-type) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [innerT (|> (:! GenericArrayType java-type) (GenericArrayType.getGenericComponentType []) (java-type-to-lux-type mappings))] @@ -652,9 +652,9 @@ " Type: " (%type type))) ## else - (meta/wrap (|> params - (list;zip2 (list/map (TypeVariable.getName []) class-params)) - (dict;from-list text;Hash<Text>))) + (macro/wrap (|> params + (list;zip2 (list/map (TypeVariable.getName []) class-params)) + (dict;from-list text;Hash<Text>))) )) _ @@ -662,7 +662,7 @@ (def: (cast direction to from) (-> Direction Type Type (Meta [Text Type])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [to-name (check-jvm to) from-name (check-jvm from)] (cond (dict;contains? to-name boxes) @@ -712,8 +712,8 @@ (def: (infer-out outputT) (-> Type (Meta [Text Type])) - (do meta;Monad<Meta> - [expectedT meta;expected-type + (do macro;Monad<Meta> + [expectedT macro;expected-type [unboxed castT] (cast #Out expectedT outputT) _ (&;with-type-env (tc;check expectedT castT))] @@ -721,7 +721,7 @@ (def: (find-field class-name field-name) (-> Text Text (Meta [(Class Object) Field])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [class (load-class class-name)] (case (Class.getDeclaredField [field-name] class) (#e;Success field) @@ -738,7 +738,7 @@ (def: (static-field class-name field-name) (-> Text Text (Meta [Type Bool])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[class fieldJ] (find-field class-name field-name) #let [modifiers (Field.getModifiers [] fieldJ)]] (if (Modifier.isStatic [modifiers]) @@ -750,7 +750,7 @@ (def: (virtual-field class-name field-name objectT) (-> Text Text Type (Meta [Type Bool])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[class fieldJ] (find-field class-name field-name) #let [modifiers (Field.getModifiers [] fieldJ)]] (if (not (Modifier.isStatic [modifiers])) @@ -783,7 +783,7 @@ (def: (analyse-object class analyse sourceC) (-> Text &;Analyser Code (Meta [Type la;Analysis])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [target-class (load-class class) targetT (java-type-to-lux-type fresh-mappings (:! java.lang.reflect.Type @@ -797,7 +797,7 @@ (def: (analyse-input analyse targetT sourceC) (-> &;Analyser Type Code (Meta [Type Text la;Analysis])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[sourceT sourceA] (&common;with-unknown-type (analyse sourceC)) [unboxed castT] (cast #In targetT sourceT)] @@ -810,7 +810,7 @@ (^ (list classC fieldC)) (case [classC fieldC] [[_ (#;Text class)] [_ (#;Text field)]] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[fieldT final?] (static-field class field) [unboxed castT] (infer-out fieldT)] (wrap (la;procedure proc (list (code;text class) (code;text field) @@ -829,7 +829,7 @@ (^ (list classC fieldC valueC)) (case [classC fieldC] [[_ (#;Text class)] [_ (#;Text field)]] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (&;infer Unit) [fieldT final?] (static-field class field) _ (&;assert Cannot-Set-Final-Field (format class "#" field) @@ -853,7 +853,7 @@ (^ (list classC fieldC objectC)) (case [classC fieldC] [[_ (#;Text class)] [_ (#;Text field)]] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[objectT objectA] (analyse-object class analyse objectC) [fieldT final?] (virtual-field class field objectT) [unboxed castT] (infer-out fieldT)] @@ -873,7 +873,7 @@ (^ (list classC fieldC valueC objectC)) (case [classC fieldC] [[_ (#;Text class)] [_ (#;Text field)]] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[objectT objectA] (analyse-object class analyse objectC) _ (&;infer objectT) [fieldT final?] (virtual-field class field objectT) @@ -891,17 +891,17 @@ (def: (java-type-to-parameter type) (-> java.lang.reflect.Type (Meta Text)) (cond (host;instance? Class type) - (meta/wrap (Class.getName [] (:! Class type))) + (macro/wrap (Class.getName [] (:! Class type))) (host;instance? ParameterizedType type) (java-type-to-parameter (ParameterizedType.getRawType [] (:! ParameterizedType type))) (or (host;instance? TypeVariable type) (host;instance? WildcardType type)) - (meta/wrap "java.lang.Object") + (macro/wrap "java.lang.Object") (host;instance? GenericArrayType type) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [componentP (java-type-to-parameter (GenericArrayType.getGenericComponentType [] (:! GenericArrayType type)))] (wrap (format componentP "[]"))) @@ -917,7 +917,7 @@ (def: (check-method class method-name method-type arg-classes method) (-> (Class Object) Text Method-Type (List Text) Method (Meta Bool)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [parameters (|> (Method.getGenericParameterTypes [] method) array;to-list (monad;map @ java-type-to-parameter)) @@ -946,7 +946,7 @@ (def: (check-constructor class arg-classes constructor) (-> (Class Object) (List Text) (Constructor Object) (Meta Bool)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [parameters (|> (Constructor.getGenericParameterTypes [] constructor) array;to-list (monad;map @ java-type-to-parameter))] @@ -997,7 +997,7 @@ list;reverse (list;zip2 all-tvars) (dict;from-list text;Hash<Text>))))] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [inputsT (|> (Method.getGenericParameterTypes [] method) array;to-list (monad;map @ (java-type-to-lux-type mappings))) @@ -1018,7 +1018,7 @@ (def: (methods class-name method-name method-type arg-classes) (-> Text Text Method-Type (List Text) (Meta [Type (List Type)])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [class (load-class class-name) candidates (|> class (Class.getDeclaredMethods []) @@ -1059,7 +1059,7 @@ list;reverse (list;zip2 all-tvars) (dict;from-list text;Hash<Text>))))] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [inputsT (|> (Constructor.getGenericParameterTypes [] constructor) array;to-list (monad;map @ (java-type-to-lux-type mappings))) @@ -1074,7 +1074,7 @@ (def: (constructor-methods class-name arg-classes) (-> Text (List Text) (Meta [Type (List Type)])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [class (load-class class-name) candidates (|> class (Class.getConstructors []) @@ -1103,10 +1103,10 @@ (def: (sub-type-analyser analyse) (-> &;Analyser &;Analyser) (function [argC] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[argT argA] (&common;with-unknown-type (analyse argC)) - expectedT meta;expected-type + expectedT macro;expected-type [unboxed castT] (cast #In expectedT argT)] (wrap argA)))) @@ -1116,7 +1116,7 @@ (case (: (e;Error [Text Text (List [Text Code])]) (s;run args ($_ p;seq s;text s;text (p;some (s;tuple (p;seq s;text s;any)))))) (#e;Success [class method argsTC]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [#let [argsT (list/map product;left argsTC)] [methodT exceptionsT] (methods class method #Static argsT) [outputT argsA] (inferenceA;general (sub-type-analyser analyse) methodT (list/map product;right argsTC)) @@ -1133,7 +1133,7 @@ (case (: (e;Error [Text Text Code (List [Text Code])]) (s;run args ($_ p;seq s;text s;text s;any (p;some (s;tuple (p;seq s;text s;any)))))) (#e;Success [class method objectC argsTC]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [#let [argsT (list/map product;left argsTC)] [methodT exceptionsT] (methods class method #Virtual argsT) [outputT allA] (inferenceA;general (sub-type-analyser analyse) methodT (list& objectC (list/map product;right argsTC))) @@ -1156,7 +1156,7 @@ (case (: (e;Error [(List Code) [Text Text Code (List [Text Code]) Unit]]) (p;run args ($_ p;seq s;text s;text s;any (p;some (s;tuple (p;seq s;text s;any))) s;end!))) (#e;Success [_ [class method objectC argsTC _]]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [#let [argsT (list/map product;left argsTC)] [methodT exceptionsT] (methods class method #Special argsT) [outputT argsA] (inferenceA;general (sub-type-analyser analyse) methodT (list& objectC (list/map product;right argsTC))) @@ -1173,7 +1173,7 @@ (case (: (e;Error [Text Text Code (List [Text Code])]) (s;run args ($_ p;seq s;text s;text s;any (p;some (s;tuple (p;seq s;text s;any)))))) (#e;Success [class-name method objectC argsTC]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [#let [argsT (list/map product;left argsTC)] class (load-class class-name) _ (&;assert Non-Interface class-name @@ -1194,7 +1194,7 @@ (case (: (e;Error [Text (List [Text Code])]) (s;run args ($_ p;seq s;text (p;some (s;tuple (p;seq s;text s;any)))))) (#e;Success [class argsTC]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [#let [argsT (list/map product;left argsTC)] [methodT exceptionsT] (constructor-methods class argsT) [outputT argsA] (inferenceA;general (sub-type-analyser analyse) methodT (list/map product;right argsTC)) diff --git a/new-luxc/source/luxc/lang/analysis/reference.lux b/new-luxc/source/luxc/lang/analysis/reference.lux index c3ff3456b..25b33881c 100644 --- a/new-luxc/source/luxc/lang/analysis/reference.lux +++ b/new-luxc/source/luxc/lang/analysis/reference.lux @@ -1,8 +1,8 @@ (;module: lux (lux (control monad) - [meta] - (meta [code]) + [macro] + (macro [code]) (lang (type ["tc" check]))) (luxc ["&" lang] (lang ["&;" scope] @@ -12,14 +12,14 @@ ## [Analysers] (def: (analyse-definition def-name) (-> Ident (Meta Analysis)) - (do meta;Monad<Meta> - [actualT (meta;find-def-type def-name) + (do macro;Monad<Meta> + [actualT (macro;find-def-type def-name) _ (&;infer actualT)] (wrap (code;symbol def-name)))) (def: (analyse-variable var-name) (-> Text (Meta (Maybe Analysis))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [?var (&scope;find var-name)] (case ?var (#;Some [actualT ref]) @@ -34,7 +34,7 @@ (-> Ident (Meta Analysis)) (case reference ["" simple-name] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [?var (analyse-variable simple-name)] (case ?var (#;Some varA) @@ -42,7 +42,7 @@ #;None (do @ - [this-module meta;current-module-name] + [this-module macro;current-module-name] (analyse-definition [this-module simple-name])))) _ diff --git a/new-luxc/source/luxc/lang/analysis/structure.lux b/new-luxc/source/luxc/lang/analysis/structure.lux index 70744ba5b..2292d93cf 100644 --- a/new-luxc/source/luxc/lang/analysis/structure.lux +++ b/new-luxc/source/luxc/lang/analysis/structure.lux @@ -9,8 +9,8 @@ (coll [list "list/" Functor<List>] [dict #+ Dict]) text/format) - [meta] - (meta [code]) + [macro] + (macro [code]) (lang [type] (type ["tc" check]))) (luxc ["&" lang] @@ -32,8 +32,8 @@ (def: #export (analyse-sum analyse tag valueC) (-> &;Analyser Nat Code (Meta la;Analysis)) - (do meta;Monad<Meta> - [expectedT meta;expected-type] + (do macro;Monad<Meta> + [expectedT macro;expected-type] (&;with-stacked-errors (function [_] (Not-Variant-Type (format " Type: " (%type expectedT) "\n" "Value: " (%code valueC) "\n" @@ -115,8 +115,8 @@ (def: (analyse-typed-product analyse membersC+) (-> &;Analyser (List Code) (Meta la;Analysis)) - (do meta;Monad<Meta> - [expectedT meta;expected-type] + (do macro;Monad<Meta> + [expectedT macro;expected-type] (loop [expectedT expectedT membersC+ membersC+] (case [expectedT membersC+] @@ -154,7 +154,7 @@ ## and what was analysed. [tailT tailC] (do @ - [g!tail (meta;gensym "tail")] + [g!tail (macro;gensym "tail")] (&;with-type tailT (analyse (` ("lux case" [(~@ tailC)] (~ g!tail) @@ -163,8 +163,8 @@ (def: #export (analyse-product analyse membersC) (-> &;Analyser (List Code) (Meta la;Analysis)) - (do meta;Monad<Meta> - [expectedT meta;expected-type] + (do macro;Monad<Meta> + [expectedT macro;expected-type] (&;with-stacked-errors (function [_] (Not-Tuple-Type (format " Type: " (%type expectedT) "\n" "Value: " (%code (` [(~@ membersC)]))))) @@ -234,10 +234,10 @@ (def: #export (analyse-tagged-sum analyse tag valueC) (-> &;Analyser Ident Code (Meta la;Analysis)) - (do meta;Monad<Meta> - [tag (meta;normalize tag) - [idx group variantT] (meta;resolve-tag tag) - expectedT meta;expected-type] + (do macro;Monad<Meta> + [tag (macro;normalize tag) + [idx group variantT] (macro;resolve-tag tag) + expectedT macro;expected-type] (case expectedT (#;Var _) (do @ @@ -256,12 +256,12 @@ ## canonical form (with their corresponding module identified). (def: #export (normalize record) (-> (List [Code Code]) (Meta (List [Ident Code]))) - (monad;map meta;Monad<Meta> + (monad;map macro;Monad<Meta> (function [[key val]] (case key [_ (#;Tag key)] - (do meta;Monad<Meta> - [key (meta;normalize key)] + (do macro;Monad<Meta> + [key (macro;normalize key)] (wrap [key val])) _ @@ -277,12 +277,12 @@ (case record ## empty-record = empty-tuple = unit = [] #;Nil - (:: meta;Monad<Meta> wrap [(list) Unit]) + (:: macro;Monad<Meta> wrap [(list) Unit]) (#;Cons [head-k head-v] _) - (do meta;Monad<Meta> - [head-k (meta;normalize head-k) - [_ tag-set recordT] (meta;resolve-tag head-k) + (do macro;Monad<Meta> + [head-k (macro;normalize head-k) + [_ tag-set recordT] (macro;resolve-tag head-k) #let [size-record (list;size record) size-ts (list;size tag-set)] _ (if (n.= size-ts size-record) @@ -296,7 +296,7 @@ idx->val (monad;fold @ (function [[key val] idx->val] (do @ - [key (meta;normalize key)] + [key (macro;normalize key)] (case (dict;get key tag->idx) #;None (&;throw Tag-Does-Not-Belong-To-Record @@ -321,10 +321,10 @@ (def: #export (analyse-record analyse members) (-> &;Analyser (List [Code Code]) (Meta la;Analysis)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [members (normalize members) [membersC recordT] (order members) - expectedT meta;expected-type] + expectedT macro;expected-type] (case expectedT (#;Var _) (do @ diff --git a/new-luxc/source/luxc/lang/analysis/type.lux b/new-luxc/source/luxc/lang/analysis/type.lux index c91fdab38..f85608e19 100644 --- a/new-luxc/source/luxc/lang/analysis/type.lux +++ b/new-luxc/source/luxc/lang/analysis/type.lux @@ -1,7 +1,7 @@ (;module: lux (lux (control monad) - [meta] + [macro] (lang (type ["tc" check]))) (luxc ["&" lang] (lang ["la" analysis #+ Analysis]))) @@ -11,7 +11,7 @@ ## computing Lux type values. (def: #export (analyse-check analyse eval type value) (-> &;Analyser &;Eval Code Code (Meta Analysis)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [actualT (eval Type type) #let [actualT (:! Type actualT)] _ (&;infer actualT)] @@ -20,7 +20,7 @@ (def: #export (analyse-coerce analyse eval type value) (-> &;Analyser &;Eval Code Code (Meta Analysis)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [actualT (eval Type type) _ (&;infer (:! Type actualT))] (&;with-type Top diff --git a/new-luxc/source/luxc/lang/eval.lux b/new-luxc/source/luxc/lang/eval.lux index 265320dbe..e691ec7a1 100644 --- a/new-luxc/source/luxc/lang/eval.lux +++ b/new-luxc/source/luxc/lang/eval.lux @@ -1,7 +1,7 @@ (;module: lux (lux (control [monad #+ do]) - [meta]) + [macro]) (luxc ["&" lang] (lang (analysis [";A" expression]) (synthesis [";S" expression]) @@ -10,7 +10,7 @@ (def: #export (eval type exprC) &;Eval - (do meta;Monad<Meta> + (do macro;Monad<Meta> [exprA (&;with-type type (expressionA;analyser eval exprC)) #let [exprS (expressionS;synthesize exprA)] diff --git a/new-luxc/source/luxc/lang/host.jvm.lux b/new-luxc/source/luxc/lang/host.jvm.lux index ae1d29387..726bb5bbc 100644 --- a/new-luxc/source/luxc/lang/host.jvm.lux +++ b/new-luxc/source/luxc/lang/host.jvm.lux @@ -9,7 +9,7 @@ text/format (coll [dict] [array])) - [meta #+ Monad<Meta>] + [macro #+ Monad<Meta>] [host #+ do-to object] [io]) (luxc ["&" lang] diff --git a/new-luxc/source/luxc/lang/host/jvm.lux b/new-luxc/source/luxc/lang/host/jvm.lux index 24d4a9ea9..f96b3e646 100644 --- a/new-luxc/source/luxc/lang/host/jvm.lux +++ b/new-luxc/source/luxc/lang/host/jvm.lux @@ -3,9 +3,9 @@ (lux (control monad ["p" parser]) (data (coll [list "list/" Functor<List>])) - [meta] - (meta [code] - ["s" syntax #+ syntax:]) + [macro] + (macro [code] + ["s" syntax #+ syntax:]) [host])) ## [Host] diff --git a/new-luxc/source/luxc/lang/host/jvm/inst.lux b/new-luxc/source/luxc/lang/host/jvm/inst.lux index 37ab75020..dc2909b69 100644 --- a/new-luxc/source/luxc/lang/host/jvm/inst.lux +++ b/new-luxc/source/luxc/lang/host/jvm/inst.lux @@ -7,9 +7,9 @@ text/format (coll [list "L/" Functor<List>])) [host #+ do-to] - [meta] - (meta [code] - ["s" syntax #+ syntax:])) + [macro] + (macro [code] + ["s" syntax #+ syntax:])) ["$" ..] (.. ["$t" type])) diff --git a/new-luxc/source/luxc/lang/host/macro.lux b/new-luxc/source/luxc/lang/host/macro.lux index 01f8c3bdb..d557b6750 100644 --- a/new-luxc/source/luxc/lang/host/macro.lux +++ b/new-luxc/source/luxc/lang/host/macro.lux @@ -2,7 +2,7 @@ lux (lux (control [monad #+ do]) (data ["e" error]) - [meta] + [macro] [host]) (luxc (lang (translation [";T" common]))) [..]) @@ -22,7 +22,7 @@ (host;array-write +1 _object-class))) (def: #export (expand macro inputs) (-> Macro (List Code) (Meta (List Code))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [class (commonT;load-class ..;function-class)] (function [compiler] (do e;Monad<Error> diff --git a/new-luxc/source/luxc/lang/module.lux b/new-luxc/source/luxc/lang/module.lux index fba337cc3..2b855d927 100644 --- a/new-luxc/source/luxc/lang/module.lux +++ b/new-luxc/source/luxc/lang/module.lux @@ -6,8 +6,8 @@ text/format ["e" error] (coll [list "list/" Fold<List> Functor<List>])) - [meta] - (meta [code])) + [macro] + (macro [code])) (luxc ["&" lang] (lang ["&;" scope]))) @@ -61,11 +61,11 @@ (def: #export (with-module hash name action) (All [a] (-> Nat Text (Meta a) (Meta [Module a]))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (create hash name) output (&;with-current-module name (&scope;with-scope name action)) - module (meta;find-module name)] + module (macro;find-module name)] (wrap [module output]))) (do-template [<flagger> <asker> <tag>] @@ -114,7 +114,7 @@ (#e;Success [compiler (get@ <tag> module)]) #;None - (meta;run compiler (&;throw Unknown-Module module-name))) + (macro;run compiler (&;throw Unknown-Module module-name))) ))] [tags-by-module #;tags (List [Text [Nat (List Ident) Bool Type]])] @@ -124,7 +124,7 @@ (def: (ensure-undeclared-tags module-name tags) (-> Text (List Text) (Meta Unit)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [bindings (tags-by-module module-name) _ (monad;map @ (function [tag] @@ -140,8 +140,8 @@ (def: #export (declare-tags tags exported? type) (-> (List Text) Bool Type (Meta Unit)) - (do meta;Monad<Meta> - [current-module meta;current-module-name + (do macro;Monad<Meta> + [current-module macro;current-module-name [type-module type-name] (case type (#;Named type-ident _) (wrap type-ident) @@ -170,4 +170,4 @@ compiler) []])) #;None - (meta;run compiler (&;throw Unknown-Module current-module)))))) + (macro;run compiler (&;throw Unknown-Module current-module)))))) diff --git a/new-luxc/source/luxc/lang/scope.lux b/new-luxc/source/luxc/lang/scope.lux index 435b8ef61..8bc61e722 100644 --- a/new-luxc/source/luxc/lang/scope.lux +++ b/new-luxc/source/luxc/lang/scope.lux @@ -7,7 +7,7 @@ [product] ["e" error] (coll [list "list/" Functor<List> Fold<List> Monoid<List>])) - [meta]) + [macro]) (luxc ["&" lang] (lang [";L" variable #+ Variable]))) @@ -102,8 +102,8 @@ (|>. (update@ #;counter n.inc) (update@ #;mappings (&;pl-put name [type new-var-id])))) head)] - (case (meta;run' (set@ #;scopes (#;Cons new-head tail) compiler) - action) + (case (macro;run' (set@ #;scopes (#;Cons new-head tail) compiler) + action) (#e;Success [compiler' output]) (case (get@ #;scopes compiler') (#;Cons head' tail') diff --git a/new-luxc/source/luxc/lang/synthesis/case.lux b/new-luxc/source/luxc/lang/synthesis/case.lux index 2fd6e19bb..dfe05e1bf 100644 --- a/new-luxc/source/luxc/lang/synthesis/case.lux +++ b/new-luxc/source/luxc/lang/synthesis/case.lux @@ -5,7 +5,7 @@ text/format [number] (coll [list "list/" Fold<List> Monoid<List>])) - (meta [code "code/" Eq<Code>])) + (macro [code "code/" Eq<Code>])) (luxc (lang [";L" variable #+ Variable] ["la" analysis] ["ls" synthesis] diff --git a/new-luxc/source/luxc/lang/synthesis/expression.lux b/new-luxc/source/luxc/lang/synthesis/expression.lux index 4571a8875..b9f5d56cc 100644 --- a/new-luxc/source/luxc/lang/synthesis/expression.lux +++ b/new-luxc/source/luxc/lang/synthesis/expression.lux @@ -8,8 +8,8 @@ text/format (coll [list "list/" Functor<List> Fold<List> Monoid<List>] [dict #+ Dict])) - (meta [code] - ["s" syntax])) + (macro [code] + ["s" syntax])) (luxc (lang ["la" analysis] ["ls" synthesis] (synthesis [";S" case] diff --git a/new-luxc/source/luxc/lang/synthesis/loop.lux b/new-luxc/source/luxc/lang/synthesis/loop.lux index 0070fcd5d..86c37a3f0 100644 --- a/new-luxc/source/luxc/lang/synthesis/loop.lux +++ b/new-luxc/source/luxc/lang/synthesis/loop.lux @@ -4,8 +4,8 @@ ["p" parser]) (data [maybe] (coll [list "list/" Functor<List>])) - (meta [code] - [syntax])) + (macro [code] + [syntax])) (luxc (lang ["ls" synthesis] [";L" variable #+ Variable Register]))) diff --git a/new-luxc/source/luxc/lang/translation.lux b/new-luxc/source/luxc/lang/translation.lux index 1e631205d..9b59e5341 100644 --- a/new-luxc/source/luxc/lang/translation.lux +++ b/new-luxc/source/luxc/lang/translation.lux @@ -7,7 +7,7 @@ [text "text/" Hash<Text>] text/format (coll [dict])) - [meta] + [macro] (lang [syntax] (type ["tc" check])) [host] @@ -39,7 +39,7 @@ (def: (process-annotations annsC) (-> Code (Meta [$;Inst Code])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[_ annsA] (&;with-scope (&;with-type Code (analyse annsC))) @@ -53,10 +53,10 @@ (^code ("lux def" (~ [_ (#;Symbol ["" def-name])]) (~ valueC) (~ annsC))) (hostL;with-context def-name (&;with-fresh-type-env - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[annsI annsV] (process-annotations annsC) [_ valueT valueA] (&;with-scope - (if (meta;type? (:! Code annsV)) + (if (macro;type? (:! Code annsV)) (do @ [valueA (&;with-type Type (analyse valueC))] @@ -71,7 +71,7 @@ (wrap [])))) (^code ("lux program" (~ [_ (#;Symbol ["" program-args])]) (~ programC))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[_ programA] (&;with-scope (&;with-type (type (io;IO Unit)) (analyse programC))) @@ -79,15 +79,15 @@ (statementT;translate-program program-args programI)) (^code ("lux module" (~ annsC))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[annsI annsV] (process-annotations annsC)] (&;fail (%code annsV))) (^code ((~ [_ (#;Symbol macro-name)]) (~@ args))) - (do meta;Monad<Meta> - [macro-name (meta;normalize macro-name) - [def-type def-anns def-value] (meta;find-def macro-name)] - (if (meta;macro? def-anns) + (do macro;Monad<Meta> + [macro-name (macro;normalize macro-name) + [def-type def-anns def-value] (macro;find-def macro-name)] + (if (macro;macro? def-anns) (do @ [expansion (function [compiler] (case (macroH;expand (:! Macro def-value) args compiler) @@ -119,7 +119,7 @@ (def: (with-active-compilation [module-name file-name source-code] action) (All [a] (-> [Text Text Text] (Meta a) (Meta a))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [#let [init-cursor [file-name +1 +0]] output (&;with-source-code [init-cursor +0 source-code] action) @@ -143,20 +143,20 @@ [_ (&io;prepare-module target-dir module-name) [file-name file-content] (&io;read-module source-dirs module-name) #let [module-hash (text/hash file-content)]] - (case (meta;run' compiler - (do meta;Monad<Meta> - [[_ artifacts _] (moduleL;with-module module-hash module-name - (commonT;with-artifacts - (with-active-compilation [module-name - file-name - file-content] - (exhaust - (do @ - [code (parse module-name) - #let [[cursor _] code]] - (&;with-cursor cursor - (translate code)))))))] - (wrap artifacts))) + (case (macro;run' compiler + (do macro;Monad<Meta> + [[_ artifacts _] (moduleL;with-module module-hash module-name + (commonT;with-artifacts + (with-active-compilation [module-name + file-name + file-content] + (exhaust + (do @ + [code (parse module-name) + #let [[cursor _] code]] + (&;with-cursor cursor + (translate code)))))))] + (wrap artifacts))) (#e;Success [compiler artifacts]) (do @ [_ (monad;map @ (function [[class-name class-bytecode]] diff --git a/new-luxc/source/luxc/lang/translation/case.jvm.lux b/new-luxc/source/luxc/lang/translation/case.jvm.lux index e3052c77d..cf2cdb7f1 100644 --- a/new-luxc/source/luxc/lang/translation/case.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/case.jvm.lux @@ -3,7 +3,7 @@ (lux (control [monad #+ do] ["ex" exception #+ exception:]) (data text/format) - [meta "meta/" Monad<Meta>]) + [macro "macro/" Monad<Meta>]) (luxc ["_" lang] (lang [";L" host] (host ["$" jvm] @@ -59,111 +59,111 @@ Nat $;Label $;Label ls;Path (Meta $;Inst)) (case path (^ [_ (#;Form (list [_ (#;Text "lux case exec")] bodyS))]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [bodyI (translate bodyS)] (wrap (|>. (pop-altI stack-depth) bodyI ($i;GOTO @end)))) (^ [_ (#;Form (list [_ (#;Text "lux case pop")]))]) - (meta/wrap popI) + (macro/wrap popI) (^ [_ (#;Form (list [_ (#;Text "lux case bind")] [_ (#;Nat register)]))]) - (meta/wrap (|>. peekI - ($i;ASTORE register))) + (macro/wrap (|>. peekI + ($i;ASTORE register))) [_ (#;Bool value)] - (meta/wrap (let [jumpI (if value $i;IFEQ $i;IFNE)] - (|>. peekI - ($i;unwrap #$;Boolean) - (jumpI @else)))) + (macro/wrap (let [jumpI (if value $i;IFEQ $i;IFNE)] + (|>. peekI + ($i;unwrap #$;Boolean) + (jumpI @else)))) (^template [<tag> <prep>] [_ (<tag> value)] - (meta/wrap (|>. peekI - ($i;unwrap #$;Long) - ($i;long (|> value <prep>)) - $i;LCMP - ($i;IFNE @else)))) + (macro/wrap (|>. peekI + ($i;unwrap #$;Long) + ($i;long (|> value <prep>)) + $i;LCMP + ($i;IFNE @else)))) ([#;Nat (:! Int)] [#;Int (: Int)] [#;Deg (:! Int)]) [_ (#;Frac value)] - (meta/wrap (|>. peekI - ($i;unwrap #$;Double) - ($i;double value) - $i;DCMPL - ($i;IFNE @else))) + (macro/wrap (|>. peekI + ($i;unwrap #$;Double) + ($i;double value) + $i;DCMPL + ($i;IFNE @else))) [_ (#;Text value)] - (meta/wrap (|>. peekI - ($i;string value) - ($i;INVOKEVIRTUAL "java.lang.Object" - "equals" - ($t;method (list $Object) - (#;Some $t;boolean) - (list)) - false) - ($i;IFEQ @else))) + (macro/wrap (|>. peekI + ($i;string value) + ($i;INVOKEVIRTUAL "java.lang.Object" + "equals" + ($t;method (list $Object) + (#;Some $t;boolean) + (list)) + false) + ($i;IFEQ @else))) (^template [<special> <method>] (^ [_ (#;Form (list [_ (#;Text <special>)] [_ (#;Nat idx)]))]) - (meta/wrap (case idx - +0 - (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) - ($i;int 0) - $i;AALOAD - pushI) - - _ - (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) - ($i;int (nat-to-int idx)) - ($i;INVOKESTATIC hostL;runtime-class - <method> - ($t;method (list ../runtime;$Tuple $t;int) - (#;Some $Object) - (list)) - false) - pushI)))) + (macro/wrap (case idx + +0 + (|>. peekI + ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) + ($i;int 0) + $i;AALOAD + pushI) + + _ + (|>. peekI + ($i;CHECKCAST ($t;descriptor ../runtime;$Tuple)) + ($i;int (nat-to-int idx)) + ($i;INVOKESTATIC hostL;runtime-class + <method> + ($t;method (list ../runtime;$Tuple $t;int) + (#;Some $Object) + (list)) + false) + pushI)))) (["lux case tuple left" "pm_left"] ["lux case tuple right" "pm_right"]) (^template [<special> <flag>] (^ [_ (#;Form (list [_ (#;Text <special>)] [_ (#;Nat idx)]))]) - (meta/wrap (<| $i;with-label (function [@success]) - $i;with-label (function [@fail]) - (|>. peekI - ($i;CHECKCAST ($t;descriptor ../runtime;$Variant)) - ($i;int (nat-to-int idx)) - <flag> - ($i;INVOKESTATIC hostL;runtime-class "pm_variant" - ($t;method (list ../runtime;$Variant ../runtime;$Tag ../runtime;$Flag) - (#;Some ../runtime;$Datum) - (list)) - false) - $i;DUP - ($i;IFNULL @fail) - ($i;GOTO @success) - ($i;label @fail) - $i;POP - ($i;GOTO @else) - ($i;label @success) - pushI)))) + (macro/wrap (<| $i;with-label (function [@success]) + $i;with-label (function [@fail]) + (|>. peekI + ($i;CHECKCAST ($t;descriptor ../runtime;$Variant)) + ($i;int (nat-to-int idx)) + <flag> + ($i;INVOKESTATIC hostL;runtime-class "pm_variant" + ($t;method (list ../runtime;$Variant ../runtime;$Tag ../runtime;$Flag) + (#;Some ../runtime;$Datum) + (list)) + false) + $i;DUP + ($i;IFNULL @fail) + ($i;GOTO @success) + ($i;label @fail) + $i;POP + ($i;GOTO @else) + ($i;label @success) + pushI)))) (["lux case variant left" $i;NULL] ["lux case variant right" ($i;string "")]) (^ [_ (#;Form (list [_ (#;Text "lux case seq")] leftP rightP))]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [leftI (translate-path' translate stack-depth @else @end leftP) rightI (translate-path' translate stack-depth @else @end rightP)] (wrap (|>. leftI rightI))) (^ [_ (#;Form (list [_ (#;Text "lux case alt")] leftP rightP))]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [@alt-else $i;make-label leftI (translate-path' translate (n.inc stack-depth) @alt-else @end leftP) rightI (translate-path' translate stack-depth @else @end rightP)] @@ -179,7 +179,7 @@ (def: (translate-path translate path @end) (-> (-> ls;Synthesis (Meta $;Inst)) ls;Path $;Label (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [@else $i;make-label pathI (translate-path' translate +1 @else @end path)] (wrap (|>. pathI @@ -208,7 +208,7 @@ (def: #export (translate-case translate valueS path) (-> (-> ls;Synthesis (Meta $;Inst)) ls;Synthesis ls;Path (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [@end $i;make-label valueI (translate valueS) pathI (translate-path translate path @end)] @@ -222,7 +222,7 @@ (def: #export (translate-let translate register inputS exprS) (-> (-> ls;Synthesis (Meta $;Inst)) Nat ls;Synthesis ls;Synthesis (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [inputI (translate inputS) exprI (translate exprS)] (wrap (|>. inputI diff --git a/new-luxc/source/luxc/lang/translation/eval.jvm.lux b/new-luxc/source/luxc/lang/translation/eval.jvm.lux index 3c4eea048..11baa3856 100644 --- a/new-luxc/source/luxc/lang/translation/eval.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/eval.jvm.lux @@ -2,7 +2,7 @@ lux (lux (control monad) (data text/format) - [meta] + [macro] [host #+ do-to]) (luxc ["&" lang] (lang (host ["$" jvm] @@ -55,8 +55,8 @@ (def: #export (eval valueI) (-> $;Inst (Meta Top)) - (do meta;Monad<Meta> - [class-name (:: @ map %code (meta;gensym "eval")) + (do macro;Monad<Meta> + [class-name (:: @ map %code (macro;gensym "eval")) #let [writer (|> (do-to (ClassWriter.new ClassWriter.COMPUTE_MAXS) (ClassWriter.visit [commonT;bytecode-version (i.+ Opcodes.ACC_PUBLIC Opcodes.ACC_SUPER) diff --git a/new-luxc/source/luxc/lang/translation/expression.jvm.lux b/new-luxc/source/luxc/lang/translation/expression.jvm.lux index d592c5001..65bb5b772 100644 --- a/new-luxc/source/luxc/lang/translation/expression.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/expression.jvm.lux @@ -5,8 +5,8 @@ ["p" parser]) (data ["e" error] text/format) - [meta] - (meta ["s" syntax])) + [macro] + (macro ["s" syntax])) (luxc ["&" lang] (lang [";L" variable #+ Variable Register] (host ["$" jvm]) diff --git a/new-luxc/source/luxc/lang/translation/function.jvm.lux b/new-luxc/source/luxc/lang/translation/function.jvm.lux index d12eca16e..d8a2077bc 100644 --- a/new-luxc/source/luxc/lang/translation/function.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/function.jvm.lux @@ -4,7 +4,7 @@ (data [text] text/format (coll [list "list/" Functor<List> Monoid<List>])) - [meta]) + [macro]) (luxc ["&" lang] (lang [";L" host] (host ["$" jvm] @@ -103,7 +103,7 @@ (def: (instance class arity env) (-> Text ls;Arity (List Variable) (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [captureI+ (monad;map @ referenceT;translate-variable env) #let [argsI (if (poly-arg? arity) (|> (nullsI (n.dec arity)) @@ -278,7 +278,7 @@ (with-reset class arity env) applyD ))] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [instanceI (instance class arity env)] (wrap [functionD instanceI])))) @@ -286,7 +286,7 @@ (-> (-> ls;Synthesis (Meta $;Inst)) (List Variable) ls;Arity ls;Synthesis (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [@begin $i;make-label [function-class bodyI] (hostL;with-sub-context (hostL;with-anchor [@begin +1] @@ -310,7 +310,7 @@ (-> (-> ls;Synthesis (Meta $;Inst)) ls;Synthesis (List ls;Synthesis) (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [functionI (translate functionS) argsI (monad;map @ translate argsS) #let [applyI (|> (segment runtimeT;num-apply-variants argsI) diff --git a/new-luxc/source/luxc/lang/translation/loop.jvm.lux b/new-luxc/source/luxc/lang/translation/loop.jvm.lux index b5497236f..f5830bf9e 100644 --- a/new-luxc/source/luxc/lang/translation/loop.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/loop.jvm.lux @@ -4,7 +4,7 @@ (data [text] text/format (coll [list "list/" Functor<List> Monoid<List>])) - [meta]) + [macro]) (luxc ["&" lang] (lang [";L" host] (host ["$" jvm] @@ -22,7 +22,7 @@ (-> (-> ls;Synthesis (Meta $;Inst)) (List ls;Synthesis) (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [[@begin offset] hostL;anchor argsI (monad;map @ (function [[register argS]] (let [register' (|> register (n.+ offset))] @@ -47,7 +47,7 @@ (-> (-> ls;Synthesis (Meta $;Inst)) Nat (List ls;Synthesis) ls;Synthesis (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [@begin $i;make-label initsI+ (monad;map @ translate initsS+) bodyI (hostL;with-anchor [@begin (n.inc offset)] diff --git a/new-luxc/source/luxc/lang/translation/primitive.jvm.lux b/new-luxc/source/luxc/lang/translation/primitive.jvm.lux index f059aa8da..e8522ebfc 100644 --- a/new-luxc/source/luxc/lang/translation/primitive.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/primitive.jvm.lux @@ -2,7 +2,7 @@ lux (lux (control monad) (data text/format) - [meta "meta/" Monad<Meta>]) + [macro "macro/" Monad<Meta>]) (luxc ["&" lang] (lang [";L" host] (host ["$" jvm] @@ -15,18 +15,18 @@ (def: #export translate-unit (Meta $;Inst) - (meta/wrap ($i;string hostL;unit))) + (macro/wrap ($i;string hostL;unit))) (def: #export (translate-bool value) (-> Bool (Meta $;Inst)) - (meta/wrap ($i;GETSTATIC "java.lang.Boolean" - (if value "TRUE" "FALSE") - ($t;class "java.lang.Boolean" (list))))) + (macro/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> (Meta $;Inst)) - (meta/wrap (|>. (<load> value) <wrap>)))] + (macro/wrap (|>. (<load> value) <wrap>)))] [translate-nat Nat (|>. (:! Int) $i;long) ($i;wrap #$;Long)] [translate-int Int $i;long ($i;wrap #$;Long)] diff --git a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux index 3cab88e48..0e17f99a6 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/common.jvm.lux @@ -8,9 +8,9 @@ text/format (coll [list "list/" Functor<List>] [dict #+ Dict])) - [meta #+ with-gensyms] - (meta [code] - ["s" syntax #+ syntax:]) + [macro #+ with-gensyms] + (macro [code] + ["s" syntax #+ syntax:]) [host]) (luxc ["&" lang] (lang [";L" host] @@ -84,7 +84,7 @@ (syntax: (arity: [name s;local-symbol] [arity s;nat]) (with-gensyms [g!proc g!name g!translate g!inputs] (do @ - [g!input+ (monad;seq @ (list;repeat arity (meta;gensym "input")))] + [g!input+ (monad;seq @ (list;repeat arity (macro;gensym "input")))] (wrap (list (` (def: #export ((~ (code;local-symbol name)) (~ g!proc)) (-> (-> (;;Vector (~ (code;nat arity)) $;Inst) $;Inst) (-> Text ;;Proc)) @@ -92,7 +92,7 @@ (function [(~ g!translate) (~ g!inputs)] (case (~ g!inputs) (^ (list (~@ g!input+))) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [(~@ (|> g!input+ (list/map (function [g!input] (list g!input (` ((~ g!translate) (~ g!input)))))) @@ -100,7 +100,7 @@ ((~' wrap) ((~ g!proc) [(~@ g!input+)]))) (~' _) - (meta;fail (wrong-arity (~ g!name) +1 (list;size (~ g!inputs)))))))))))))) + (macro;fail (wrong-arity (~ g!name) +1 (list;size (~ g!inputs)))))))))))))) (arity: nullary +0) (arity: unary +1) @@ -111,7 +111,7 @@ (-> Variadic (-> Text Proc)) (function [proc-name] (function [translate inputsS] - (do meta;Monad<Meta> + (do macro;Monad<Meta> [inputsI (monad;map @ translate inputsS)] (wrap (proc inputsI)))))) diff --git a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux index 8a28e3cf7..b020fed7b 100644 --- a/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/procedure/host.jvm.lux @@ -10,9 +10,9 @@ ["l" lexer]) (coll [list "list/" Functor<List>] [dict #+ Dict])) - [meta "meta/" Monad<Meta>] - (meta [code] - ["s" syntax #+ syntax:]) + [macro "macro/" Monad<Meta>] + (macro [code] + ["s" syntax #+ syntax:]) [host]) (luxc ["&" lang] (lang [";L" host] @@ -280,7 +280,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Nat level)] [_ (#;Text class)] lengthS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [lengthI (translate lengthS) #let [arrayJT ($t;array level (case class "boolean" $t;boolean @@ -304,7 +304,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] idxS arrayS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [arrayI (translate arrayS) idxI (translate idxS) #let [loadI (case class @@ -330,7 +330,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] idxS valueS arrayS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [arrayI (translate arrayS) idxI (translate idxS) valueI (translate valueS) @@ -399,7 +399,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [] (wrap (|>. ($i;string class) ($i;INVOKESTATIC "java.lang.Class" "forName" @@ -415,7 +415,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] objectS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [objectI (translate objectS)] (wrap (|>. objectI ($i;INSTANCEOF class) @@ -452,7 +452,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)])) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [] (case (dict;get unboxed primitives) (#;Some primitive) @@ -479,7 +479,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] valueS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [valueI (translate valueS)] (case (dict;get unboxed primitives) (#;Some primitive) @@ -511,7 +511,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] objectS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [objectI (translate objectS)] (case (dict;get unboxed primitives) (#;Some primitive) @@ -542,7 +542,7 @@ (-> Text @;Proc) (case inputs (^ (list [_ (#;Text class)] [_ (#;Text field)] [_ (#;Text unboxed)] valueS objectS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [valueI (translate valueS) objectI (translate objectS)] (case (dict;get unboxed primitives) @@ -605,7 +605,7 @@ (&;throw Invalid-Syntax-For-JVM-Type argD) (#e;Success type) - (meta/wrap type))) + (macro/wrap type))) (def: (prepare-input inputT inputI) (-> $;Type $;Inst $;Inst) @@ -629,10 +629,10 @@ (Meta (List [$;Type $;Inst]))) (case argsS #;Nil - (meta/wrap #;Nil) + (macro/wrap #;Nil) (^ (list& [_ (#;Tuple (list [_ (#;Text argD)] argS))] tail)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [argT (translate-type argD) argI (:: @ map (prepare-input argT) (translate argS)) =tail (translate-args translate tail)] @@ -645,10 +645,10 @@ (-> Text (Meta (Maybe $;Type))) (case description "void" - (meta/wrap #;None) + (macro/wrap #;None) _ - (meta/map (|>. #;Some) (translate-type description)))) + (macro/map (|>. #;Some) (translate-type description)))) (def: (prepare-return returnT returnI) (-> (Maybe $;Type) $;Inst $;Inst) @@ -670,7 +670,7 @@ (case inputs (^ (list& [_ (#;Text class)] [_ (#;Text method)] [_ (#;Text unboxed)] argsS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [argsTI (translate-args translate argsS) returnT (method-return-type unboxed) #let [callI (|>. ($i;fuse (list/map product;right argsTI)) @@ -688,7 +688,7 @@ (case inputs (^ (list& [_ (#;Text class)] [_ (#;Text method)] [_ (#;Text unboxed)] objectS argsS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [objectI (translate objectS) argsTI (translate-args translate argsS) returnT (method-return-type unboxed) @@ -712,7 +712,7 @@ (-> Text @;Proc) (case inputs (^ (list& [_ (#;Text class)] argsS)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [argsTI (translate-args translate argsS)] (wrap (|>. ($i;NEW class) $i;DUP diff --git a/new-luxc/source/luxc/lang/translation/reference.jvm.lux b/new-luxc/source/luxc/lang/translation/reference.jvm.lux index b714558b8..9d0cc91e4 100644 --- a/new-luxc/source/luxc/lang/translation/reference.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/reference.jvm.lux @@ -3,7 +3,7 @@ (lux (control [monad #+ do]) (data [text "text/" Hash<Text>] text/format) - [meta "meta/" Monad<Meta>]) + [macro "macro/" Monad<Meta>]) (luxc ["&" lang] (lang [";L" host] (host ["$" jvm] @@ -24,7 +24,7 @@ (def: #export (translate-captured variable) (-> Variable (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [function-class hostL;context] (wrap (|>. ($i;ALOAD +0) ($i;GETFIELD function-class @@ -33,7 +33,7 @@ (def: #export (translate-local variable) (-> Variable (Meta $;Inst)) - (meta/wrap ($i;ALOAD (int-to-nat variable)))) + (macro/wrap ($i;ALOAD (int-to-nat variable)))) (def: #export (translate-variable variable) (-> Variable (Meta $;Inst)) @@ -44,4 +44,4 @@ (def: #export (translate-definition [def-module def-name]) (-> Ident (Meta $;Inst)) (let [bytecode-name (format def-module "/" (&;normalize-name def-name) (%n (text/hash def-name)))] - (meta/wrap ($i;GETSTATIC bytecode-name commonT;value-field commonT;$Object)))) + (macro/wrap ($i;GETSTATIC bytecode-name commonT;value-field commonT;$Object)))) diff --git a/new-luxc/source/luxc/lang/translation/runtime.jvm.lux b/new-luxc/source/luxc/lang/translation/runtime.jvm.lux index fa6d6dcad..87174b192 100644 --- a/new-luxc/source/luxc/lang/translation/runtime.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/runtime.jvm.lux @@ -4,7 +4,7 @@ (data text/format (coll [list "list/" Functor<List>])) [math] - [meta] + [macro] [host]) (luxc ["&" lang] (lang [";L" host] @@ -579,7 +579,7 @@ (def: translate-runtime (Meta commonT;Bytecode) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (wrap []) #let [bytecode ($d;class #$;V1.6 #$;Public $;finalC hostL;runtime-class (list) ["java.lang.Object" (list)] (list) (|>. adt-methods @@ -594,7 +594,7 @@ (def: translate-function (Meta commonT;Bytecode) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [_ (wrap []) #let [applyI (|> (list;n.range +2 num-apply-variants) (list/map (function [arity] @@ -625,7 +625,7 @@ (def: #export translate (Meta [commonT;Bytecode commonT;Bytecode]) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [runtime-bc translate-runtime function-bc translate-function] (wrap [runtime-bc function-bc]))) diff --git a/new-luxc/source/luxc/lang/translation/statement.jvm.lux b/new-luxc/source/luxc/lang/translation/statement.jvm.lux index 232519d8b..387181f98 100644 --- a/new-luxc/source/luxc/lang/translation/statement.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/statement.jvm.lux @@ -7,7 +7,7 @@ [text "text/" Monoid<Text> Hash<Text>] text/format (coll [list "list/" Functor<List> Fold<List>])) - [meta] + [macro] [host]) (luxc ["&" lang] ["&;" io] @@ -34,8 +34,8 @@ (def: #export (translate-def def-name valueT valueI metaI metaV) (-> Text Type $;Inst $;Inst Code (Meta Unit)) - (do meta;Monad<Meta> - [current-module meta;current-module-name + (do macro;Monad<Meta> + [current-module macro;current-module-name #let [def-ident [current-module def-name] normal-name (format (&;normalize-name def-name) (%n (text/hash def-name))) bytecode-name (format current-module "/" normal-name) @@ -68,13 +68,13 @@ "Error:\n" error)))) _ (&module;define def-ident [valueT metaV valueV]) - _ (if (meta;type? metaV) - (case (meta;declared-tags metaV) + _ (if (macro;type? metaV) + (case (macro;declared-tags metaV) #;Nil (wrap []) tags - (&module;declare-tags tags (meta;export? metaV) (:! Type valueV))) + (&module;declare-tags tags (macro;export? metaV) (:! Type valueV))) (wrap [])) #let [_ (log! (format "DEF " (%ident def-ident)))]] (commonT;record-artifact (format bytecode-name ".class") bytecode))) diff --git a/new-luxc/source/luxc/lang/translation/structure.jvm.lux b/new-luxc/source/luxc/lang/translation/structure.jvm.lux index 2c04eaa0c..21d72b34b 100644 --- a/new-luxc/source/luxc/lang/translation/structure.jvm.lux +++ b/new-luxc/source/luxc/lang/translation/structure.jvm.lux @@ -4,7 +4,7 @@ ["ex" exception #+ exception:]) (data text/format (coll [list])) - [meta] + [macro] [host #+ do-to]) (luxc ["&" lang] (lang [";L" host] @@ -23,7 +23,7 @@ (def: #export (translate-tuple translate members) (-> (-> ls;Synthesis (Meta $;Inst)) (List ls;Synthesis) (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [#let [size (list;size members)] _ (&;assert Not-A-Tuple (%code (` [(~@ members)])) (n.>= +2 size)) @@ -49,7 +49,7 @@ (def: #export (translate-variant translate tag tail? member) (-> (-> ls;Synthesis (Meta $;Inst)) Nat Bool ls;Synthesis (Meta $;Inst)) - (do meta;Monad<Meta> + (do macro;Monad<Meta> [memberI (translate member)] (wrap (|>. ($i;int (nat-to-int tag)) (flagI tail?) |