diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/lux.lux | 402 |
1 files changed, 201 insertions, 201 deletions
diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index af5a0d142..ed2d81667 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -332,7 +332,7 @@ (#Cons (#TextA "line") (#Cons (#TextA "column") #Nil))))] - (#Cons [["lux" "doc"] (#TextA "Cursors are for specifying the location of AST nodes in Lux files during compilation.")] + (#Cons [["lux" "doc"] (#TextA "Cursors are for specifying the location of Code nodes in Lux files during compilation.")] default-def-meta-exported))) ## (type: (Meta m v) @@ -387,7 +387,7 @@ #Nil)))))] default-def-meta-exported)) -## (type: (AST' w) +## (type: (Code' w) ## (#Bool Bool) ## (#Nat Nat) ## (#Int Int) @@ -397,17 +397,17 @@ ## (#Text Text) ## (#Symbol Text Text) ## (#Tag Text Text) -## (#Form (List (w (AST' w)))) -## (#Tuple (List (w (AST' w)))) -## (#Record (List [(w (AST' w)) (w (AST' w))]))) -(_lux_def AST' - (#Named ["lux" "AST'"] +## (#Form (List (w (Code' w)))) +## (#Tuple (List (w (Code' w)))) +## (#Record (List [(w (Code' w)) (w (Code' w))]))) +(_lux_def Code' + (#Named ["lux" "Code'"] (_lux_case (#App (#Bound +1) (#App (#Bound +0) (#Bound +1))) - AST - (_lux_case (#App [List AST]) - AST-List + Code + (_lux_case (#App [List Code]) + Code-List (#UnivQ #Nil (#Sum ## "lux;Bool" Bool @@ -428,11 +428,11 @@ (#Sum ## "lux;Tag" Ident (#Sum ## "lux;Form" - AST-List + Code-List (#Sum ## "lux;Tuple" - AST-List + Code-List ## "lux;Record" - (#App List (#Product AST AST)) + (#App List (#Product Code Code)) ))))))))))) )))) (#Cons [["lux" "tags"] (#ListA (#Cons (#TextA "Bool") @@ -451,18 +451,18 @@ (#Cons [["lux" "type-args"] (#ListA (#Cons (#TextA "w") #;Nil))] default-def-meta-exported))) -## (type: AST -## (Meta Cursor (AST' (Meta Cursor)))) -(_lux_def AST - (#Named ["lux" "AST"] +## (type: Code +## (Meta Cursor (Code' (Meta Cursor)))) +(_lux_def Code + (#Named ["lux" "Code"] (_lux_case (#App Meta Cursor) w - (#App w (#App AST' w)))) - (#Cons [["lux" "doc"] (#TextA "The type of AST nodes for Lux syntax.")] + (#App w (#App Code' w)))) + (#Cons [["lux" "doc"] (#TextA "The type of Code nodes for Lux syntax.")] default-def-meta-exported)) -(_lux_def AST-List - (#App List AST) +(_lux_def Code-List + (#App List Code) default-def-meta-unexported) ## (type: (Either l r) @@ -680,10 +680,10 @@ default-def-meta-exported))) ## (type: Macro -## (-> (List AST) (Lux (List AST)))) +## (-> (List Code) (Lux (List Code)))) (_lux_def Macro (#Named ["lux" "Macro"] - (#Function AST-List (#App Lux AST-List))) + (#Function Code-List (#App Lux Code-List))) (#Cons [["lux" "doc"] (#TextA "Functions that run at compile-time and allow you to transform and extend the language in powerful ways.")] default-def-meta-exported)) @@ -693,9 +693,9 @@ #Nil) (_lux_def _meta - (_lux_: (#Function (#App AST' + (_lux_: (#Function (#App Code' (#App Meta Cursor)) - AST) + Code) (_lux_function _ data [_cursor data])) #Nil) @@ -725,62 +725,62 @@ #Nil) (_lux_def bool$ - (_lux_: (#Function Bool AST) + (_lux_: (#Function Bool Code) (_lux_function _ value (_meta (#Bool value)))) #Nil) (_lux_def nat$ - (_lux_: (#Function Nat AST) + (_lux_: (#Function Nat Code) (_lux_function _ value (_meta (#Nat value)))) #Nil) (_lux_def int$ - (_lux_: (#Function Int AST) + (_lux_: (#Function Int Code) (_lux_function _ value (_meta (#Int value)))) #Nil) (_lux_def deg$ - (_lux_: (#Function Deg AST) + (_lux_: (#Function Deg Code) (_lux_function _ value (_meta (#Deg value)))) #Nil) (_lux_def real$ - (_lux_: (#Function Real AST) + (_lux_: (#Function Real Code) (_lux_function _ value (_meta (#Real value)))) #Nil) (_lux_def char$ - (_lux_: (#Function Char AST) + (_lux_: (#Function Char Code) (_lux_function _ value (_meta (#Char value)))) #Nil) (_lux_def text$ - (_lux_: (#Function Text AST) + (_lux_: (#Function Text Code) (_lux_function _ text (_meta (#Text text)))) #Nil) (_lux_def symbol$ - (_lux_: (#Function Ident AST) + (_lux_: (#Function Ident Code) (_lux_function _ ident (_meta (#Symbol ident)))) #Nil) (_lux_def tag$ - (_lux_: (#Function Ident AST) + (_lux_: (#Function Ident Code) (_lux_function _ ident (_meta (#Tag ident)))) #Nil) (_lux_def form$ - (_lux_: (#Function (#App List AST) AST) + (_lux_: (#Function (#App List Code) Code) (_lux_function _ tokens (_meta (#Form tokens)))) #Nil) (_lux_def tuple$ - (_lux_: (#Function (#App List AST) AST) + (_lux_: (#Function (#App List Code) Code) (_lux_function _ tokens (_meta (#Tuple tokens)))) #Nil) (_lux_def record$ - (_lux_: (#Function (#App List (#Product AST AST)) AST) + (_lux_: (#Function (#App List (#Product Code Code)) Code) (_lux_function _ tokens (_meta (#Record tokens)))) #Nil) @@ -842,7 +842,7 @@ default-macro-meta) (_lux_def export?-meta - (_lux_: AST + (_lux_: Code (tuple$ (#Cons [(tuple$ (#Cons [(text$ "lux") (#Cons [(text$ "export?") #Nil])])) (#Cons [(form$ (#Cons [(tag$ ["lux" "BoolA"]) (#Cons [(bool$ true) @@ -851,7 +851,7 @@ #Nil) (_lux_def hidden?-meta - (_lux_: AST + (_lux_: Code (tuple$ (#Cons [(tuple$ (#Cons [(text$ "lux") (#Cons [(text$ "hidden?") #Nil])])) (#Cons [(form$ (#Cons [(tag$ ["lux" "BoolA"]) (#Cons [(bool$ true) @@ -860,7 +860,7 @@ #Nil) (_lux_def macro?-meta - (_lux_: AST + (_lux_: Code (tuple$ (#Cons [(tuple$ (#Cons [(text$ "lux") (#Cons [(text$ "macro?") #Nil])])) (#Cons [(form$ (#Cons [(tag$ ["lux" "BoolA"]) (#Cons [(bool$ true) @@ -869,7 +869,7 @@ #Nil) (_lux_def with-export-meta - (_lux_: (#Function AST AST) + (_lux_: (#Function Code Code) (function'' [tail] (form$ (#Cons (tag$ ["lux" "Cons"]) (#Cons export?-meta @@ -877,7 +877,7 @@ #Nil) (_lux_def with-hidden-meta - (_lux_: (#Function AST AST) + (_lux_: (#Function Code Code) (function'' [tail] (form$ (#Cons (tag$ ["lux" "Cons"]) (#Cons hidden?-meta @@ -885,7 +885,7 @@ #Nil) (_lux_def with-macro-meta - (_lux_: (#Function AST AST) + (_lux_: (#Function Code Code) (function'' [tail] (form$ (#Cons (tag$ ["lux" "Cons"]) (#Cons macro?-meta @@ -1028,11 +1028,11 @@ (def:'' RepEnv #Nil Type - ($' List (#Product Text AST))) + ($' List (#Product Text Code))) (def:'' (make-env xs ys) #Nil - (#Function ($' List Text) (#Function ($' List AST) RepEnv)) + (#Function ($' List Text) (#Function ($' List Code) RepEnv)) (_lux_case [xs ys] [(#Cons x xs') (#Cons y ys')] (#Cons [x y] (make-env xs' ys')) @@ -1047,7 +1047,7 @@ (def:'' (get-rep key env) #Nil - (#Function Text (#Function RepEnv ($' Maybe AST))) + (#Function Text (#Function RepEnv ($' Maybe Code))) (_lux_case env #Nil #None @@ -1062,7 +1062,7 @@ (def:'' (replace-syntax reps syntax) #Nil - (#Function RepEnv (#Function AST AST)) + (#Function RepEnv (#Function Code Code)) (_lux_case syntax [_ (#Symbol "" name)] (_lux_case (get-rep name reps) @@ -1079,7 +1079,7 @@ [meta (#Tuple (map (replace-syntax reps) members))] [meta (#Record slots)] - [meta (#Record (map (_lux_: (#Function (#Product AST AST) (#Product AST AST)) + [meta (#Record (map (_lux_: (#Function (#Product Code Code) (#Product Code Code)) (function'' [slot] (_lux_case slot [k v] @@ -1092,13 +1092,13 @@ (def:'' (update-bounds ast) #Nil - (#Function AST AST) + (#Function Code Code) (_lux_case ast [_ (#Tuple members)] (tuple$ (map update-bounds members)) [_ (#Record pairs)] - (record$ (map (_lux_: (#Function (#Product AST AST) (#Product AST AST)) + (record$ (map (_lux_: (#Function (#Product Code Code) (#Product Code Code)) (function'' [pair] (let'' [name val] pair [name (update-bounds val)]))) @@ -1115,10 +1115,10 @@ (def:'' (parse-quantified-args args next) #Nil - ## (-> (List AST) (-> (List Text) (Lux (List AST))) (Lux (List AST))) - (#Function ($' List AST) - (#Function (#Function ($' List Text) (#App Lux ($' List AST))) - (#App Lux ($' List AST)) + ## (-> (List Code) (-> (List Text) (Lux (List Code))) (Lux (List Code))) + (#Function ($' List Code) + (#Function (#Function ($' List Text) (#App Lux ($' List Code))) + (#App Lux ($' List Code)) )) (_lux_case args #Nil @@ -1133,7 +1133,7 @@ (def:'' (make-bound idx) #Nil - (#Function Nat AST) + (#Function Nat Code) (form$ (#Cons (tag$ ["lux" "Bound"]) (#Cons (nat$ idx) #Nil)))) (def:'' (fold f init xs) @@ -1178,7 +1178,7 @@ (#Cons [_ (#Tuple args)] (#Cons body #Nil)) (parse-quantified-args args (function'' [names] - (let'' body' (fold (_lux_: (#Function Text (#Function AST AST)) + (let'' body' (fold (_lux_: (#Function Text (#Function Code Code)) (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "UnivQ"]) (#Cons (tag$ ["lux" "Nil"]) @@ -1229,7 +1229,7 @@ (#Cons [_ (#Tuple args)] (#Cons body #Nil)) (parse-quantified-args args (function'' [names] - (let'' body' (fold (_lux_: (#Function Text (#Function AST AST)) + (let'' body' (fold (_lux_: (#Function Text (#Function Code Code)) (function'' [name' body'] (form$ (#Cons (tag$ ["lux" "ExQ"]) (#Cons (tag$ ["lux" "Nil"]) @@ -1273,7 +1273,7 @@ #;Nil) (_lux_case (reverse tokens) (#Cons output inputs) - (return (#Cons (fold (_lux_: (#Function AST (#Function AST AST)) + (return (#Cons (fold (_lux_: (#Function Code (#Function Code Code)) (function'' [i o] (form$ (#Cons (tag$ ["lux" "Function"]) (#Cons i (#Cons o #Nil)))))) output inputs) @@ -1430,8 +1430,8 @@ (macro:' (let' tokens) (_lux_case tokens (#Cons [[_ (#Tuple bindings)] (#Cons [body #Nil])]) - (return (list (fold (_lux_: (-> (& AST AST) AST - AST) + (return (list (fold (_lux_: (-> (& Code Code) Code + Code) (function' [binding body] (_lux_case binding [label value] @@ -1457,7 +1457,7 @@ (def:''' (spliced? token) #Nil - (-> AST Bool) + (-> Code Bool) (_lux_case token [_ (#Form (#Cons [[_ (#Symbol ["" "~@"])] (#Cons [_ #Nil])]))] true @@ -1467,13 +1467,13 @@ (def:''' (wrap-meta content) #Nil - (-> AST AST) + (-> Code Code) (tuple$ (list (tuple$ (list (text$ "") (nat$ +0) (nat$ +0))) content))) (def:''' (untemplate-list tokens) #Nil - (-> ($' List AST) AST) + (-> ($' List Code) Code) (_lux_case tokens #Nil (_meta (#Tag ["lux" "Nil"])) @@ -1494,7 +1494,7 @@ (def:''' #export (splice-helper xs ys) (#Cons [["lux" "hidden?"] (#BoolA true)] #;Nil) - (-> ($' List AST) ($' List AST) ($' List AST)) + (-> ($' List Code) ($' List Code) ($' List Code)) (_lux_case xs (#Cons x xs') (#Cons x (splice-helper xs' ys)) @@ -1595,7 +1595,7 @@ (#Cons monad (#Cons [_ (#Tuple bindings)] (#Cons body #Nil))) (let' [g!wrap (symbol$ ["" "wrap"]) g!bind (symbol$ ["" " bind "]) - body' (fold (_lux_: (-> (& AST AST) AST AST) + body' (fold (_lux_: (-> (& Code Code) Code Code) (function' [binding body'] (let' [[var value] binding] (_lux_case var @@ -1744,15 +1744,15 @@ (def:''' (splice replace? untemplate tag elems) #Nil - (-> Bool (-> AST ($' Lux AST)) AST ($' List AST) ($' Lux AST)) + (-> Bool (-> Code ($' Lux Code)) Code ($' List Code) ($' Lux Code)) (_lux_case replace? true (_lux_case (any? spliced? elems) true (do Monad<Lux> - [elems' (_lux_: ($' Lux ($' List AST)) + [elems' (_lux_: ($' Lux ($' List Code)) (mapM Monad<Lux> - (_lux_: (-> AST ($' Lux AST)) + (_lux_: (-> Code ($' Lux Code)) (function' [elem] (_lux_case elem [_ (#Form (#Cons [[_ (#Symbol ["" "~@"])] (#Cons [spliced #Nil])]))] @@ -1762,7 +1762,7 @@ (do Monad<Lux> [=elem (untemplate elem)] (wrap (form$ (list (symbol$ ["" "_lux_:"]) - (form$ (list (tag$ ["lux" "App"]) (tuple$ (list (symbol$ ["lux" "List"]) (symbol$ ["lux" "AST"]))))) + (form$ (list (tag$ ["lux" "App"]) (tuple$ (list (symbol$ ["lux" "List"]) (symbol$ ["lux" "Code"]))))) (form$ (list (tag$ ["lux" "Cons"]) (tuple$ (list =elem (tag$ ["lux" "Nil"])))))))))))) elems))] (wrap (wrap-meta (form$ (list tag @@ -1781,7 +1781,7 @@ (def:''' (untemplate replace? subst token) #Nil - (-> Bool Text AST ($' Lux AST)) + (-> Bool Text Code ($' Lux Code)) (_lux_case [replace? token] [_ [_ (#Bool value)]] (return (wrap-meta (form$ (list (tag$ ["lux" "Bool"]) (bool$ value))))) @@ -1850,7 +1850,7 @@ [_ [_ (#Record fields)]] (do Monad<Lux> [=fields (mapM Monad<Lux> - (_lux_: (-> (& AST AST) ($' Lux AST)) + (_lux_: (-> (& Code Code) ($' Lux Code)) (function' [kv] (let' [[k v] kv] (do Monad<Lux> @@ -1903,7 +1903,7 @@ (do Monad<Lux> [current-module current-module-name =template (untemplate true current-module template)] - (wrap (list (form$ (list (symbol$ ["" "_lux_:"]) (symbol$ ["lux" "AST"]) =template))))) + (wrap (list (form$ (list (symbol$ ["" "_lux_:"]) (symbol$ ["lux" "Code"]) =template))))) _ (fail "Wrong syntax for `"))) @@ -1917,7 +1917,7 @@ (#Cons template #Nil) (do Monad<Lux> [=template (untemplate true "" template)] - (wrap (list (form$ (list (symbol$ ["" "_lux_:"]) (symbol$ ["lux" "AST"]) =template))))) + (wrap (list (form$ (list (symbol$ ["" "_lux_:"]) (symbol$ ["lux" "Code"]) =template))))) _ (fail "Wrong syntax for `"))) @@ -1929,7 +1929,7 @@ (#Cons template #Nil) (do Monad<Lux> [=template (untemplate false "" template)] - (wrap (list (form$ (list (symbol$ ["" "_lux_:"]) (symbol$ ["lux" "AST"]) =template))))) + (wrap (list (form$ (list (symbol$ ["" "_lux_:"]) (symbol$ ["lux" "Code"]) =template))))) _ (fail "Wrong syntax for '"))) @@ -1944,7 +1944,7 @@ (map Int/encode elems)))")]) (_lux_case tokens (#Cons [init apps]) - (return (list (fold (_lux_: (-> AST AST AST) + (return (list (fold (_lux_: (-> Code Code Code) (function' [app acc] (_lux_case app [_ (#Tuple parts)] @@ -1971,7 +1971,7 @@ (map Int/encode elems)))")]) (_lux_case (reverse tokens) (#Cons [init apps]) - (return (list (fold (_lux_: (-> AST AST AST) + (return (list (fold (_lux_: (-> Code Code Code) (function' [app acc] (_lux_case app [_ (#Tuple parts)] @@ -1996,7 +1996,7 @@ (def:''' (get-ident x) #Nil - (-> AST ($' Maybe Ident)) + (-> Code ($' Maybe Ident)) (_lux_case x [_ (#Symbol sname)] (#Some sname) @@ -2006,7 +2006,7 @@ (def:''' (get-tag x) #Nil - (-> AST ($' Maybe Ident)) + (-> Code ($' Maybe Ident)) (_lux_case x [_ (#Tag sname)] (#Some sname) @@ -2016,7 +2016,7 @@ (def:''' (get-name x) #Nil - (-> AST ($' Maybe Text)) + (-> Code ($' Maybe Text)) (_lux_case x [_ (#Symbol "" sname)] (#Some sname) @@ -2026,7 +2026,7 @@ (def:''' (tuple->list tuple) #Nil - (-> AST ($' Maybe ($' List AST))) + (-> Code ($' Maybe ($' List Code))) (_lux_case tuple [_ (#Tuple members)] (#Some members) @@ -2036,7 +2036,7 @@ (def:''' (apply-template env template) #Nil - (-> RepEnv AST AST) + (-> RepEnv Code Code) (_lux_case template [_ (#Symbol "" sname)] (_lux_case (get-rep sname env) @@ -2053,7 +2053,7 @@ [meta (#Form (map (apply-template env) elems))] [meta (#Record members)] - [meta (#Record (map (_lux_: (-> (& AST AST) (& AST AST)) + [meta (#Record (map (_lux_: (-> (& Code Code) (& Code Code)) (function' [kv] (let' [[slot value] kv] [(apply-template env slot) (apply-template env value)]))) @@ -2093,7 +2093,7 @@ (_lux_case [(mapM Monad<Maybe> get-name bindings) (mapM Monad<Maybe> tuple->list data)] [(#Some bindings') (#Some data')] - (let' [apply (_lux_: (-> RepEnv ($' List AST)) + (let' [apply (_lux_: (-> RepEnv ($' List Code)) (function' [env] (map (apply-template env) templates))) num-bindings (length bindings')] (if (every? (function' [sample] (_lux_proc ["int" "="] [num-bindings sample])) @@ -2396,7 +2396,7 @@ (def:''' (macro-expand-once token) #Nil - (-> AST ($' Lux ($' List AST))) + (-> Code ($' Lux ($' List Code))) (_lux_case token [_ (#Form (#Cons [_ (#Symbol macro-name)] args))] (do Monad<Lux> @@ -2414,7 +2414,7 @@ (def:''' (macro-expand token) #Nil - (-> AST ($' Lux ($' List AST))) + (-> Code ($' Lux ($' List Code))) (_lux_case token [_ (#Form (#Cons [_ (#Symbol macro-name)] args))] (do Monad<Lux> @@ -2435,7 +2435,7 @@ (def:''' (macro-expand-all syntax) #Nil - (-> AST ($' Lux ($' List AST))) + (-> Code ($' Lux ($' List Code))) (_lux_case syntax [_ (#Form (#Cons [_ (#Symbol macro-name)] args))] (do Monad<Lux> @@ -2475,7 +2475,7 @@ (return [key val'']) _ - (fail "The value-part of a KV-pair in a record must macro-expand to a single AST."))))) + (fail "The value-part of a KV-pair in a record must macro-expand to a single Code."))))) pairs)] (wrap (list (record$ pairs')))) @@ -2484,7 +2484,7 @@ (def:''' (walk-type type) #Nil - (-> AST AST) + (-> Code Code) (_lux_case type [_ (#Form (#Cons [_ (#Tag tag)] parts))] (form$ (#Cons [(tag$ tag) (map walk-type parts)])) @@ -2493,7 +2493,7 @@ (` (& (~@ (map walk-type members)))) [_ (#Form (#Cons type-fn args))] - (fold (_lux_: (-> AST AST AST) + (fold (_lux_: (-> Code Code Code) (function' [arg type-fn] (` (#;App (~ type-fn) (~ arg))))) (walk-type type-fn) (map walk-type args)) @@ -2556,12 +2556,12 @@ (def:''' (unfold-type-def type-asts) #Nil - (-> ($' List AST) ($' Lux (& AST ($' Maybe ($' List Text))))) + (-> ($' List Code) ($' Lux (& Code ($' Maybe ($' List Text))))) (_lux_case type-asts (#Cons [_ (#Record pairs)] #;Nil) (do Monad<Lux> [members (mapM Monad<Lux> - (: (-> [AST AST] (Lux [Text AST])) + (: (-> [Code Code] (Lux [Text Code])) (function' [pair] (_lux_case pair [[_ (#Tag "" member-name)] member-type] @@ -2587,7 +2587,7 @@ (#Cons case cases) (do Monad<Lux> [members (mapM Monad<Lux> - (: (-> AST (Lux [Text AST])) + (: (-> Code (Lux [Text Code])) (function' [case] (_lux_case case [_ (#Tag "" member-name)] @@ -2610,7 +2610,7 @@ (def:''' (gensym prefix state) #Nil - (-> Text ($' Lux AST)) + (-> Text ($' Lux Code)) (_lux_case state {#info info #source source #modules modules #scopes scopes #type-context types #host host @@ -2648,7 +2648,7 @@ (_lux_case (reverse tokens) (#Cons value actions) (let' [dummy (symbol$ ["" ""])] - (return (list (fold (_lux_: (-> AST AST AST) + (return (list (fold (_lux_: (-> Code Code Code) (function' [pre post] (` (;_lux_case (~ pre) (~ dummy) (~ post))))) value actions)))) @@ -2663,7 +2663,7 @@ _ [false tokens]) - parts (: (Maybe [AST (List AST) (Maybe AST) AST]) + parts (: (Maybe [Code (List Code) (Maybe Code) Code]) (_lux_case tokens' (#Cons [_ (#Form (#Cons name args))] (#Cons type (#Cons body #Nil))) (#Some name args (#Some type) body) @@ -2702,12 +2702,12 @@ (fail "Wrong syntax for def'")))) (def:' (rejoin-pair pair) - (-> [AST AST] (List AST)) + (-> [Code Code] (List Code)) (let' [[left right] pair] (list left right))) (def:' (ast-to-text ast) - (-> AST Text) + (-> Code Text) (_lux_case ast [_ (#Bool value)] (Bool/encode value) @@ -2763,7 +2763,7 @@ )) (def:' (expander branches) - (-> (List AST) (Lux (List AST))) + (-> (List Code) (Lux (List Code))) (_lux_case branches (#;Cons [_ (#Form (#Cons [_ (#Symbol macro-name)] macro-args))] (#;Cons body @@ -2871,7 +2871,7 @@ (fail "Wrong syntax for ^or"))) (def:' (symbol? ast) - (-> AST Bool) + (-> Code Bool) (case ast [_ (#Symbol _)] true @@ -2889,7 +2889,7 @@ (^ (list [_ (#Tuple bindings)] body)) (if (multiple? 2 (length bindings)) (|> bindings as-pairs reverse - (fold (: (-> [AST AST] AST AST) + (fold (: (-> [Code Code] Code Code) (function' [lr body'] (let' [[l r] lr] (if (symbol? l) @@ -2911,7 +2911,7 @@ (: (All [a b] (-> a b a)) (function const [x y] x))")]) - (case (: (Maybe [Ident AST (List AST) AST]) + (case (: (Maybe [Ident Code (List Code) Code]) (case tokens (^ (list [_ (#Tuple (#Cons head tail))] body)) (#Some ["" ""] head tail body) @@ -2924,7 +2924,7 @@ (#Some ident head tail body) (let [g!blank (symbol$ ["" ""]) g!name (symbol$ ident) - body+ (fold (: (-> AST AST AST) + body+ (fold (: (-> Code Code Code) (function' [arg body'] (if (symbol? arg) (` (;_lux_function (~ g!blank) (~ arg) (~ body'))) @@ -2940,7 +2940,7 @@ (fail "Wrong syntax for function"))) (def:' (process-def-meta-value ast) - (-> AST (Lux AST)) + (-> Code (Lux Code)) (case ast [_ (#Bool value)] (return (form$ (list (tag$ ["lux" "BoolA"]) (bool$ value)))) @@ -2977,7 +2977,7 @@ [_ (#Record kvs)] (do Monad<Lux> [=xs (mapM Monad<Lux> - (: (-> [AST AST] (Lux AST)) + (: (-> [Code Code] (Lux Code)) (function [[k v]] (case k [_ (#Text =k)] @@ -2992,12 +2992,12 @@ )) (def:' (process-def-meta ast) - (-> AST (Lux AST)) + (-> Code (Lux Code)) (case ast [_ (#Record kvs)] (do Monad<Lux> [=kvs (mapM Monad<Lux> - (: (-> [AST AST] (Lux AST)) + (: (-> [Code Code] (Lux Code)) (function [[k v]] (case k [_ (#Tag [pk nk])] @@ -3015,7 +3015,7 @@ (fail (Text/append "Wrong syntax for Anns: " (ast-to-text ast))))) (def:' (with-func-args args meta) - (-> (List AST) AST AST) + (-> (List Code) Code Code) (case args #;Nil meta @@ -3028,7 +3028,7 @@ (~ meta))))) (def:' (with-type-args args) - (-> (List AST) AST) + (-> (List Code) Code) (` {#;type-args (#;ListA (list (~@ (map (function [arg] (` (#;TextA (~ (text$ (ast-to-text arg)))))) args))))})) @@ -3041,7 +3041,7 @@ )) (def:' (export-level^ tokens) - (-> (List AST) [(Maybe Export-Level) (List AST)]) + (-> (List Code) [(Maybe Export-Level) (List Code)]) (case tokens (#Cons [_ (#Tag [_ "export"])] tokens') [(#;Some (#;Left [])) tokens'] @@ -3053,7 +3053,7 @@ [#;None tokens])) (def:' (export-level ?el) - (-> (Maybe Export-Level) (List AST)) + (-> (Maybe Export-Level) (List Code)) (case ?el #;None (list) @@ -3067,7 +3067,7 @@ (macro:' #export (def: tokens) (list [["lux" "doc"] (#TextA "## Defines global constants/functions. (def: (rejoin-pair pair) - (-> [AST AST] (List AST)) + (-> [Code Code] (List Code)) (let [[left right] pair] (list left right))) @@ -3075,7 +3075,7 @@ Int 5)")]) (let [[export? tokens'] (export-level^ tokens) - parts (: (Maybe [AST (List AST) (Maybe AST) AST AST]) + parts (: (Maybe [Code (List Code) (Maybe Code) Code Code]) (case tokens' (^ (list [_ (#Form (#Cons name args))] meta type body)) (#Some [name args (#Some type) body meta]) @@ -3137,7 +3137,7 @@ (fail "Wrong syntax for def")))) (def: (meta-ast-add addition meta) - (-> [AST AST] AST AST) + (-> [Code Code] Code Code) (case [addition meta] [[name value] [cursor (#;Record pairs)]] [cursor (#;Record (#;Cons [name value] pairs))] @@ -3146,7 +3146,7 @@ meta)) (def: (meta-ast-merge addition base) - (-> AST AST AST) + (-> Code Code Code) (case addition [cursor (#;Record pairs)] (fold meta-ast-add base pairs) @@ -3167,7 +3167,7 @@ _ (fail \"Wrong syntax for ident-for\")))")]) (let [[exported? tokens] (export-level^ tokens) - name+args+meta+body?? (: (Maybe [Ident (List AST) AST AST]) + name+args+meta+body?? (: (Maybe [Ident (List Code) Code Code]) (case tokens (^ (list [_ (#;Form (list& [_ (#Symbol name)] args))] body)) (#Some [name args (` {}) body]) @@ -3215,7 +3215,7 @@ (: (-> a a Bool) >=))"} (let [[exported? tokens'] (export-level^ tokens) - ?parts (: (Maybe [Ident (List AST) AST (List AST)]) + ?parts (: (Maybe [Ident (List Code) Code (List Code)]) (case tokens' (^ (list& [_ (#Form (list& [_ (#Symbol name)] args))] [meta-rec-cursor (#;Record meta-rec-parts)] sigs)) (#Some name args [meta-rec-cursor (#;Record meta-rec-parts)] sigs) @@ -3236,9 +3236,9 @@ (do Monad<Lux> [name+ (normalize name) sigs' (mapM Monad<Lux> macro-expand sigs) - members (: (Lux (List [Text AST])) + members (: (Lux (List [Text Code])) (mapM Monad<Lux> - (: (-> AST (Lux [Text AST])) + (: (-> Code (Lux [Text Code])) (function [token] (case token (^ [_ (#Form (list [_ (#Symbol _ "_lux_:")] type [_ (#Symbol ["" name])]))]) @@ -3249,7 +3249,7 @@ (List/join sigs'))) #let [[_module _name] name+ def-name (symbol$ name) - sig-type (record$ (map (: (-> [Text AST] [AST AST]) + sig-type (record$ (map (: (-> [Text Code] [Code Code]) (function [[m-name m-type]] [(tag$ ["" m-name]) m-type])) members)) @@ -3312,7 +3312,7 @@ (default 20 #;None) => 20"} (case tokens (^ (list else maybe)) - (let [g!temp (: AST [_cursor (#;Symbol ["" ""])]) + (let [g!temp (: Code [_cursor (#;Symbol ["" ""])]) code (` (case (~ maybe) (#;Some (~ g!temp)) (~ g!temp) @@ -3570,11 +3570,11 @@ _ (fail "No tags available for type."))) - #let [tag-mappings (: (List [Text AST]) + #let [tag-mappings (: (List [Text Code]) (map (function [tag] [(second tag) (tag$ tag)]) tags))] members (mapM Monad<Lux> - (: (-> AST (Lux [AST AST])) + (: (-> Code (Lux [Code Code])) (function [token] (case token (^ [_ (#Form (list [_ (#Symbol _ "_lux_def")] [_ (#Symbol "" tag-name)] value meta))]) @@ -3609,7 +3609,7 @@ (or (lux;> test subject) (lux;= test subject))))"} (let [[exported? tokens'] (export-level^ tokens) - ?parts (: (Maybe [AST (List AST) AST AST (List AST)]) + ?parts (: (Maybe [Code (List Code) Code Code (List Code)]) (case tokens' (^ (list& [_ (#Form (list& name args))] [meta-rec-cursor (#;Record meta-rec-parts)] type defs)) (#Some name args type [meta-rec-cursor (#;Record meta-rec-parts)] defs) @@ -3684,7 +3684,7 @@ {#;doc <doc-msg>} (case (reverse tokens) (^ (list& last init)) - (return (list (fold (: (-> AST AST AST) + (return (list (fold (: (-> Code Code Code) (function [pre post] (` <form>))) last init))) @@ -3707,7 +3707,7 @@ _ [false tokens']) - parts (: (Maybe [Text (List AST) AST (List AST)]) + parts (: (Maybe [Text (List Code) Code (List Code)]) (case tokens' (^ (list [_ (#Symbol "" name)] [meta-cursor (#;Record meta-parts)] [type-cursor (#;Record type-parts)])) (#Some [name #Nil [meta-cursor (#;Record meta-parts)] (list [type-cursor (#;Record type-parts)])]) @@ -3736,10 +3736,10 @@ module-name current-module-name] (let [type-name (symbol$ ["" name]) [type tags??] type+tags?? - type-meta (: AST + type-meta (: Code (case tags?? (#Some tags) - (` {#;tags [(~@ (map (: (-> Text AST) + (` {#;tags [(~@ (map (: (-> Text Code) (function' [tag] (form$ (list (tag$ ["lux" "TextA"]) (text$ tag))))) @@ -3748,7 +3748,7 @@ _ (` {#;type? true}))) - type' (: (Maybe AST) + type' (: (Maybe Code) (if rec? (if (empty? args) (let [g!param (symbol$ ["" ""]) @@ -3801,9 +3801,9 @@ #import-refer Refer}) (def: (extract-defs defs) - (-> (List AST) (Lux (List Text))) + (-> (List Code) (Lux (List Text))) (mapM Monad<Lux> - (: (-> AST (Lux Text)) + (: (-> Code (Lux Text)) (function [def] (case def [_ (#Symbol ["" name])] @@ -3814,7 +3814,7 @@ defs)) (def: (parse-alias tokens) - (-> (List AST) (Lux [(Maybe Text) (List AST)])) + (-> (List Code) (Lux [(Maybe Text) (List Code)])) (case tokens (^ (list& [_ (#Tag "" "as")] [_ (#Symbol "" alias)] tokens')) (return [(#Some alias) tokens']) @@ -3823,7 +3823,7 @@ (return [#None tokens]))) (def: (parse-referrals tokens) - (-> (List AST) (Lux [Referrals (List AST)])) + (-> (List Code) (Lux [Referrals (List Code)])) (case tokens (^ (list& [_ (#Tag ["" "refer"])] referral tokens')) (case referral @@ -3865,7 +3865,7 @@ [(reverse ys') xs'])) (def: (parse-short-referrals tokens) - (-> (List AST) (Lux [Referrals (List AST)])) + (-> (List Code) (Lux [Referrals (List Code)])) (case tokens (^ (list& [_ (#Tag "" "+")] tokens')) (let [[defs tokens'] (split-with symbol? tokens')] @@ -3886,7 +3886,7 @@ (return [#Nothing tokens]))) (def: (extract-symbol syntax) - (-> AST (Lux Ident)) + (-> Code (Lux Ident)) (case syntax [_ (#Symbol ident)] (return ident) @@ -3895,11 +3895,11 @@ (fail "Not a symbol."))) (def: (parse-openings tokens) - (-> (List AST) (Lux [(List Openings) (List AST)])) + (-> (List Code) (Lux [(List Openings) (List Code)])) (case tokens (^ (list& [_ (#Tag "" "open")] [_ (#Form parts)] tokens')) (if (|> parts - (map (: (-> AST Bool) + (map (: (-> Code Bool) (function [part] (case part (^or [_ (#Text _)] [_ (#Symbol _)]) @@ -3908,7 +3908,7 @@ _ false)))) (fold (function [r l] (and l r)) true)) - (let [openings (fold (: (-> AST (List Openings) (List Openings)) + (let [openings (fold (: (-> Code (List Openings) (List Openings)) (function [part openings] (case part [_ (#Text prefix)] @@ -3933,9 +3933,9 @@ (return [(list) tokens]))) (def: (parse-short-openings parts) - (-> (List AST) (Lux [(List Openings) (List AST)])) + (-> (List Code) (Lux [(List Openings) (List Code)])) (if (|> parts - (map (: (-> AST Bool) + (map (: (-> Code Bool) (function [part] (case part (^or [_ (#Text _)] [_ (#Symbol _)]) @@ -3944,7 +3944,7 @@ _ false)))) (fold (function [r l] (and l r)) true)) - (let [openings (fold (: (-> AST (List Openings) (List Openings)) + (let [openings (fold (: (-> Code (List Openings) (List Openings)) (function [part openings] (case part [_ (#Text prefix)] @@ -4005,10 +4005,10 @@ )) (def: (parse-imports imports) - (-> (List AST) (Lux (List Importation))) + (-> (List Code) (Lux (List Importation))) (do Monad<Lux> [imports' (mapM Monad<Lux> - (: (-> AST (Lux (List Importation))) + (: (-> Code (Lux (List Importation))) (function [token] (case token [_ (#Symbol "" m-name)] @@ -4297,7 +4297,7 @@ (#;Some tags&members) (do Monad<Lux> - [full-body ((: (-> Ident [(List Ident) (List Type)] AST (Lux AST)) + [full-body ((: (-> Ident [(List Ident) (List Type)] Code (Lux Code)) (function recur [source [tags members] target] (let [pattern (record$ (map (function [[t-module t-name]] [(tag$ [t-module t-name]) @@ -4353,7 +4353,7 @@ (fail "cond requires an even number of arguments.") (case (reverse tokens) (^ (list& else branches')) - (return (list (fold (: (-> [AST AST] AST AST) + (return (list (fold (: (-> [Code Code] Code Code) (function [branch else] (let [[right left] branch] (` (if (~ left) (~ right) (~ else)))))) @@ -4397,7 +4397,7 @@ g!output (gensym "")] (case (resolve-struct-type type) (#Some members) - (let [pattern (record$ (map (: (-> [Ident [Nat Type]] [AST AST]) + (let [pattern (record$ (map (: (-> [Ident [Nat Type]] [Code Code]) (function [[[r-prefix r-name] [r-idx r-type]]] [(tag$ [r-prefix r-name]) (if (n.= idx r-idx) g!output @@ -4409,7 +4409,7 @@ (fail "get@ can only use records."))) (^ (list [_ (#Tuple slots)] record)) - (return (list (fold (: (-> AST AST AST) + (return (list (fold (: (-> Code Code Code) (function [slot inner] (` (;;get@ (~ slot) (~ inner))))) record @@ -4424,7 +4424,7 @@ (fail "Wrong syntax for get@"))) (def: (open-field prefix [module name] source type) - (-> Text Ident AST Type (Lux (List AST))) + (-> Text Ident Code Type (Lux (List Code))) (do Monad<Lux> [output (resolve-type-tags type) #let [source+ (` (get@ (~ (tag$ [module name])) (~ source)))]] @@ -4432,7 +4432,7 @@ (#Some [tags members]) (do Monad<Lux> [decls' (mapM Monad<Lux> - (: (-> [Ident Type] (Lux (List AST))) + (: (-> [Ident Type] (Lux (List Code))) (function [[sname stype]] (open-field prefix sname source+ stype))) (zip2 tags members))] (return (List/join decls'))) @@ -4466,7 +4466,7 @@ (case output (#Some [tags members]) (do Monad<Lux> - [decls' (mapM Monad<Lux> (: (-> [Ident Type] (Lux (List AST))) + [decls' (mapM Monad<Lux> (: (-> [Ident Type] (Lux (List Code))) (function [[sname stype]] (open-field prefix sname source stype))) (zip2 tags members))] (return (List/join decls'))) @@ -4509,7 +4509,7 @@ (wrap (is-member? imports import-name)))) (def: (read-refer module-name options) - (-> Text (List AST) (Lux Refer)) + (-> Text (List Code) (Lux Refer)) (do Monad<Lux> [referral+options (parse-referrals options) #let [[referral options] referral+options] @@ -4538,7 +4538,7 @@ (fold Text/append ""))))))) (def: (write-refer module-name [r-defs r-opens]) - (-> Text Refer (Lux (List AST))) + (-> Text Refer (Lux (List Code))) (do Monad<Lux> [current-module current-module-name #let [test-referrals (: (-> Text (List Text) (List Text) (Lux (List Unit))) @@ -4568,14 +4568,14 @@ #Nothing (wrap (list))) - #let [defs (map (: (-> Text AST) + #let [defs (map (: (-> Text Code) (function [def] (` (;_lux_def (~ (symbol$ ["" def])) (~ (symbol$ [module-name def])) (#Cons [["lux" "alias"] (#IdentA [(~ (text$ module-name)) (~ (text$ def))])] #Nil))))) defs') - openings (join-map (: (-> Openings (List AST)) + openings (join-map (: (-> Openings (List Code)) (function [[prefix structs]] (map (function [[_ name]] (` (open (~ (symbol$ [module-name name])) (~ (text$ prefix))))) structs))) @@ -4594,8 +4594,8 @@ (fail "Wrong syntax for refer"))) (def: (refer-to-ast module-name [r-defs r-opens]) - (-> Text Refer AST) - (let [=defs (: (List AST) + (-> Text Refer Code) + (let [=defs (: (List Code) (case r-defs #All (list (' #refer) (' #all)) @@ -4645,7 +4645,7 @@ (macro ast)) (.. [type \"\" Eq<Type>]))"} (do Monad<Lux> - [#let [[_meta _imports] (: [(List [AST AST]) (List AST)] + [#let [[_meta _imports] (: [(List [Code Code]) (List Code)] (case tokens (^ (list& [_ (#Record _meta)] _imports)) [_meta _imports] @@ -4653,11 +4653,11 @@ _ [(list) tokens]))] imports (parse-imports _imports) - #let [=imports (map (: (-> Importation AST) + #let [=imports (map (: (-> Importation Code) (function [[m-name m-alias =refer]] (` [(~ (text$ m-name)) (~ (text$ (default "" m-alias)))]))) imports) - =refers (map (: (-> Importation AST) + =refers (map (: (-> Importation Code) (function [[m-name m-alias =refer]] (refer-to-ast m-name =refer))) imports)] @@ -4706,17 +4706,17 @@ (#Some members) (do Monad<Lux> [pattern' (mapM Monad<Lux> - (: (-> [Ident [Nat Type]] (Lux [Ident Nat AST])) + (: (-> [Ident [Nat Type]] (Lux [Ident Nat Code])) (function [[r-slot-name [r-idx r-type]]] (do Monad<Lux> [g!slot (gensym "")] (return [r-slot-name r-idx g!slot])))) (zip2 tags (enumerate members)))] - (let [pattern (record$ (map (: (-> [Ident Nat AST] [AST AST]) + (let [pattern (record$ (map (: (-> [Ident Nat Code] [Code Code]) (function [[r-slot-name r-idx r-var]] [(tag$ r-slot-name) r-var])) pattern')) - output (record$ (map (: (-> [Ident Nat AST] [AST AST]) + output (record$ (map (: (-> [Ident Nat Code] [Code Code]) (function [[r-slot-name r-idx r-var]] [(tag$ r-slot-name) (if (n.= idx r-idx) value @@ -4735,20 +4735,20 @@ _ (do Monad<Lux> [bindings (mapM Monad<Lux> - (: (-> AST (Lux AST)) + (: (-> Code (Lux Code)) (function [_] (gensym "temp"))) slots) #let [pairs (zip2 slots bindings) - update-expr (fold (: (-> [AST AST] AST AST) + update-expr (fold (: (-> [Code Code] Code Code) (function [[s b] v] (` (;;set@ (~ s) (~ v) (~ b))))) value (reverse pairs)) - [_ accesses'] (fold (: (-> [AST AST] [AST (List (List AST))] [AST (List (List AST))]) + [_ accesses'] (fold (: (-> [Code Code] [Code (List (List Code))] [Code (List (List Code))]) (function [[new-slot new-binding] [old-record accesses']] [(` (get@ (~ new-slot) (~ new-binding))) (#;Cons (list new-binding old-record) accesses')])) - [record (: (List (List AST)) #;Nil)] + [record (: (List (List Code)) #;Nil)] pairs) accesses (List/join (reverse accesses'))]] (wrap (list (` (let [(~@ accesses)] @@ -4792,17 +4792,17 @@ (#Some members) (do Monad<Lux> [pattern' (mapM Monad<Lux> - (: (-> [Ident [Nat Type]] (Lux [Ident Nat AST])) + (: (-> [Ident [Nat Type]] (Lux [Ident Nat Code])) (function [[r-slot-name [r-idx r-type]]] (do Monad<Lux> [g!slot (gensym "")] (return [r-slot-name r-idx g!slot])))) (zip2 tags (enumerate members)))] - (let [pattern (record$ (map (: (-> [Ident Nat AST] [AST AST]) + (let [pattern (record$ (map (: (-> [Ident Nat Code] [Code Code]) (function [[r-slot-name r-idx r-var]] [(tag$ r-slot-name) r-var])) pattern')) - output (record$ (map (: (-> [Ident Nat AST] [AST AST]) + output (record$ (map (: (-> [Ident Nat Code] [Code Code]) (function [[r-slot-name r-idx r-var]] [(tag$ r-slot-name) (if (n.= idx r-idx) (` ((~ fun) (~ r-var))) @@ -4880,12 +4880,12 @@ (^ (list& [_ (#Form (list& [_ (#Tuple bindings)] templates))] [_ (#Form data)] branches)) - (case (: (Maybe (List AST)) + (case (: (Maybe (List Code)) (do Monad<Maybe> [bindings' (mapM Monad<Maybe> get-name bindings) data' (mapM Monad<Maybe> tuple->list data)] (if (every? (i.= (length bindings')) (map length data')) - (let [apply (: (-> RepEnv (List AST)) + (let [apply (: (-> RepEnv (List Code)) (function [env] (map (apply-template env) templates)))] (|> data' (join-map (. apply (make-env bindings'))) @@ -4910,7 +4910,7 @@ ) (def: (find-baseline-column ast) - (-> AST Nat) + (-> Code Nat) (case ast (^template [<tag>] [[_ _ column] (<tag> _)] @@ -4939,10 +4939,10 @@ (type: Doc-Fragment (#Doc-Comment Text) - (#Doc-Example AST)) + (#Doc-Example Code)) (def: (identify-doc-fragment ast) - (-> AST Doc-Fragment) + (-> Code Doc-Fragment) (case ast [_ (#;Text comment)] (#Doc-Comment comment) @@ -5022,11 +5022,11 @@ [file line (n.inc column)]) (def: rejoin-all-pairs - (-> (List [AST AST]) (List AST)) + (-> (List [Code Code]) (List Code)) (. List/join (map rejoin-pair))) (def: (doc-example->Text prev-cursor baseline example) - (-> Cursor Nat AST [Cursor Text]) + (-> Cursor Nat Code [Cursor Text]) (case example (^template [<tag> <show>] [new-cursor (<tag> value)] @@ -5114,7 +5114,7 @@ (list& x y (interleave xs' ys'))))) (def: (type-to-ast type) - (-> Type AST) + (-> Type Code) (case type (#Host name params) (` (#Host (~ (text$ name)) (~ (untemplate-list (map type-to-ast params))))) @@ -5185,7 +5185,7 @@ (~@ inits)))))) (do Monad<Lux> [aliases (mapM Monad<Lux> - (: (-> AST (Lux AST)) + (: (-> Code (Lux Code)) (function [_] (gensym ""))) inits)] (return (list (` (let [(~@ (interleave aliases inits))] @@ -5220,10 +5220,10 @@ output (resolve-tag hslot) g!_ (gensym "_") #let [[idx tags exported? type] output - slot-pairings (map (: (-> Ident [Text AST]) + slot-pairings (map (: (-> Ident [Text Code]) (function [[module name]] [name (symbol$ ["" name])])) (list& hslot tslots)) - pattern (record$ (map (: (-> Ident [AST AST]) + pattern (record$ (map (: (-> Ident [Code Code]) (function [[module name]] (let [tag (tag$ [module name])] (case (get name slot-pairings) @@ -5236,7 +5236,7 @@ (fail "Wrong syntax for ^slots"))) (def: (place-tokens label tokens target) - (-> Text (List AST) AST (Maybe (List AST))) + (-> Text (List Code) Code (Maybe (List Code))) (case target (^or [_ (#Bool _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Deg _)] [_ (#Real _)] [_ (#Char _)] [_ (#Text _)] [_ (#Tag _)]) (#Some (list target)) @@ -5258,7 +5258,7 @@ [_ (#Record pairs)] (do Monad<Maybe> [=pairs (mapM Monad<Maybe> - (: (-> [AST AST] (Maybe [AST AST])) + (: (-> [Code Code] (Maybe [Code Code])) (function [[slot value]] (do Monad<Maybe> [slot' (place-tokens label tokens slot) @@ -5275,14 +5275,14 @@ (macro: #export (with-expansions tokens) {#;doc (doc "Controlled macro-expansion." - "Bind an arbitraty number of ASTs resulting from macro-expansion to local bindings." - "Wherever a binding appears, the bound ASTs will be spliced in there." - (test: "AST operations & structures" + "Bind an arbitraty number of Codes resulting from macro-expansion to local bindings." + "Wherever a binding appears, the bound Codes will be spliced in there." + (test: "Code operations & structures" (with-expansions [<tests> (do-template [<expr> <text> <pattern>] [(compare <pattern> <expr>) - (compare <text> (:: AST/encode show <expr>)) - (compare true (:: Eq<AST> = <expr> <expr>))] + (compare <text> (:: Code/encode show <expr>)) + (compare true (:: Eq<Code> = <expr> <expr>))] [(bool true) "true" [_ (#;Bool true)]] [(bool false) "false" [_ (#;Bool false)]] @@ -5344,7 +5344,7 @@ type)) (def: (anti-quote-def name) - (-> Ident (Lux AST)) + (-> Ident (Lux Code)) (do Monad<Lux> [type+value (find-def-value name) #let [[type value] type+value]] @@ -5364,7 +5364,7 @@ (fail (Text/append "Cannot anti-quote type: " (Ident/encode name)))))) (def: (anti-quote token) - (-> AST (Lux AST)) + (-> Code (Lux Code)) (case token [_ (#Symbol [def-prefix def-name])] (if (Text/= "" def-prefix) @@ -5382,7 +5382,7 @@ [meta (#Record pairs)] (do Monad<Lux> [=pairs (mapM Monad<Lux> - (: (-> [AST AST] (Lux [AST AST])) + (: (-> [Code Code] (Lux [Code Code])) (function [[slot value]] (do Monad<Lux> [=value (anti-quote value)] @@ -5423,10 +5423,10 @@ (fail "Wrong syntax for ^~"))) (type: Multi-Level-Case - [AST (List [AST AST])]) + [Code (List [Code Code])]) (def: (case-level^ level) - (-> AST (Lux [AST AST])) + (-> Code (Lux [Code Code])) (case level (^ [_ (#;Tuple (list expr binding))]) (return [expr binding]) @@ -5436,7 +5436,7 @@ )) (def: (multi-level-case^ levels) - (-> (List AST) (Lux Multi-Level-Case)) + (-> (List Code) (Lux Multi-Level-Case)) (case levels #;Nil (fail "Multi-level patterns cannot be empty.") @@ -5447,7 +5447,7 @@ (wrap [init extras'])))) (def: (multi-level-case$ g!_ [[init-pattern levels] body]) - (-> AST [Multi-Level-Case AST] (List AST)) + (-> Code [Multi-Level-Case Code] (List Code)) (let [inner-pattern-body (fold (function [[calculation pattern] success] (` (case (~ calculation) (~ pattern) @@ -5456,7 +5456,7 @@ (~ g!_) #;None))) (` (#;Some (~ body))) - (: (List [AST AST]) (reverse levels)))] + (: (List [Code Code]) (reverse levels)))] (list init-pattern inner-pattern-body))) (macro: #export (^=> tokens) @@ -5661,7 +5661,7 @@ #Hidden) (def: (parse-export-level tokens) - (-> (List AST) (Lux [(Maybe Export-Level') (List AST)])) + (-> (List Code) (Lux [(Maybe Export-Level') (List Code)])) (case tokens (^ (list& [_ (#Tag ["" "export"])] tokens')) (:: Monad<Lux> wrap [(#;Some #Export) tokens']) @@ -5674,7 +5674,7 @@ )) (def: (gen-export-level ?export-level) - (-> (Maybe Export-Level') (List AST)) + (-> (Maybe Export-Level') (List Code)) (case ?export-level #;None (list) @@ -5687,7 +5687,7 @@ )) (def: (parse-complex-declaration tokens) - (-> (List AST) (Lux [[Text (List Text)] (List AST)])) + (-> (List Code) (Lux [[Text (List Text)] (List Code)])) (case tokens (^ (list& [_ (#Form (list& [_ (#Symbol ["" name])] args'))] tokens')) (do Monad<Lux> @@ -5707,7 +5707,7 @@ )) (def: (parse-any tokens) - (-> (List AST) (Lux [AST (List AST)])) + (-> (List Code) (Lux [Code (List Code)])) (case tokens (^ (list& token tokens')) (:: Monad<Lux> wrap [token tokens']) @@ -5717,17 +5717,17 @@ )) (def: (parse-end tokens) - (-> (List AST) (Lux Unit)) + (-> (List Code) (Lux Unit)) (case tokens (^ (list)) (:: Monad<Lux> wrap []) _ - (fail "Expected input ASTs to be empty.") + (fail "Expected input Codes to be empty.") )) (def: (parse-anns tokens) - (-> (List AST) (Lux [AST (List AST)])) + (-> (List Code) (Lux [Code (List Code)])) (case tokens (^ (list& [_ (#Record _anns)] tokens')) (:: Monad<Lux> wrap [(record$ _anns) tokens']) |