From 2746f1a2d7606e3295e12e9c2e6833663658ffa8 Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 21 Jul 2018 22:58:54 -0400 Subject: Re-named "Symbol" to "Identifier". --- stdlib/source/lux.lux | 334 ++++++++++----------- stdlib/source/lux/cli.lux | 8 +- .../lux/compiler/default/phase/analysis/case.lux | 2 +- .../compiler/default/phase/analysis/expression.lux | 4 +- .../compiler/default/phase/analysis/reference.lux | 2 +- .../translation/scheme/extension/common.jvm.lux | 4 +- .../phase/translation/scheme/runtime.jvm.lux | 14 +- stdlib/source/lux/compiler/default/syntax.lux | 6 +- stdlib/source/lux/concurrency/actor.lux | 54 ++-- stdlib/source/lux/control/comonad.lux | 6 +- stdlib/source/lux/control/concatenative.lux | 8 +- stdlib/source/lux/control/exception.lux | 6 +- stdlib/source/lux/control/monad.lux | 6 +- stdlib/source/lux/data/collection/list.lux | 30 +- stdlib/source/lux/data/error.lux | 2 +- stdlib/source/lux/data/format/binary.lux | 2 +- stdlib/source/lux/data/maybe.lux | 2 +- stdlib/source/lux/data/text/regex.lux | 16 +- stdlib/source/lux/host.jvm.lux | 76 ++--- stdlib/source/lux/io.lux | 2 +- stdlib/source/lux/macro.lux | 54 ++-- stdlib/source/lux/macro/code.lux | 58 ++-- stdlib/source/lux/macro/poly.lux | 18 +- stdlib/source/lux/macro/poly/equivalence.lux | 16 +- stdlib/source/lux/macro/poly/functor.lux | 16 +- stdlib/source/lux/macro/poly/json.lux | 22 +- stdlib/source/lux/macro/syntax.lux | 32 +- stdlib/source/lux/macro/syntax/common/reader.lux | 10 +- stdlib/source/lux/macro/syntax/common/writer.lux | 6 +- stdlib/source/lux/math.lux | 2 +- stdlib/source/lux/test.lux | 2 +- stdlib/source/lux/type.lux | 10 +- stdlib/source/lux/type/abstract.lux | 28 +- stdlib/source/lux/type/implicit.lux | 16 +- stdlib/source/lux/type/quotient.lux | 2 +- stdlib/source/lux/type/refinement.lux | 2 +- stdlib/source/lux/type/unit.lux | 14 +- .../compiler/default/phase/analysis/function.lux | 4 +- .../default/phase/analysis/procedure/common.lux | 6 +- .../compiler/default/phase/analysis/reference.lux | 6 +- stdlib/test/test/lux/compiler/default/syntax.lux | 2 +- stdlib/test/test/lux/data/name.lux | 2 +- stdlib/test/test/lux/macro/code.lux | 4 +- stdlib/test/test/lux/macro/syntax.lux | 26 +- 44 files changed, 471 insertions(+), 471 deletions(-) (limited to 'stdlib') diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index e53709ce2..9bf84ca45 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -162,9 +162,9 @@ (#Cons [[dummy-cursor (+7 ["lux" "export?"])] [dummy-cursor (+0 #1)]] (#Cons [[dummy-cursor (+7 ["lux" "doc"])] - [dummy-cursor (+5 "An identifier. + [dummy-cursor (+5 "A name. - It is used as part of Lux syntax to represent symbols and tags.")]] + It is used as part of Lux syntax to represent identifiers and tags.")]] #Nil))))]) ## (type: (Maybe a) @@ -311,7 +311,7 @@ ## (#Rev Rev) ## (#Frac Frac) ## (#Text Text) -## (#Symbol Name) +## (#Identifier Name) ## (#Tag Name) ## (#Form (List (w (Code' w)))) ## (#Tuple (List (w (Code' w)))) @@ -333,7 +333,7 @@ Frac (#Sum ## "lux.Text" Text - (#Sum ## "lux.Symbol" + (#Sum ## "lux.Identifier" Name (#Sum ## "lux.Tag" Name @@ -357,7 +357,7 @@ (#Cons [dummy-cursor (+5 "Rev")] (#Cons [dummy-cursor (+5 "Frac")] (#Cons [dummy-cursor (+5 "Text")] - (#Cons [dummy-cursor (+5 "Symbol")] + (#Cons [dummy-cursor (+5 "Identifier")] (#Cons [dummy-cursor (+5 "Tag")] (#Cons [dummy-cursor (+5 "Form")] (#Cons [dummy-cursor (+5 "Tuple")] @@ -425,14 +425,14 @@ ([_ text] (_ann (#Text text)))) [dummy-cursor (#Record #Nil)]) -("lux def" symbol$ +("lux def" identifier$ ("lux check" (#Function Name Code) - ([_ name] (_ann (#Symbol name)))) + ([_ name] (_ann (#Identifier name)))) [dummy-cursor (#Record #Nil)]) -("lux def" local-symbol$ +("lux def" local-identifier$ ("lux check" (#Function Text Code) - ([_ name] (_ann (#Symbol ["" name])))) + ([_ name] (_ann (#Identifier ["" name])))) [dummy-cursor (#Record #Nil)]) ("lux def" tag$ @@ -827,27 +827,27 @@ ("lux check" Macro ([_ tokens] ({(#Cons [_ (#Tuple (#Cons arg args'))] (#Cons body #Nil)) - (return (#Cons (_ann (#Form (#Cons (_ann (#Tuple (#Cons (_ann (#Symbol "" "")) + (return (#Cons (_ann (#Form (#Cons (_ann (#Tuple (#Cons (_ann (#Identifier "" "")) (#Cons arg #Nil)))) (#Cons ({#Nil body _ - (_ann (#Form (#Cons (_ann (#Symbol "lux" "function''")) + (_ann (#Form (#Cons (_ann (#Identifier "lux" "function''")) (#Cons (_ann (#Tuple args')) (#Cons body #Nil)))))} args') #Nil)))) #Nil)) - (#Cons [_ (#Symbol "" self)] (#Cons [_ (#Tuple (#Cons arg args'))] (#Cons body #Nil))) - (return (#Cons (_ann (#Form (#Cons (_ann (#Tuple (#Cons (_ann (#Symbol "" self)) + (#Cons [_ (#Identifier "" self)] (#Cons [_ (#Tuple (#Cons arg args'))] (#Cons body #Nil))) + (return (#Cons (_ann (#Form (#Cons (_ann (#Tuple (#Cons (_ann (#Identifier "" self)) (#Cons arg #Nil)))) (#Cons ({#Nil body _ - (_ann (#Form (#Cons (_ann (#Symbol "lux" "function''")) + (_ann (#Form (#Cons (_ann (#Identifier "lux" "function''")) (#Cons (_ann (#Tuple args')) (#Cons body #Nil)))))} args') @@ -927,12 +927,12 @@ (#Cons [name (#Cons [(_ann (#Form (#Cons [(_ann (#Text "lux check")) (#Cons [type - (#Cons [(_ann (#Form (#Cons [(_ann (#Symbol ["lux" "function''"])) + (#Cons [(_ann (#Form (#Cons [(_ann (#Identifier ["lux" "function''"])) (#Cons [name (#Cons [(_ann (#Tuple args)) (#Cons [body #Nil])])])]))) #Nil])])]))) - (#Cons (form$ (#Cons (symbol$ ["lux" "record$"]) + (#Cons (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons (with-export-meta meta) #Nil))) #Nil)])])]))) @@ -945,7 +945,7 @@ (#Cons [type (#Cons [body #Nil])])]))) - (#Cons (form$ (#Cons (symbol$ ["lux" "record$"]) + (#Cons (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons (with-export-meta meta) #Nil))) #Nil)])])]))) @@ -957,12 +957,12 @@ (#Cons [name (#Cons [(_ann (#Form (#Cons [(_ann (#Text "lux check")) (#Cons [type - (#Cons [(_ann (#Form (#Cons [(_ann (#Symbol ["lux" "function''"])) + (#Cons [(_ann (#Form (#Cons [(_ann (#Identifier ["lux" "function''"])) (#Cons [name (#Cons [(_ann (#Tuple args)) (#Cons [body #Nil])])])]))) #Nil])])]))) - (#Cons (form$ (#Cons (symbol$ ["lux" "record$"]) + (#Cons (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons meta #Nil))) #Nil)])])]))) @@ -975,7 +975,7 @@ (#Cons [type (#Cons [body #Nil])])]))) - (#Cons (form$ (#Cons (symbol$ ["lux" "record$"]) + (#Cons (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons meta #Nil))) #Nil)])])]))) @@ -990,32 +990,32 @@ default-macro-meta Macro ({(#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil)) - (return (#Cons (form$ (#Cons (symbol$ ["lux" "def:''"]) + (return (#Cons (form$ (#Cons (identifier$ ["lux" "def:''"]) (#Cons (form$ (#Cons name args)) (#Cons (with-macro-meta (tag$ ["lux" "Nil"])) - (#Cons (symbol$ ["lux" "Macro"]) + (#Cons (identifier$ ["lux" "Macro"]) (#Cons body #Nil))) ))) #Nil)) (#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil))) - (return (#Cons (form$ (#Cons (symbol$ ["lux" "def:''"]) + (return (#Cons (form$ (#Cons (identifier$ ["lux" "def:''"]) (#Cons (tag$ ["" "export"]) (#Cons (form$ (#Cons name args)) (#Cons (with-macro-meta (tag$ ["lux" "Nil"])) - (#Cons (symbol$ ["lux" "Macro"]) + (#Cons (identifier$ ["lux" "Macro"]) (#Cons body #Nil))) )))) #Nil)) (#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons meta-data (#Cons body #Nil)))) - (return (#Cons (form$ (#Cons (symbol$ ["lux" "def:''"]) + (return (#Cons (form$ (#Cons (identifier$ ["lux" "def:''"]) (#Cons (tag$ ["" "export"]) (#Cons (form$ (#Cons name args)) (#Cons (with-macro-meta meta-data) - (#Cons (symbol$ ["lux" "Macro"]) + (#Cons (identifier$ ["lux" "Macro"]) (#Cons body #Nil))) )))) @@ -1038,7 +1038,7 @@ (return tokens) (#Cons x (#Cons y xs)) - (return (#Cons (form$ (#Cons (symbol$ ["lux" "$'"]) + (return (#Cons (form$ (#Cons (identifier$ ["lux" "$'"]) (#Cons (form$ (#Cons (tag$ ["lux" "Apply"]) (#Cons y (#Cons x #Nil)))) xs))) @@ -1100,7 +1100,7 @@ (def:'' (replace-syntax reps syntax) #Nil (#Function RepEnv (#Function Code Code)) - ({[_ (#Symbol "" name)] + ({[_ (#Identifier "" name)] ({(#Some replacement) replacement @@ -1183,11 +1183,11 @@ ({#Nil (next #Nil) - (#Cons [_ (#Symbol "" arg-name)] args') + (#Cons [_ (#Identifier "" arg-name)] args') (parse-quantified-args args' (function'' [names] (next (#Cons arg-name names)))) _ - (fail "Expected symbol.")} + (fail "Expected identifier.")} args)) (def:'' (make-parameter idx) @@ -1228,7 +1228,7 @@ (| Any [a (List a)]))")] #Nil) - (let'' [self-name tokens] ({(#Cons [_ (#Symbol "" self-name)] tokens) + (let'' [self-name tokens] ({(#Cons [_ (#Identifier "" self-name)] tokens) [self-name tokens] _ @@ -1275,7 +1275,7 @@ a (List (Self a))])")] #Nil) - (let'' [self-name tokens] ({(#Cons [_ (#Symbol "" self-name)] tokens) + (let'' [self-name tokens] ({(#Cons [_ (#Identifier "" self-name)] tokens) [self-name tokens] _ @@ -1374,7 +1374,7 @@ (&)")] #Nil) ({#Nil - (return (list (symbol$ ["lux" "Any"]))) + (return (list (identifier$ ["lux" "Any"]))) (#Cons last prevs) (return (list (list/fold (function'' [left right] (form$ (list (tag$ ["lux" "Product"]) left right))) @@ -1391,7 +1391,7 @@ (|)")] #Nil) ({#Nil - (return (list (symbol$ ["lux" "Nothing"]))) + (return (list (identifier$ ["lux" "Nothing"]))) (#Cons last prevs) (return (list (list/fold (function'' [left right] (form$ (list (tag$ ["lux" "Sum"]) left right))) @@ -1400,7 +1400,7 @@ (list/reverse tokens))) (macro:' (function' tokens) - (let'' [name tokens'] ({(#Cons [[_ (#Symbol ["" name])] tokens']) + (let'' [name tokens'] ({(#Cons [[_ (#Identifier ["" name])] tokens']) [name tokens'] _ @@ -1411,10 +1411,10 @@ (fail "function' requires a non-empty arguments tuple.") (#Cons [harg targs]) - (return (list (form$ (list (tuple$ (list (symbol$ ["" name]) + (return (list (form$ (list (tuple$ (list (identifier$ ["" name]) harg)) (list/fold (function'' [arg body'] - (form$ (list (tuple$ (list (symbol$ ["" ""]) + (form$ (list (tuple$ (list (identifier$ ["" ""]) arg)) body'))) body @@ -1433,11 +1433,11 @@ name (form$ (list (text$ "lux check") type - (form$ (list (symbol$ ["lux" "function'"]) + (form$ (list (identifier$ ["lux" "function'"]) name (tuple$ args) body)))) - (form$ (#Cons (symbol$ ["lux" "record$"]) + (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons (with-export-meta meta) #Nil))))))) @@ -1447,7 +1447,7 @@ (form$ (list (text$ "lux check") type body)) - (form$ (#Cons (symbol$ ["lux" "record$"]) + (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons (with-export-meta meta) #Nil))))))) @@ -1457,11 +1457,11 @@ name (form$ (list (text$ "lux check") type - (form$ (list (symbol$ ["lux" "function'"]) + (form$ (list (identifier$ ["lux" "function'"]) name (tuple$ args) body)))) - (form$ (#Cons (symbol$ ["lux" "record$"]) + (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons meta #Nil))))))) @@ -1469,7 +1469,7 @@ (return (list (form$ (list (text$ "lux def") name (form$ (list (text$ "lux check") type body)) - (form$ (#Cons (symbol$ ["lux" "record$"]) + (form$ (#Cons (identifier$ ["lux" "record$"]) (#Cons meta #Nil))))))) @@ -1650,17 +1650,17 @@ (macro:' (do tokens) ({(#Cons monad (#Cons [_ (#Tuple bindings)] (#Cons body #Nil))) - (let' [g!wrap (symbol$ ["" "wrap"]) - g!bind (symbol$ ["" " bind "]) + (let' [g!wrap (identifier$ ["" "wrap"]) + g!bind (identifier$ ["" " bind "]) body' (list/fold ("lux check" (-> (& Code Code) Code Code) (function' [binding body'] (let' [[var value] binding] ({[_ (#Tag "" "let")] - (form$ (list (symbol$ ["lux" "let'"]) value body')) + (form$ (list (identifier$ ["lux" "let'"]) value body')) _ (form$ (list g!bind - (form$ (list (tuple$ (list (symbol$ ["" ""]) var)) body')) + (form$ (list (tuple$ (list (identifier$ ["" ""]) var)) body')) value))} var)))) body @@ -1805,7 +1805,7 @@ #None} def-meta))) -(def:''' (resolve-global-symbol full-name state) +(def:''' (resolve-global-identifier full-name state) #Nil (-> Name ($' Meta Name)) (let' [[module name] full-name @@ -1815,7 +1815,7 @@ #scope-type-vars scope-type-vars} state] ({(#Some {#module-hash _ #module-aliases _ #definitions definitions #imports _ #tags tags #types types #module-annotations _ #module-state _}) ({(#Some [def-type def-meta def-value]) - ({(#Some [_ (#Symbol real-name)]) + ({(#Some [_ (#Identifier real-name)]) (#Right [state real-name]) _ @@ -1839,7 +1839,7 @@ (#Cons lastI inits) (do Monad - [lastO ({[_ (#Form (#Cons [[_ (#Symbol ["" "~+"])] (#Cons [spliced #Nil])]))] + [lastO ({[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] (let' [[[_module-name _ _] _] spliced] (wrap spliced)) @@ -1850,9 +1850,9 @@ lastI)] (monad/fold Monad (function' [leftI rightO] - ({[_ (#Form (#Cons [[_ (#Symbol ["" "~+"])] (#Cons [spliced #Nil])]))] + ({[_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] (let' [[[_module-name _ _] _] spliced] - (wrap (form$ (list (symbol$ ["lux" "splice-helper"]) + (wrap (form$ (list (identifier$ ["lux" "splice-helper"]) spliced rightO)))) @@ -1908,26 +1908,26 @@ module)] (return (wrap-meta (form$ (list (tag$ ["lux" "Tag"]) (tuple$ (list (text$ module') (text$ name)))))))) - [#1 [_ (#Symbol [module name])]] + [#1 [_ (#Identifier [module name])]] (do Monad [real-name ({"" (if (text/= "" subst) (wrap [module name]) - (resolve-global-symbol [subst name])) + (resolve-global-identifier [subst name])) _ (wrap [module name])} module) #let [[module name] real-name]] - (return (wrap-meta (form$ (list (tag$ ["lux" "Symbol"]) (tuple$ (list (text$ module) (text$ name)))))))) + (return (wrap-meta (form$ (list (tag$ ["lux" "Identifier"]) (tuple$ (list (text$ module) (text$ name)))))))) - [#0 [_ (#Symbol [module name])]] - (return (wrap-meta (form$ (list (tag$ ["lux" "Symbol"]) (tuple$ (list (text$ module) (text$ name))))))) + [#0 [_ (#Identifier [module name])]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Identifier"]) (tuple$ (list (text$ module) (text$ name))))))) - [#1 [_ (#Form (#Cons [[_ (#Symbol ["" "~"])] (#Cons [unquoted #Nil])]))]] + [#1 [_ (#Form (#Cons [[_ (#Identifier ["" "~"])] (#Cons [unquoted #Nil])]))]] (return unquoted) - [#1 [_ (#Form (#Cons [[_ (#Symbol ["" "~!"])] (#Cons [dependent #Nil])]))]] + [#1 [_ (#Form (#Cons [[_ (#Identifier ["" "~!"])] (#Cons [dependent #Nil])]))]] (do Monad [independent (untemplate replace? subst dependent)] (wrap (wrap-meta (form$ (list (tag$ ["lux" "Form"]) @@ -1935,7 +1935,7 @@ (untemplate-text subst) independent))))))) - [#1 [_ (#Form (#Cons [[_ (#Symbol ["" "~'"])] (#Cons [keep-quoted #Nil])]))]] + [#1 [_ (#Form (#Cons [[_ (#Identifier ["" "~'"])] (#Cons [keep-quoted #Nil])]))]] (untemplate #0 subst keep-quoted) [_ [meta (#Form elems)]] @@ -2007,7 +2007,7 @@ [current-module current-module-name =template (untemplate #1 current-module template)] (wrap (list (form$ (list (text$ "lux check") - (symbol$ ["lux" "Code"]) + (identifier$ ["lux" "Code"]) =template))))) _ @@ -2023,7 +2023,7 @@ ({(#Cons template #Nil) (do Monad [=template (untemplate #1 "" template)] - (wrap (list (form$ (list (text$ "lux check") (symbol$ ["lux" "Code"]) =template))))) + (wrap (list (form$ (list (text$ "lux check") (identifier$ ["lux" "Code"]) =template))))) _ (fail "Wrong syntax for `")} @@ -2036,7 +2036,7 @@ ({(#Cons template #Nil) (do Monad [=template (untemplate #0 "" template)] - (wrap (list (form$ (list (text$ "lux check") (symbol$ ["lux" "Code"]) =template))))) + (wrap (list (form$ (list (text$ "lux check") (identifier$ ["lux" "Code"]) =template))))) _ (fail "Wrong syntax for '")} @@ -2108,7 +2108,7 @@ (def:''' (get-name x) #Nil (-> Code ($' Maybe Name)) - ({[_ (#Symbol sname)] + ({[_ (#Identifier sname)] (#Some sname) _ @@ -2128,7 +2128,7 @@ (def:''' (get-short x) #Nil (-> Code ($' Maybe Text)) - ({[_ (#Symbol "" sname)] + ({[_ (#Identifier "" sname)] (#Some sname) _ @@ -2148,7 +2148,7 @@ (def:''' (apply-template env template) #Nil (-> RepEnv Code Code) - ({[_ (#Symbol "" sname)] + ({[_ (#Identifier "" sname)] ({(#Some subst) subst @@ -2633,7 +2633,7 @@ (get-meta ["lux" "export?"] def-meta)) _ - ({(#Some [_ (#Symbol [r-module r-name])]) + ({(#Some [_ (#Identifier [r-module r-name])]) (find-macro' modules current-module r-module r-name) _ @@ -2702,7 +2702,7 @@ (def:''' (macro-expand-once token) #Nil (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Cons [_ (#Symbol macro-name)] args))] + ({[_ (#Form (#Cons [_ (#Identifier macro-name)] args))] (do Monad [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -2720,7 +2720,7 @@ (def:''' (macro-expand token) #Nil (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Cons [_ (#Symbol macro-name)] args))] + ({[_ (#Form (#Cons [_ (#Identifier macro-name)] args))] (do Monad [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -2741,7 +2741,7 @@ (def:''' (macro-expand-all syntax) #Nil (-> Code ($' Meta ($' List Code))) - ({[_ (#Form (#Cons [_ (#Symbol macro-name)] args))] + ({[_ (#Form (#Cons [_ (#Identifier macro-name)] args))] (do Monad [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -2754,7 +2754,7 @@ #None (do Monad [args' (monad/map Monad macro-expand-all args)] - (wrap (list (form$ (#Cons (symbol$ macro-name) (list/join args'))))))} + (wrap (list (form$ (#Cons (identifier$ macro-name) (list/join args'))))))} ?macro)) [_ (#Form members)] @@ -2802,7 +2802,7 @@ #Nil))))] (` ("lux in-module" (~ (text$ module)) (~ (walk-type type')))) - [_ (#Form (#Cons [_ (#Symbol ["" ":~"])] (#Cons expression #Nil)))] + [_ (#Form (#Cons [_ (#Identifier ["" ":~"])] (#Cons expression #Nil)))] expression [_ (#Form (#Cons type-fn args))] @@ -2938,7 +2938,7 @@ #seed (n/+ +1 seed) #expected expected #cursor cursor #extensions extensions #scope-type-vars scope-type-vars} - (symbol$ ["" ($_ text/compose "__gensym__" prefix (nat/encode seed))]))} + (identifier$ ["" ($_ text/compose "__gensym__" prefix (nat/encode seed))]))} state)) (macro:' #export (Rec tokens) @@ -2947,7 +2947,7 @@ ## A name has to be given to the whole type, to use it within its body. (Rec Self [Int (List Self)])")]) - ({(#Cons [_ (#Symbol "" name)] (#Cons body #Nil)) + ({(#Cons [_ (#Identifier "" name)] (#Cons body #Nil)) (let' [body' (replace-syntax (list [name (` (#.Apply (~ (make-parameter +1)) (~ (make-parameter +0))))]) (update-parameters body))] (return (list (` (#.Apply .Nothing (#.UnivQ #.Nil (~ body'))))))) @@ -2965,7 +2965,7 @@ (log! \"#3\") \"YOLO\")")]) ({(#Cons value actions) - (let' [dummy (symbol$ ["" ""])] + (let' [dummy (identifier$ ["" ""])] (return (list (list/fold ("lux check" (-> Code Code Code) (function' [pre post] (` ({(~ dummy) (~ post)} (~ pre))))) @@ -3047,7 +3047,7 @@ [_ (#Text value)] ($_ text/compose "\"" value "\"") - [_ (#Symbol [prefix name])] + [_ (#Identifier [prefix name])] (if (text/= "" prefix) name ($_ text/compose prefix "." name)) @@ -3082,18 +3082,18 @@ (def:' (expander branches) (-> (List Code) (Meta (List Code))) - ({(#Cons [_ (#Form (#Cons [_ (#Symbol macro-name)] macro-args))] + ({(#Cons [_ (#Form (#Cons [_ (#Identifier macro-name)] macro-args))] (#Cons body branches')) (do Monad [??? (macro? macro-name)] (if ??? (do Monad - [init-expansion (macro-expand-once (form$ (list& (symbol$ macro-name) (form$ macro-args) body branches')))] + [init-expansion (macro-expand-once (form$ (list& (identifier$ macro-name) (form$ macro-args) body branches')))] (expander init-expansion)) (do Monad [sub-expansion (expander branches')] - (wrap (list& (form$ (list& (symbol$ macro-name) macro-args)) + (wrap (list& (form$ (list& (identifier$ macro-name) macro-args)) body sub-expansion))))) @@ -3191,10 +3191,10 @@ _ (fail "Wrong syntax for ^or"))) -(def:' (symbol? code) +(def:' (identifier? code) (-> Code Bit) (case code - [_ (#Symbol _)] + [_ (#Identifier _)] #1 _ @@ -3214,7 +3214,7 @@ (list/fold (: (-> [Code Code] Code Code) (function' [lr body'] (let' [[l r] lr] - (if (symbol? l) + (if (identifier? l) (` ({(~ l) (~ body')} (~ r))) (` (case (~ r) (~ l) (~ body'))))))) body) @@ -3236,23 +3236,23 @@ (function (const x y) x))")]) (case (: (Maybe [Text Code (List Code) Code]) (case tokens - (^ (list [_ (#Form (list& [_ (#Symbol ["" name])] head tail))] body)) + (^ (list [_ (#Form (list& [_ (#Identifier ["" name])] head tail))] body)) (#Some name head tail body) _ #None)) (#Some g!name head tail body) - (let [g!blank (symbol$ ["" ""]) - g!name (symbol$ ["" g!name]) + (let [g!blank (identifier$ ["" ""]) + g!name (identifier$ ["" g!name]) body+ (list/fold (: (-> Code Code Code) (function' [arg body'] - (if (symbol? arg) + (if (identifier? arg) (` ([(~ g!blank) (~ arg)] (~ body'))) (` ([(~ g!blank) (~ g!blank)] (case (~ g!blank) (~ arg) (~ body'))))))) body (list/reverse tail))] - (return (list (if (symbol? head) + (return (list (if (identifier? head) (` ([(~ g!name) (~ head)] (~ body+))) (` ([(~ g!name) (~ g!blank)] (case (~ g!blank) (~ head) (~ body+)))))))) @@ -3283,7 +3283,7 @@ [_ (#Tag [prefix name])] (meta-code ["lux" "Tag"] (` [(~ (text$ prefix)) (~ (text$ name))])) - (^or [_ (#Form _)] [_ (#Symbol _)]) + (^or [_ (#Form _)] [_ (#Identifier _)]) code [_ (#Tuple xs)] @@ -3436,30 +3436,30 @@ (^template [] (^ (list [_ ( [prefix name])])) (return (list (` [(~ (text$ prefix)) (~ (text$ name))])))) - ([#Symbol] [#Tag]) + ([#Identifier] [#Tag]) _ (fail \"Wrong syntax for name-for\")))")]) (let [[exported? tokens] (export^ tokens) name+args+meta+body?? (: (Maybe [Name (List Code) Code Code]) (case tokens - (^ (list [_ (#Form (list& [_ (#Symbol name)] args))] body)) + (^ (list [_ (#Form (list& [_ (#Identifier name)] args))] body)) (#Some [name args (` {}) body]) - (^ (list [_ (#Symbol name)] body)) + (^ (list [_ (#Identifier name)] body)) (#Some [name #Nil (` {}) body]) - (^ (list [_ (#Form (list& [_ (#Symbol name)] args))] [meta-rec-cursor (#Record meta-rec-parts)] body)) + (^ (list [_ (#Form (list& [_ (#Identifier name)] args))] [meta-rec-cursor (#Record meta-rec-parts)] body)) (#Some [name args [meta-rec-cursor (#Record meta-rec-parts)] body]) - (^ (list [_ (#Symbol name)] [meta-rec-cursor (#Record meta-rec-parts)] body)) + (^ (list [_ (#Identifier name)] [meta-rec-cursor (#Record meta-rec-parts)] body)) (#Some [name #Nil [meta-rec-cursor (#Record meta-rec-parts)] body]) _ #None))] (case name+args+meta+body?? (#Some [name args meta body]) - (let [name (symbol$ name) + (let [name (identifier$ name) def-sig (case args #Nil name _ (` ((~ name) (~+ args))))] @@ -3491,16 +3491,16 @@ (let [[exported? tokens'] (export^ tokens) ?parts (: (Maybe [Name (List Code) Code (List Code)]) (case tokens' - (^ (list& [_ (#Form (list& [_ (#Symbol name)] args))] [meta-rec-cursor (#Record meta-rec-parts)] sigs)) + (^ (list& [_ (#Form (list& [_ (#Identifier name)] args))] [meta-rec-cursor (#Record meta-rec-parts)] sigs)) (#Some name args [meta-rec-cursor (#Record meta-rec-parts)] sigs) - (^ (list& [_ (#Symbol name)] [meta-rec-cursor (#Record meta-rec-parts)] sigs)) + (^ (list& [_ (#Identifier name)] [meta-rec-cursor (#Record meta-rec-parts)] sigs)) (#Some name #Nil [meta-rec-cursor (#Record meta-rec-parts)] sigs) - (^ (list& [_ (#Form (list& [_ (#Symbol name)] args))] sigs)) + (^ (list& [_ (#Form (list& [_ (#Identifier name)] args))] sigs)) (#Some name args (` {}) sigs) - (^ (list& [_ (#Symbol name)] sigs)) + (^ (list& [_ (#Identifier name)] sigs)) (#Some name #Nil (` {}) sigs) _ @@ -3515,14 +3515,14 @@ (: (-> Code (Meta [Text Code])) (function (_ token) (case token - (^ [_ (#Form (list [_ (#Text "lux check")] type [_ (#Symbol ["" name])]))]) + (^ [_ (#Form (list [_ (#Text "lux check")] type [_ (#Identifier ["" name])]))]) (wrap [name type]) _ (fail "Signatures require typed members!")))) (list/join sigs'))) #let [[_module _name] name+ - def-name (symbol$ name) + def-name (identifier$ name) sig-type (record$ (list/map (: (-> [Text Code] [Code Code]) (function (_ [m-name m-type]) [(tag$ ["" m-name]) m-type])) @@ -3615,7 +3615,7 @@ (default 20 #.None) => 20"} (case tokens (^ (list else maybe)) - (let [g!temp (: Code [dummy-cursor (#Symbol ["" ""])]) + (let [g!temp (: Code [dummy-cursor (#Identifier ["" ""])]) code (` (case (~ maybe) (#.Some (~ g!temp)) (~ g!temp) @@ -3867,7 +3867,7 @@ (: (-> Code (Meta [Code Code])) (function (_ token) (case token - (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Symbol "" tag-name)] value meta))]) + (^ [_ (#Form (list [_ (#Text "lux def")] [_ (#Identifier "" tag-name)] value meta))]) (case (get tag-name tag-mappings) (#Some tag) (wrap [tag value]) @@ -3918,21 +3918,21 @@ (case ?parts (#Some [name args type meta definitions]) (case (case name - [_ (#Symbol ["" "_"])] + [_ (#Identifier ["" "_"])] (case type - (^ [_ (#Form (list& [_ (#Symbol [_ sig-name])] sig-args))]) + (^ [_ (#Form (list& [_ (#Identifier [_ sig-name])] sig-args))]) (case (: (Maybe (List Text)) (monad/map Monad (function (_ sa) (case sa - [_ (#Symbol [_ arg-name])] + [_ (#Identifier [_ arg-name])] (#Some arg-name) _ #None)) sig-args)) (^ (#Some params)) - (#Some (symbol$ ["" ($_ text/compose sig-name "<" (|> params (interpose ",") text/join) ">")])) + (#Some (identifier$ ["" ($_ text/compose sig-name "<" (|> params (interpose ",") text/join) ">")])) _ #None) @@ -3983,22 +3983,22 @@ [#0 tokens']) parts (: (Maybe [Text (List Code) Code (List Code)]) (case tokens' - (^ (list [_ (#Symbol "" name)] [meta-cursor (#Record meta-parts)] [type-cursor (#Record type-parts)])) + (^ (list [_ (#Identifier "" 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)])]) - (^ (list& [_ (#Symbol "" name)] [meta-cursor (#Record meta-parts)] type-code1 type-codes)) + (^ (list& [_ (#Identifier "" name)] [meta-cursor (#Record meta-parts)] type-code1 type-codes)) (#Some [name #Nil [meta-cursor (#Record meta-parts)] (#Cons type-code1 type-codes)]) - (^ (list& [_ (#Symbol "" name)] type-codes)) + (^ (list& [_ (#Identifier "" name)] type-codes)) (#Some [name #Nil (` {}) type-codes]) - (^ (list [_ (#Form (#Cons [_ (#Symbol "" name)] args))] [meta-cursor (#Record meta-parts)] [type-cursor (#Record type-parts)])) + (^ (list [_ (#Form (#Cons [_ (#Identifier "" name)] args))] [meta-cursor (#Record meta-parts)] [type-cursor (#Record type-parts)])) (#Some [name args [meta-cursor (#Record meta-parts)] (list [type-cursor (#Record type-parts)])]) - (^ (list& [_ (#Form (#Cons [_ (#Symbol "" name)] args))] [meta-cursor (#Record meta-parts)] type-code1 type-codes)) + (^ (list& [_ (#Form (#Cons [_ (#Identifier "" name)] args))] [meta-cursor (#Record meta-parts)] type-code1 type-codes)) (#Some [name args [meta-cursor (#Record meta-parts)] (#Cons type-code1 type-codes)]) - (^ (list& [_ (#Form (#Cons [_ (#Symbol "" name)] args))] type-codes)) + (^ (list& [_ (#Form (#Cons [_ (#Identifier "" name)] args))] type-codes)) (#Some [name args (` {}) type-codes]) _ @@ -4008,7 +4008,7 @@ (do Monad [type+tags?? (unfold-type-def type-codes) module-name current-module-name] - (let [type-name (symbol$ ["" name]) + (let [type-name (identifier$ ["" name]) [type tags??] type+tags?? type-meta (: Code (case tags?? @@ -4021,8 +4021,8 @@ type' (: (Maybe Code) (if rec? (if (empty? args) - (let [g!param (symbol$ ["" ""]) - prime-name (symbol$ ["" name]) + (let [g!param (identifier$ ["" ""]) + prime-name (identifier$ ["" name]) type+ (replace-syntax (list [name (` ((~ prime-name) .Nothing))]) type)] (#Some (` ((All (~ prime-name) [(~ g!param)] (~ type+)) .Nothing)))) @@ -4076,11 +4076,11 @@ (: (-> Code (Meta Text)) (function (_ def) (case def - [_ (#Symbol ["" name])] + [_ (#Identifier ["" name])] (return name) _ - (fail "only/exclude requires symbols.")))) + (fail "only/exclude requires identifiers.")))) defs)) (def: (parse-referrals tokens) @@ -4116,11 +4116,11 @@ [structs' (monad/map Monad (function (_ struct) (case struct - [_ (#Symbol ["" struct-name])] + [_ (#Identifier ["" struct-name])] (return struct-name) _ - (fail "Expected all structures of opening form to be symbols."))) + (fail "Expected all structures of opening form to be identifiers."))) structs) next+remainder (parse-openings parts')] (let [[next remainder] next+remainder] @@ -4216,7 +4216,7 @@ (: (-> Code (Meta (List Importation))) (function (_ token) (case token - [_ (#Symbol ["" m-name])] + [_ (#Identifier ["" m-name])] (do Monad [m-name (clean-module nested? relative-root m-name)] (wrap (list {#import-name m-name @@ -4224,7 +4224,7 @@ #import-refer {#refer-defs #All #refer-open (list)}}))) - (^ [_ (#Tuple (list& [_ (#Symbol ["" m-name])] extra))]) + (^ [_ (#Tuple (list& [_ (#Identifier ["" m-name])] extra))]) (do Monad [import-name (clean-module nested? relative-root m-name) referral+extra (parse-referrals extra) @@ -4240,7 +4240,7 @@ #refer-open openings}} sub-imports)))) - (^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Symbol ["" m-name])] extra))]) + (^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Identifier ["" m-name])] extra))]) (do Monad [import-name (clean-module nested? relative-root m-name) referral+extra (parse-referrals extra) @@ -4501,7 +4501,7 @@ [g!temp (gensym "temp")] (wrap (list& g!temp (` (..^open (~ g!temp) (~ (text$ alias)) (~ body))) branches))) - (^ (list [_ (#Symbol name)] [_ (#Text alias)] body)) + (^ (list [_ (#Identifier name)] [_ (#Text alias)] body)) (do Monad [init-type (find-type name) struct-evidence (resolve-type-tags init-type)] @@ -4515,7 +4515,7 @@ (function (recur source [tags members] target) (let [pattern (record$ (list/map (function (_ [t-module t-name]) [(tag$ [t-module t-name]) - (symbol$ ["" (de-alias t-name alias)])]) + (identifier$ ["" (de-alias t-name alias)])]) tags))] (do Monad [enhanced-target (monad/fold Monad @@ -4532,7 +4532,7 @@ (wrap enhanced-target)))) target (zip2 tags members))] - (wrap (` ({(~ pattern) (~ enhanced-target)} (~ (symbol$ source))))))))) + (wrap (` ({(~ pattern) (~ enhanced-target)} (~ (identifier$ source))))))))) name tags&members body)] (wrap (list full-body))))) @@ -4636,7 +4636,7 @@ (return (list/join decls'))) _ - (return (list (` ("lux def" (~ (symbol$ ["" (de-alias name alias)])) + (return (list (` ("lux def" (~ (identifier$ ["" (de-alias name alias)])) (~ source+) [(~ cursor-code) (#.Record #Nil)]))))))) @@ -4652,11 +4652,11 @@ (case tokens (^ (list [_ (#Text alias)] struct)) (case struct - [_ (#Symbol struct-name)] + [_ (#Identifier struct-name)] (do Monad [struct-type (find-type struct-name) output (resolve-type-tags struct-type) - #let [source (symbol$ struct-name)]] + #let [source (identifier$ struct-name)]] (case output (#Some [tags members]) (do Monad @@ -4774,17 +4774,17 @@ (wrap (list))) #let [defs (list/map (: (-> Text Code) (function (_ def) - (` ("lux def" (~ (symbol$ ["" def])) - (~ (symbol$ [module-name def])) + (` ("lux def" (~ (identifier$ ["" def])) + (~ (identifier$ [module-name def])) [(~ cursor-code) (#.Record (#Cons [[(~ cursor-code) (#.Tag ["lux" "alias"])] - [(~ cursor-code) (#.Symbol [(~ (text$ module-name)) (~ (text$ def))])]] + [(~ cursor-code) (#.Identifier [(~ (text$ module-name)) (~ (text$ def))])]] #Nil))])))) defs') openings (join-map (: (-> Openings (List Code)) (function (_ [alias structs]) (list/map (function (_ name) - (` (open: (~ (text$ alias)) (~ (symbol$ [module-name name]))))) + (` (open: (~ (text$ alias)) (~ (identifier$ [module-name name]))))) structs))) r-opens)]] (wrap (list/compose defs openings)) @@ -4808,15 +4808,15 @@ (list (' #*)) (#Only defs) - (list (form$ (list& (' #+) (list/map local-symbol$ defs)))) + (list (form$ (list& (' #+) (list/map local-identifier$ defs)))) (#Exclude defs) - (list (form$ (list& (' #-) (list/map local-symbol$ defs)))) + (list (form$ (list& (' #-) (list/map local-identifier$ defs)))) #Nothing (list))) openings (list/map (function (_ [alias structs]) - (form$ (list& (text$ alias) (list/map local-symbol$ structs)))) + (form$ (list& (text$ alias) (list/map local-identifier$ structs)))) r-opens)] (` (..refer (~ (text$ module-name)) (~+ localizations) @@ -4874,11 +4874,11 @@ ## Also allows using that value as a function. (:: Codec encode 123)"} (case tokens - (^ (list struct [_ (#Symbol member)])) - (return (list (` (let [(^open ".") (~ struct)] (~ (symbol$ member)))))) + (^ (list struct [_ (#Identifier member)])) + (return (list (` (let [(^open ".") (~ struct)] (~ (identifier$ member)))))) - (^ (list& struct [_ (#Symbol member)] args)) - (return (list (` ((let [(^open ".") (~ struct)] (~ (symbol$ member))) (~+ args))))) + (^ (list& struct [_ (#Identifier member)] args)) + (return (list (` ((let [(^open ".") (~ struct)] (~ (identifier$ member))) (~+ args))))) _ (fail "Wrong syntax for ::"))) @@ -5130,7 +5130,7 @@ [#Rev] [#Frac] [#Text] - [#Symbol] + [#Identifier] [#Tag]) (^template [] @@ -5241,7 +5241,7 @@ [#Int int/encode] [#Frac frac/encode] [#Text text/encode] - [#Symbol name/encode] + [#Identifier name/encode] [#Tag tag/encode]) (^template [ ] @@ -5349,7 +5349,7 @@ (` (#Apply (~ (type-to-code arg)) (~ (type-to-code fun)))) (#Named [module name] type) - (symbol$ [module name]))) + (identifier$ [module name]))) (macro: #export (loop tokens) {#.doc (doc "Allows arbitrary looping, using the \"recur\" form to re-start the loop." @@ -5372,7 +5372,7 @@ (#.Some [name bindings body]) (^ (list [_ (#Tuple bindings)] body)) - (#.Some [(symbol$ ["" "recur"]) bindings body]) + (#.Some [(identifier$ ["" "recur"]) bindings body]) _ #.None)] @@ -5381,7 +5381,7 @@ (let [pairs (as-pairs bindings) vars (list/map first pairs) inits (list/map second pairs)] - (if (every? symbol? inits) + (if (every? identifier? inits) (do Monad [inits' (: (Meta (List Name)) (case (monad/map Monad get-name inits) @@ -5432,7 +5432,7 @@ g!_ (gensym "_") #let [[idx tags exported? type] output slot-pairings (list/map (: (-> Name [Text Code]) - (function (_ [module name]) [name (symbol$ ["" name])])) + (function (_ [module name]) [name (identifier$ ["" name])])) (list& hslot tslots)) pattern (record$ (list/map (: (-> Name [Code Code]) (function (_ [module name]) @@ -5452,7 +5452,7 @@ (^or [_ (#Bit _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Rev _)] [_ (#Frac _)] [_ (#Text _)] [_ (#Tag _)]) (#Some (list target)) - [_ (#Symbol [prefix name])] + [_ (#Identifier [prefix name])] (if (and (text/= "" prefix) (text/= label name)) (#Some tokens) @@ -5501,18 +5501,18 @@ [(frac 123.0) "123.0" [_ (#.Frac 123.0)]] [(text "\n") "\"\\n\"" [_ (#.Text "\n")]] [(tag ["yolo" "lol"]) "#yolo.lol" [_ (#.Tag ["yolo" "lol"])]] - [(symbol ["yolo" "lol"]) "yolo.lol" [_ (#.Symbol ["yolo" "lol"])]] + [(identifier ["yolo" "lol"]) "yolo.lol" [_ (#.Identifier ["yolo" "lol"])]] [(form (list (bit #1) (int 123))) "(#1 123)" (^ [_ (#.Form (list [_ (#.Bit #1)] [_ (#.Int 123)]))])] [(tuple (list (bit #1) (int 123))) "[#1 123]" (^ [_ (#.Tuple (list [_ (#.Bit #1)] [_ (#.Int 123)]))])] [(record (list [(bit #1) (int 123)])) "{#1 123}" (^ [_ (#.Record (list [[_ (#.Bit #1)] [_ (#.Int 123)]]))])] [(local-tag "lol") "#lol" [_ (#.Tag ["" "lol"])]] - [(local-symbol "lol") "lol" [_ (#.Symbol ["" "lol"])]] + [(local-identifier "lol") "lol" [_ (#.Identifier ["" "lol"])]] )] (test-all ))))} (case tokens (^ (list& [_ (#Tuple bindings)] bodies)) (case bindings - (^ (list& [_ (#Symbol ["" var-name])] macro-expr bindings')) + (^ (list& [_ (#Identifier ["" var-name])] macro-expr bindings')) (do Monad [expansion (macro-expand-once macro-expr)] (case (place-tokens var-name expansion (` (.with-expansions @@ -5574,7 +5574,7 @@ (def: (anti-quote token) (-> Code (Meta Code)) (case token - [_ (#Symbol [def-prefix def-name])] + [_ (#Identifier [def-prefix def-name])] (if (text/= "" def-prefix) (:: Monad return token) (anti-quote-def [def-prefix def-name])) @@ -5693,7 +5693,7 @@ (fail "Wrong syntax for ^multi"))) (macro: #export (name-for tokens) - {#.doc (doc "Given a symbol or a tag, gives back a 2 tuple with the prefix and name parts, both as Text." + {#.doc (doc "Given an identifier or a tag, gives back a 2 tuple with the prefix and name parts, both as Text." (name-for #.doc) "=>" ["lux" "doc"])} @@ -5701,7 +5701,7 @@ (^template [] (^ (list [_ ( [prefix name])])) (return (list (` [(~ (text$ prefix)) (~ (text$ name))])))) - ([#Symbol] [#Tag]) + ([#Identifier] [#Tag]) _ (fail "Wrong syntax for name-for"))) @@ -5780,8 +5780,8 @@ +0 (to-list set))))} (case tokens - (^ (list& [_meta (#Form (list [_ (#Symbol ["" name])] pattern))] body branches)) - (let [g!whole (symbol$ ["" name])] + (^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] pattern))] body branches)) + (let [g!whole (identifier$ ["" name])] (return (list& g!whole (` (case (~ g!whole) (~ pattern) (~ body))) branches))) @@ -5795,8 +5795,8 @@ (^|> value [inc (n/% +10) (n/max +1)]) (foo value)))} (case tokens - (^ (list& [_meta (#Form (list [_ (#Symbol ["" name])] [_ (#Tuple steps)]))] body branches)) - (let [g!name (symbol$ ["" name])] + (^ (list& [_meta (#Form (list [_ (#Identifier ["" name])] [_ (#Tuple steps)]))] body branches)) + (let [g!name (identifier$ ["" name])] (return (list& g!name (` (let [(~ g!name) (|> (~ g!name) (~+ steps))] (~ body))) @@ -5838,7 +5838,7 @@ "==" Int)} (case tokens - (^ (list [_ (#Symbol var-name)])) + (^ (list [_ (#Identifier var-name)])) (do Monad [var-type (find-type var-name)] (wrap (list (type-to-code var-type)))) @@ -5849,12 +5849,12 @@ (def: (parse-complex-declaration tokens) (-> (List Code) (Meta [[Text (List Text)] (List Code)])) (case tokens - (^ (list& [_ (#Form (list& [_ (#Symbol ["" name])] args'))] tokens')) + (^ (list& [_ (#Form (list& [_ (#Identifier ["" name])] args'))] tokens')) (do Monad [args (monad/map Monad (function (_ arg') (case arg' - [_ (#Symbol ["" arg-name])] + [_ (#Identifier ["" arg-name])] (wrap arg-name) _ @@ -5924,13 +5924,13 @@ g!compiler (gensym "compiler") g!_ (gensym "_") #let [rep-env (list/map (function (_ arg) - [arg (` ((~' ~) (~ (symbol$ ["" arg]))))]) + [arg (` ((~' ~) (~ (identifier$ ["" arg]))))]) args)]] (wrap (list (` (macro: (~+ (export export?)) - ((~ (symbol$ ["" name])) (~ g!tokens) (~ g!compiler)) + ((~ (identifier$ ["" name])) (~ g!tokens) (~ g!compiler)) (~ anns) (case (~ g!tokens) - (^ (list (~+ (list/map (|>> [""] symbol$) args)))) + (^ (list (~+ (list/map (|>> [""] identifier$) args)))) (#.Right [(~ g!compiler) (list (~+ (list/map (function (_ template) (` (` (~ (replace-syntax rep-env template))))) @@ -6018,7 +6018,7 @@ (def: (label-code code) (-> Code (Meta [(List [Code Code]) Code])) (case code - (^ [ann (#Form (list [_ (#Symbol ["" "~~"])] expansion))]) + (^ [ann (#Form (list [_ (#Identifier ["" "~~"])] expansion))]) (do Monad [g!expansion (gensym "g!expansion")] (wrap [(list [g!expansion expansion]) g!expansion])) @@ -6091,7 +6091,7 @@ [#Frac "Frac" frac$] [#Text "Text" text$] [#Tag "Tag" name$] - [#Symbol "Symbol" name$]) + [#Identifier "Identifier" name$]) [_ (#Record fields)] (do Monad @@ -6105,16 +6105,16 @@ g!meta (gensym "g!meta")] (wrap (` [(~ g!meta) (#.Record (~ (untemplate-list =fields)))]))) - [_ (#Form (#Cons [[_ (#Symbol ["" "~"])] (#Cons [unquoted #Nil])]))] + [_ (#Form (#Cons [[_ (#Identifier ["" "~"])] (#Cons [unquoted #Nil])]))] (return unquoted) - [_ (#Form (#Cons [[_ (#Symbol ["" "~+"])] (#Cons [spliced #Nil])]))] + [_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] (fail "Cannot use (~+) inside of ^code unless it is the last element in a form or a tuple.") (^template [] [_ ( elems)] (case (list/reverse elems) - (#Cons [_ (#Form (#Cons [[_ (#Symbol ["" "~+"])] (#Cons [spliced #Nil])]))] + (#Cons [_ (#Form (#Cons [[_ (#Identifier ["" "~+"])] (#Cons [spliced #Nil])]))] inits) (do Monad [=inits (monad/map Monad untemplate-pattern (list/reverse inits)) diff --git a/stdlib/source/lux/cli.lux b/stdlib/source/lux/cli.lux index 9dc6a10ce..fdc1d9365 100644 --- a/stdlib/source/lux/cli.lux +++ b/stdlib/source/lux/cli.lux @@ -99,10 +99,10 @@ (def: program-args^ (Syntax Program-Args) - (p.alt s.local-symbol + (p.alt s.local-identifier (s.tuple (p.some (p.either (do p.Monad - [name s.local-symbol] - (wrap [(code.symbol ["" name]) (` any)])) + [name s.local-identifier] + (wrap [(code.identifier ["" name]) (` any)])) (s.record (p.seq s.any s.any))))))) (syntax: #export (program: @@ -127,7 +127,7 @@ (case args (#Raw args) (wrap (list (` ("lux program" - (.function ((~ g!program) (~ (code.symbol ["" args]))) + (.function ((~ g!program) (~ (code.identifier ["" args]))) ((~! do) (~! io.Monad) [] (~ body))))))) diff --git a/stdlib/source/lux/compiler/default/phase/analysis/case.lux b/stdlib/source/lux/compiler/default/phase/analysis/case.lux index e523d86a9..5b5b2038c 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/case.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/case.lux @@ -152,7 +152,7 @@ (def: (analyse-pattern num-tags inputT pattern next) (All [a] (-> (Maybe Nat) Type Code (Operation a) (Operation [Pattern a]))) (.case pattern - [cursor (#.Symbol ["" name])] + [cursor (#.Identifier ["" name])] (//.with-cursor cursor (do ///.Monad [outputA (scope.with-local [name inputT] diff --git a/stdlib/source/lux/compiler/default/phase/analysis/expression.lux b/stdlib/source/lux/compiler/default/phase/analysis/expression.lux index dd27c87e6..8a0a129bc 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/expression.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/expression.lux @@ -77,7 +77,7 @@ (^ (#.Record pairs)) (structure.record compile pairs) - (#.Symbol reference) + (#.Identifier reference) (reference.reference reference) (^ (#.Form (list& [_ (#.Text extension-name)] extension-args))) @@ -88,7 +88,7 @@ ## [[funcT funcA] (type.with-inference ## (compile func))] ## (case funcA - ## [_ (#.Symbol def-name)] + ## [_ (#.Identifier def-name)] ## (do @ ## [?macro (///.with-error-tracking ## (extension.lift (macro.find-macro def-name)))] diff --git a/stdlib/source/lux/compiler/default/phase/analysis/reference.lux b/stdlib/source/lux/compiler/default/phase/analysis/reference.lux index 0647dd391..862ec9daf 100644 --- a/stdlib/source/lux/compiler/default/phase/analysis/reference.lux +++ b/stdlib/source/lux/compiler/default/phase/analysis/reference.lux @@ -28,7 +28,7 @@ (with-expansions [ (wrap (|> def-name reference.constant #//.Reference))] (do ///.Monad [[actualT def-anns _] (extension.lift (macro.find-def def-name))] - (case (macro.get-symbol-ann (name-for #.alias) def-anns) + (case (macro.get-identifier-ann (name-for #.alias) def-anns) (#.Some real-def-name) (definition real-def-name) diff --git a/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux b/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux index 53fcfbff7..fb03f3788 100644 --- a/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/translation/scheme/extension/common.jvm.lux @@ -37,11 +37,11 @@ (type: #export Variadic (-> (List Expression) Computation)) ## [Utils] -(syntax: (arity: {name s.local-symbol} {arity s.nat}) +(syntax: (arity: {name s.local-identifier} {arity s.nat}) (with-gensyms [g!_ g!extension g!name g!translate g!inputs] (do @ [g!input+ (monad.seq @ (list.repeat arity (macro.gensym "input")))] - (wrap (list (` (def: #export ((~ (code.local-symbol name)) (~ g!extension)) + (wrap (list (` (def: #export ((~ (code.local-identifier name)) (~ g!extension)) (-> (-> (..Vector (~ (code.nat arity)) Expression) Computation) Handler) (function ((~ g!_) (~ g!name) (~ g!translate) (~ g!inputs)) diff --git a/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux b/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux index c67c2623f..f1a369333 100644 --- a/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux +++ b/stdlib/source/lux/compiler/default/phase/translation/scheme/runtime.jvm.lux @@ -74,18 +74,18 @@ (def: declaration (s.Syntax [Text (List Text)]) - (p.either (p.seq s.local-symbol (parser/wrap (list))) - (s.form (p.seq s.local-symbol (p.some s.local-symbol))))) + (p.either (p.seq s.local-identifier (parser/wrap (list))) + (s.form (p.seq s.local-identifier (p.some s.local-identifier))))) (syntax: (runtime: {[name args] declaration} definition) - (let [implementation (code.local-symbol (format "@@" name)) + (let [implementation (code.local-identifier (format "@@" name)) runtime (format prefix "__" (name.normalize name)) @runtime (` (_.var (~ (code.text runtime)))) - argsC+ (list/map code.local-symbol args) + argsC+ (list/map code.local-identifier args) argsLC+ (list/map (|>> name.normalize (format "LRV__") code.text (~) (_.var) (`)) args) - declaration (` ((~ (code.local-symbol name)) + declaration (` ((~ (code.local-identifier name)) (~+ argsC+))) type (` (-> (~+ (list.repeat (list.size argsC+) (` _.Expression))) _.Computation))] @@ -125,11 +125,11 @@ (_.cdr/1 list)))) _.nil)) -(syntax: #export (with-vars {vars (s.tuple (p.many s.local-symbol))} +(syntax: #export (with-vars {vars (s.tuple (p.many s.local-identifier))} body) (wrap (list (` (let [(~+ (|> vars (list/map (function (_ var) - (list (code.local-symbol var) + (list (code.local-identifier var) (` (_.var (~ (code.text (format "LRV__" (name.normalize var))))))))) list/join))] (~ body)))))) diff --git a/stdlib/source/lux/compiler/default/syntax.lux b/stdlib/source/lux/compiler/default/syntax.lux index 1378e37c0..20057bf28 100644 --- a/stdlib/source/lux/compiler/default/syntax.lux +++ b/stdlib/source/lux/compiler/default/syntax.lux @@ -572,7 +572,7 @@ (wrap [(update@ #.column (|>> ($_ n/+ +1 length)) where) [where (#.Tag value)]]))) -(def: #export (symbol current-module aliases where) +(def: #export (identifier current-module aliases where) (-> Text Aliases Cursor (l.Lexer [Cursor Code])) (do p.Monad [[value length] (name^ current-module aliases)] @@ -585,7 +585,7 @@ ["#1" #1]) _ - (#.Symbol value))]]))) + (#.Identifier value))]]))) (exception: #export (end-of-file {module Text}) module) @@ -609,7 +609,7 @@ (frac where) (int where) (rev where) - (symbol current-module aliases where) + (identifier current-module aliases where) (tag current-module aliases where) (text where) (do @ diff --git a/stdlib/source/lux/concurrency/actor.lux b/stdlib/source/lux/concurrency/actor.lux index b9b1a22c2..fb0e9171a 100644 --- a/stdlib/source/lux/concurrency/actor.lux +++ b/stdlib/source/lux/concurrency/actor.lux @@ -171,8 +171,8 @@ (def: actor-decl^ (Syntax [Text (List Text)]) - (p.either (s.form (p.seq s.local-symbol (p.some s.local-symbol))) - (p.seq s.local-symbol (:: p.Monad wrap (list))))) + (p.either (s.form (p.seq s.local-identifier (p.some s.local-identifier))) + (p.seq s.local-identifier (:: p.Monad wrap (list))))) (do-template [ ] [(def: #export @@ -195,8 +195,8 @@ (def: behavior^ (s.Syntax BehaviorC) - (let [handle-args ($_ p.seq s.local-symbol s.local-symbol s.local-symbol) - stop-args ($_ p.seq s.local-symbol s.local-symbol)] + (let [handle-args ($_ p.seq s.local-identifier s.local-identifier s.local-identifier) + stop-args ($_ p.seq s.local-identifier s.local-identifier)] (p.seq (p.maybe (s.form (p.seq (s.form (p.after (s.this (' handle)) handle-args)) s.any))) (p.maybe (s.form (p.seq (s.form (p.after (s.this (' stop)) stop-args)) @@ -230,11 +230,11 @@ (with-gensyms [g!_ g!init] (do @ [module macro.current-module-name - #let [g!type (code.local-symbol (state-name _name)) - g!behavior (code.local-symbol (behavior-name _name)) - g!actor (code.local-symbol _name) - g!new (code.local-symbol (new-name _name)) - g!vars (list/map code.local-symbol _vars)]] + #let [g!type (code.local-identifier (state-name _name)) + g!behavior (code.local-identifier (behavior-name _name)) + g!actor (code.local-identifier _name) + g!new (code.local-identifier (new-name _name)) + g!vars (list/map code.local-identifier _vars)]] (wrap (list (` (type: (~+ (csw.export export)) ((~ g!type) (~+ g!vars)) (~ state-type))) (` (type: (~+ (csw.export export)) ((~ g!actor) (~+ g!vars)) @@ -251,9 +251,9 @@ (#.Some [[messageN stateN selfN] bodyC]) (` (function ((~ g!_) - (~ (code.local-symbol messageN)) - (~ (code.local-symbol stateN)) - (~ (code.local-symbol selfN))) + (~ (code.local-identifier messageN)) + (~ (code.local-identifier stateN)) + (~ (code.local-identifier selfN))) (do task.Monad [] (~ bodyC)))))) @@ -263,8 +263,8 @@ (#.Some [[causeN stateN] bodyC]) (` (function ((~ g!_) - (~ (code.local-symbol causeN)) - (~ (code.local-symbol stateN))) + (~ (code.local-identifier causeN)) + (~ (code.local-identifier stateN))) (do promise.Monad [] (~ bodyC))))))})) @@ -285,17 +285,17 @@ (def: signature^ (s.Syntax Signature) (s.form ($_ p.seq - (p.default (list) (s.tuple (p.some s.local-symbol))) - s.local-symbol + (p.default (list) (s.tuple (p.some s.local-identifier))) + s.local-identifier (p.some csr.typed-input) - s.local-symbol - s.local-symbol + s.local-identifier + s.local-identifier s.any))) (def: reference^ (s.Syntax [Name (List Text)]) - (p.either (s.form (p.seq s.symbol (p.some s.local-symbol))) - (p.seq s.symbol (:: p.Monad wrap (list))))) + (p.either (s.form (p.seq s.identifier (p.some s.local-identifier))) + (p.seq s.identifier (:: p.Monad wrap (list))))) (syntax: #export (message: {export csr.export} @@ -322,15 +322,15 @@ [current-module macro.current-module-name actor-name (resolve-actor actor-name) #let [message-name [current-module (get@ #name signature)] - g!type (code.symbol (product.both id state-name actor-name)) - g!message (code.local-symbol (get@ #name signature)) - g!actor-vars (list/map code.local-symbol actor-vars) - actorC (` ((~ (code.symbol actor-name)) (~+ g!actor-vars))) - g!all-vars (|> (get@ #vars signature) (list/map code.local-symbol) (list/compose g!actor-vars)) + g!type (code.identifier (product.both id state-name actor-name)) + g!message (code.local-identifier (get@ #name signature)) + g!actor-vars (list/map code.local-identifier actor-vars) + actorC (` ((~ (code.identifier actor-name)) (~+ g!actor-vars))) + g!all-vars (|> (get@ #vars signature) (list/map code.local-identifier) (list/compose g!actor-vars)) g!inputsC (|> (get@ #inputs signature) (list/map product.left)) g!inputsT (|> (get@ #inputs signature) (list/map product.right)) - g!state (|> signature (get@ #state) code.local-symbol) - g!self (|> signature (get@ #self) code.local-symbol) + g!state (|> signature (get@ #state) code.local-identifier) + g!self (|> signature (get@ #self) code.local-identifier) g!actor-refs (: (List Code) (if (list.empty? actor-vars) (list) diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux index 397d41f55..211604dc7 100644 --- a/stdlib/source/lux/control/comonad.lux +++ b/stdlib/source/lux/control/comonad.lux @@ -37,9 +37,9 @@ (case tokens (#.Cons comonad (#.Cons [_ (#.Tuple bindings)] (#.Cons body #.Nil))) (if (|> bindings list.size (n/% +2) (n/= +0)) - (let [g!_ (: Code [_cursor (#.Symbol ["" " _ "])]) - g!map (: Code [_cursor (#.Symbol ["" " map "])]) - g!split (: Code [_cursor (#.Symbol ["" " split "])]) + (let [g!_ (: Code [_cursor (#.Identifier ["" " _ "])]) + g!map (: Code [_cursor (#.Identifier ["" " map "])]) + g!split (: Code [_cursor (#.Identifier ["" " split "])]) body' (list/fold (: (-> [Code Code] Code Code) (function (_ binding body') (let [[var value] binding] diff --git a/stdlib/source/lux/control/concatenative.lux b/stdlib/source/lux/control/concatenative.lux index f52ff2353..ab3ee39b1 100644 --- a/stdlib/source/lux/control/concatenative.lux +++ b/stdlib/source/lux/control/concatenative.lux @@ -31,7 +31,7 @@ (def: aliases^ (s.Syntax (List Alias)) - (|> (p.seq s.local-symbol s.any) + (|> (p.seq s.local-identifier s.any) p.some s.record (p.default (list)))) @@ -71,7 +71,7 @@ {outputs stack^}) (let [de-alias (function (_ aliased) (list/fold (function (_ [from to] pre) - (code.replace (code.local-symbol from) to pre)) + (code.replace (code.local-identifier from) to pre)) aliased aliases))] (case [(|> inputs (get@ #bottom) (maybe/map (|>> code.nat (~) #.Parameter (`)))) @@ -120,11 +120,11 @@ (syntax: #export (word: {export csr.export} - {name s.local-symbol} + {name s.local-identifier} {annotations (p.default cs.empty-annotations csr.annotations)} type {commands (p.some s.any)}) - (wrap (list (` (def: (~+ (csw.export export)) (~ (code.local-symbol name)) + (wrap (list (` (def: (~+ (csw.export export)) (~ (code.local-identifier name)) (~ (csw.annotations annotations)) (~ type) (|>> (~+ (list/map prepare commands)))))))) diff --git a/stdlib/source/lux/control/exception.lux b/stdlib/source/lux/control/exception.lux index f2635b6b2..86c2a8ddb 100644 --- a/stdlib/source/lux/control/exception.lux +++ b/stdlib/source/lux/control/exception.lux @@ -84,8 +84,8 @@ (syntax: #export (exception: {export csr.export} {t-vars (p.default (list) csr.type-variables)} - {[name inputs] (p.either (p.seq s.local-symbol (wrap (list))) - (s.form (p.seq s.local-symbol (p.some csr.typed-input))))} + {[name inputs] (p.either (p.seq s.local-identifier (wrap (list))) + (s.form (p.seq s.local-identifier (p.some csr.typed-input))))} {body (p.maybe s.any)}) {#.doc (doc "Define a new exception type." "It moslty just serves as a way to tag error messages for later catching." @@ -100,7 +100,7 @@ (do @ [current-module macro.current-module-name #let [descriptor ($_ text/compose "{" current-module "." name "}" "\n") - g!self (code.local-symbol name)]] + g!self (code.local-identifier name)]] (wrap (list (` (def: (~+ (csw.export export)) (~ g!self) (All [(~+ (csw.type-variables t-vars))] diff --git a/stdlib/source/lux/control/monad.lux b/stdlib/source/lux/control/monad.lux index c98851c95..09dd14237 100644 --- a/stdlib/source/lux/control/monad.lux +++ b/stdlib/source/lux/control/monad.lux @@ -64,9 +64,9 @@ (case tokens (#.Cons monad (#.Cons [_ (#.Tuple bindings)] (#.Cons body #.Nil))) (if (|> bindings list/size (n/% +2) (n/= +0)) - (let [g!_ (: Code [_cursor (#.Symbol ["" " _ "])]) - g!map (: Code [_cursor (#.Symbol ["" " map "])]) - g!join (: Code [_cursor (#.Symbol ["" " join "])]) + (let [g!_ (: Code [_cursor (#.Identifier ["" " _ "])]) + g!map (: Code [_cursor (#.Identifier ["" " map "])]) + g!join (: Code [_cursor (#.Identifier ["" " join "])]) body' (list/fold (: (-> [Code Code] Code Code) (function (_ binding body') (let [[var value] binding] diff --git a/stdlib/source/lux/data/collection/list.lux b/stdlib/source/lux/data/collection/list.lux index 671fbfe42..2d74aad79 100644 --- a/stdlib/source/lux/data/collection/list.lux +++ b/stdlib/source/lux/data/collection/list.lux @@ -282,7 +282,7 @@ ))) (structure: #export Monoid (All [a] - (Monoid (List a))) + (Monoid (List a))) (def: identity #.Nil) (def: (compose xs ys) (case xs @@ -380,9 +380,9 @@ ) ## [Syntax] -(def: (symbol$ name) +(def: (identifier$ name) (-> Text Code) - [["" +0 +0] (#.Symbol "" name)]) + [["" +0 +0] (#.Identifier "" name)]) (def: (nat/encode value) (-> Nat Text) @@ -416,7 +416,7 @@ (if (n/> +0 num-lists) (let [(^open ".") Functor indices (n/range +0 (dec num-lists)) - type-vars (: (List Code) (map (|>> nat/encode symbol$) indices)) + type-vars (: (List Code) (map (|>> nat/encode identifier$) indices)) zip-type (` (All [(~+ type-vars)] (-> (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var))))) type-vars)) @@ -425,12 +425,12 @@ (map inc) (map (function (_ idx) (let [base (nat/encode idx)] - [(symbol$ base) - (symbol$ ("lux text concat" base "'"))])))) + [(identifier$ base) + (identifier$ ("lux text concat" base "'"))])))) pattern (` [(~+ (map (function (_ [v vs]) (` (#.Cons (~ v) (~ vs)))) vars+lists))]) - g!step (symbol$ "\tstep\t") - g!blank (symbol$ "\t_\t") + g!step (identifier$ "\tstep\t") + g!blank (identifier$ "\t_\t") list-vars (map product.right vars+lists) code (` (: (~ zip-type) (function ((~ g!step) (~+ list-vars)) @@ -460,9 +460,9 @@ (if (n/> +0 num-lists) (let [(^open ".") Functor indices (n/range +0 (dec num-lists)) - g!return-type (symbol$ "\treturn-type\t") - g!func (symbol$ "\tfunc\t") - type-vars (: (List Code) (map (|>> nat/encode symbol$) indices)) + g!return-type (identifier$ "\treturn-type\t") + g!func (identifier$ "\tfunc\t") + type-vars (: (List Code) (map (|>> nat/encode identifier$) indices)) zip-type (` (All [(~+ type-vars) (~ g!return-type)] (-> (-> (~+ type-vars) (~ g!return-type)) (~+ (map (: (-> Code Code) (function (_ var) (` (List (~ var))))) @@ -472,12 +472,12 @@ (map inc) (map (function (_ idx) (let [base (nat/encode idx)] - [(symbol$ base) - (symbol$ ("lux text concat" base "'"))])))) + [(identifier$ base) + (identifier$ ("lux text concat" base "'"))])))) pattern (` [(~+ (map (function (_ [v vs]) (` (#.Cons (~ v) (~ vs)))) vars+lists))]) - g!step (symbol$ "\tstep\t") - g!blank (symbol$ "\t_\t") + g!step (identifier$ "\tstep\t") + g!blank (identifier$ "\t_\t") list-vars (map product.right vars+lists) code (` (: (~ zip-type) (function ((~ g!step) (~ g!func) (~+ list-vars)) diff --git a/stdlib/source/lux/data/error.lux b/stdlib/source/lux/data/error.lux index 0baeecc73..8054736e9 100644 --- a/stdlib/source/lux/data/error.lux +++ b/stdlib/source/lux/data/error.lux @@ -96,7 +96,7 @@ (#..Success (~' g!temp)) (~' g!temp) - (#..Error (~ [dummy-cursor (#.Symbol ["" ""])])) + (#..Error (~ [dummy-cursor (#.Identifier ["" ""])])) (~ else))))]) _ diff --git a/stdlib/source/lux/data/format/binary.lux b/stdlib/source/lux/data/format/binary.lux index add376a44..4ea21c30c 100644 --- a/stdlib/source/lux/data/format/binary.lux +++ b/stdlib/source/lux/data/format/binary.lux @@ -277,7 +277,7 @@ ..frac ## #Text ..text - ## #Symbol + ## #Identifier ..name ## #Tag ..name diff --git a/stdlib/source/lux/data/maybe.lux b/stdlib/source/lux/data/maybe.lux index 42e95d5f6..d6b44e02d 100644 --- a/stdlib/source/lux/data/maybe.lux +++ b/stdlib/source/lux/data/maybe.lux @@ -89,7 +89,7 @@ (default 20 #.None) => 20"} (case tokens (^ (list else maybe)) - (let [g!temp (: Code [dummy-cursor (#.Symbol ["" ""])]) + (let [g!temp (: Code [dummy-cursor (#.Identifier ["" ""])]) code (` (case (~ maybe) (#.Some (~ g!temp)) (~ g!temp) diff --git a/stdlib/source/lux/data/text/regex.lux b/stdlib/source/lux/data/text/regex.lux index 158eea153..b009d9dea 100644 --- a/stdlib/source/lux/data/text/regex.lux +++ b/stdlib/source/lux/data/text/regex.lux @@ -76,7 +76,7 @@ (-> Text (l.Lexer Code)) (do p.Monad [name (l.enclosed ["\\@<" ">"] (name^ current-module))] - (wrap (` (: (l.Lexer Text) (~ (code.symbol name))))))) + (wrap (` (: (l.Lexer Text) (~ (code.identifier name))))))) (def: re-range^ (l.Lexer Code) @@ -191,12 +191,12 @@ (p.either (do p.Monad [_ (l.this "\\") id number^] - (wrap (` ((~! ..copy) (~ (code.symbol ["" (int/encode (.int id))])))))) + (wrap (` ((~! ..copy) (~ (code.identifier ["" (int/encode (.int id))])))))) (do p.Monad [_ (l.this "\\k<") captured-name name-part^ _ (l.this ">")] - (wrap (` ((~! ..copy) (~ (code.symbol ["" captured-name])))))))) + (wrap (` ((~! ..copy) (~ (code.identifier ["" captured-name])))))))) (def: (re-simple^ current-module) (-> Text (l.Lexer Code)) @@ -268,8 +268,8 @@ (do p.Monad [parts (p.many (p.alt (re-complex^ current-module) (re-scoped^ current-module))) - #let [g!total (code.symbol ["" "0total"]) - g!temp (code.symbol ["" "0temp"]) + #let [g!total (code.identifier ["" "0total"]) + g!temp (code.identifier ["" "0temp"]) [_ names steps] (list/fold (: (-> (Either Code [Re-Group Code]) [Int (List Code) (List (List Code))] [Int (List Code) (List (List Code))]) @@ -285,10 +285,10 @@ (#.Right [(#Capturing [?name num-captures]) scoped]) (let [[idx! name!] (case ?name (#.Some _name) - [idx (code.symbol ["" _name])] + [idx (code.identifier ["" _name])] #.None - [(inc idx) (code.symbol ["" (int/encode idx)])]) + [(inc idx) (code.identifier ["" (int/encode idx)])]) access (if (n/> +0 num-captures) (` ((~! product.left) (~ name!))) name!)] @@ -360,7 +360,7 @@ [#let [sub^ (re-sequential^ capturing? re-scoped^ current-module)] head sub^ tail (p.some (p.after (l.this "|") sub^)) - #let [g!op (code.symbol ["" " alt "])]] + #let [g!op (code.identifier ["" " alt "])]] (if (list.empty? tail) (wrap head) (wrap [(list/fold n/max (product.left head) (list/map product.left tail)) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 7b02f3df6..1c314ba0f 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -304,7 +304,7 @@ (not (list.empty? pbounds)))) type-params) #.None - (code.symbol ["" name]) + (code.identifier ["" name]) (#.Some [pname pbounds]) (class->type' mode type-params in-array? (maybe.assume (list.head pbounds)))) @@ -330,7 +330,7 @@ (def: (type-param-type$ [name bounds]) (-> Type-Paramameter Code) - (code.symbol ["" name])) + (code.identifier ["" name])) (def: (class-decl-type$ (^slots [#class-name #class-params])) (-> Class-Declaration Code) @@ -338,7 +338,7 @@ (function (_ [pname pbounds]) (case pbounds #.Nil - (code.symbol ["" pname]) + (code.identifier ["" pname]) (#.Cons bound1 _) (class->type #ManualPrM class-params bound1)))) @@ -519,14 +519,14 @@ (-> Text Text (Syntax Code)) (do p.Monad [#let [dotted-name (format "::" field-name)] - _ (s.this (code.symbol ["" dotted-name]))] + _ (s.this (code.identifier ["" dotted-name]))] (wrap (`' ((~ (code.text (format "jvm getstatic" ":" class-name ":" field-name)))))))) (def: (make-get-var-parser class-name field-name) (-> Text Text (Syntax Code)) (do p.Monad [#let [dotted-name (format "::" field-name)] - _ (s.this (code.symbol ["" dotted-name]))] + _ (s.this (code.identifier ["" dotted-name]))] (wrap (`' ((~ (code.text (format "jvm getfield" ":" class-name ":" field-name))) _jvm_this))))) (def: (make-put-var-parser class-name field-name) @@ -534,7 +534,7 @@ (do p.Monad [#let [dotted-name (format "::" field-name)] [_ _ value] (: (Syntax [Any Any Code]) - (s.form ($_ p.seq (s.this (' :=)) (s.this (code.symbol ["" dotted-name])) s.any)))] + (s.form ($_ p.seq (s.this (' :=)) (s.this (code.identifier ["" dotted-name])) s.any)))] (wrap (`' ((~ (code.text (format "jvm putfield" ":" class-name ":" field-name))) _jvm_this (~ value)))))) (def: (pre-walk-replace f input) @@ -590,7 +590,7 @@ (do p.Monad [#let [dotted-name (format "::" method-name "!")] args (: (Syntax (List Code)) - (s.form (p.after (s.this (code.symbol ["" dotted-name])) + (s.form (p.after (s.this (code.identifier ["" dotted-name])) (s.tuple (p.exactly (list.size arg-decls) s.any))))) #let [arg-decls' (: (List Text) (list/map (|>> product.right (simple-class$ params)) arg-decls))]] (wrap (`' ((~ (code.text (format "jvm invokestatic" ":" class-name ":" method-name ":" (text.join-with "," arg-decls')))) @@ -602,7 +602,7 @@ (do p.Monad [#let [dotted-name (format "::" method-name "!")] args (: (Syntax (List Code)) - (s.form (p.after (s.this (code.symbol ["" dotted-name])) + (s.form (p.after (s.this (code.identifier ["" dotted-name])) (s.tuple (p.exactly (list.size arg-decls) s.any))))) #let [arg-decls' (: (List Text) (list/map (|>> product.right (simple-class$ params)) arg-decls))]] (wrap (`' ((~ (code.text (format ":" class-name ":" method-name ":" (text.join-with "," arg-decls')))) @@ -634,7 +634,7 @@ (def: (full-class-name^ imports) (-> Class-Imports (Syntax Text)) (do p.Monad - [name s.local-symbol] + [name s.local-identifier] (wrap (qualify imports name)))) (def: privacy-modifier^ @@ -711,10 +711,10 @@ (def: (type-param^ imports) (-> Class-Imports (Syntax Type-Paramameter)) (p.either (do p.Monad - [param-name s.local-symbol] + [param-name s.local-identifier] (wrap [param-name (list)])) (s.tuple (do p.Monad - [param-name s.local-symbol + [param-name s.local-identifier _ (s.this (' <)) bounds (p.many (generic-type^ imports (list)))] (wrap [param-name bounds]))))) @@ -788,7 +788,7 @@ (-> Class-Imports (List Type-Paramameter) (Syntax [Member-Declaration MethodDecl])) (s.form (do p.Monad [tvars (p.default (list) (type-params^ imports)) - name s.local-symbol + name s.local-identifier anns (annotations^ imports) inputs (s.tuple (p.some (generic-type^ imports type-vars))) output (generic-type^ imports type-vars) @@ -809,7 +809,7 @@ (-> Class-Imports (List Type-Paramameter) (Syntax [Member-Declaration FieldDecl])) (p.either (s.form (do p.Monad [_ (s.this (' #const)) - name s.local-symbol + name s.local-identifier anns (annotations^ imports) type (generic-type^ imports type-vars) body s.any] @@ -817,14 +817,14 @@ (s.form (do p.Monad [pm privacy-modifier^ sm state-modifier^ - name s.local-symbol + name s.local-identifier anns (annotations^ imports) type (generic-type^ imports type-vars)] (wrap [[name pm anns] (#VariableField [sm type])]))))) (def: (arg-decl^ imports type-vars) (-> Class-Imports (List Type-Paramameter) (Syntax ArgDecl)) - (s.tuple (p.seq s.local-symbol + (s.tuple (p.seq s.local-identifier (generic-type^ imports type-vars)))) (def: (arg-decls^ imports type-vars) @@ -865,7 +865,7 @@ final? (s.this? (' #final)) method-vars (p.default (list) (type-params^ imports)) #let [total-vars (list/compose class-vars method-vars)] - [name arg-decls] (s.form (p.seq s.local-symbol + [name arg-decls] (s.form (p.seq s.local-identifier (arg-decls^ imports total-vars))) return-type (generic-type^ imports total-vars) exs (throws-decl^ imports total-vars) @@ -883,7 +883,7 @@ owner-class (class-decl^ imports) method-vars (p.default (list) (type-params^ imports)) #let [total-vars (list/compose (product.right owner-class) method-vars)] - [name arg-decls] (s.form (p.seq s.local-symbol + [name arg-decls] (s.form (p.seq s.local-identifier (arg-decls^ imports total-vars))) return-type (generic-type^ imports total-vars) exs (throws-decl^ imports total-vars) @@ -902,7 +902,7 @@ _ (s.this (' #static)) method-vars (p.default (list) (type-params^ imports)) #let [total-vars method-vars] - [name arg-decls] (s.form (p.seq s.local-symbol + [name arg-decls] (s.form (p.seq s.local-identifier (arg-decls^ imports total-vars))) return-type (generic-type^ imports total-vars) exs (throws-decl^ imports total-vars) @@ -920,7 +920,7 @@ _ (s.this (' #abstract)) method-vars (p.default (list) (type-params^ imports)) #let [total-vars method-vars] - [name arg-decls] (s.form (p.seq s.local-symbol + [name arg-decls] (s.form (p.seq s.local-identifier (arg-decls^ imports total-vars))) return-type (generic-type^ imports total-vars) exs (throws-decl^ imports total-vars) @@ -937,7 +937,7 @@ _ (s.this (' #native)) method-vars (p.default (list) (type-params^ imports)) #let [total-vars method-vars] - [name arg-decls] (s.form (p.seq s.local-symbol + [name arg-decls] (s.form (p.seq s.local-identifier (arg-decls^ imports total-vars))) return-type (generic-type^ imports total-vars) exs (throws-decl^ imports total-vars) @@ -975,7 +975,7 @@ (Syntax (Maybe Text)) (p.maybe (do p.Monad [_ (s.this (' #as))] - s.local-symbol))) + s.local-identifier))) (def: (import-member-args^ imports type-vars) (-> Class-Imports (List Type-Paramameter) (Syntax (List [Bit GenericType]))) @@ -995,7 +995,7 @@ ($_ p.either (s.form (do p.Monad [_ (s.this (' #enum)) - enum-members (p.some s.local-symbol)] + enum-members (p.some s.local-identifier)] (wrap (#EnumDecl enum-members)))) (s.form (do p.Monad [tvars (p.default (list) (type-params^ imports)) @@ -1020,7 +1020,7 @@ (p.alt (s.this (' #static)) (wrap []))) tvars (p.default (list) (type-params^ imports)) - name s.local-symbol + name s.local-identifier ?alias import-member-alias^ #let [total-vars (list/compose owner-vars tvars)] ?prim-mode (p.maybe primitive-mode^) @@ -1040,7 +1040,7 @@ }])))) (s.form (do p.Monad [static? (s.this? (' #static)) - name s.local-symbol + name s.local-identifier ?prim-mode (p.maybe primitive-mode^) gtype (generic-type^ imports owner-vars) maybe? (s.this? (' #?)) @@ -1485,8 +1485,8 @@ (let [def-name (if long-name? full-name (short-class-name full-name)) - params' (list/map (|>> product.left code.local-symbol) params)] - (` (def: (~ (code.symbol ["" def-name])) + params' (list/map (|>> product.left code.local-identifier) params)] + (` (def: (~ (code.identifier ["" def-name])) {#.type? #1 #..jvm-class (~ (code.text full-name))} Type @@ -1562,7 +1562,7 @@ [(` (Maybe (~ return-type))) (` (??? (~ return-term)))] [return-type - (let [g!temp (code.symbol ["" " Ω "])] + (let [g!temp (code.identifier ["" " Ω "])] (` (let [(~ g!temp) (~ return-term)] (if (not (null? (:coerce (primitive "java.lang.Object") (~ g!temp)))) @@ -1596,7 +1596,7 @@ (def: (type-param->type-arg [name _]) (-> Type-Paramameter Code) - (code.symbol ["" name])) + (code.identifier ["" name])) (def: (with-mode-output mode output-type body) (-> Primitive-Mode GenericType Code Code) @@ -1701,7 +1701,7 @@ (` (All [(~+ =class-tvars)] (primitive (~ (code.text full-name)) [(~+ =class-tvars)])))))) getter-interop (: (-> Text Code) (function (_ name) - (let [getter-name (code.symbol ["" (format method-prefix member-separator name)])] + (let [getter-name (code.identifier ["" (format method-prefix member-separator name)])] (` (def: (~ getter-name) (~ enum-type) ((~ (code.text (format "jvm getstatic" ":" full-name ":" name)))))))))]] @@ -1710,7 +1710,7 @@ (#ConstructorDecl [commons _]) (do Monad [return-type (member-def-return (get@ #import-member-mode commons) type-params class member) - #let [def-name (code.symbol ["" (format method-prefix member-separator (get@ #import-member-alias commons))]) + #let [def-name (code.identifier ["" (format method-prefix member-separator (get@ #import-member-alias commons))]) def-params (list (code.tuple arg-function-inputs)) jvm-interop (|> (` ((~ (code.text (format "jvm new" ":" full-name ":" (text.join-with "," arg-classes)))) (~+ arg-method-inputs))) @@ -1728,7 +1728,7 @@ (with-gensyms [g!obj] (do @ [return-type (member-def-return (get@ #import-member-mode commons) type-params class member) - #let [def-name (code.symbol ["" (format method-prefix member-separator (get@ #import-member-alias commons))]) + #let [def-name (code.identifier ["" (format method-prefix member-separator (get@ #import-member-alias commons))]) (^slots [#import-member-kind]) commons (^slots [#import-method-name]) method [jvm-op obj-ast class-ast] (: [Text (List Code) (List Code)] @@ -1779,8 +1779,8 @@ (|> class-tvars (list.filter free-type-param?) (list/map type-param->type-arg))) - getter-name (code.symbol ["" (format method-prefix member-separator import-field-name)]) - setter-name (code.symbol ["" (format method-prefix member-separator import-field-name "!")])] + getter-name (code.identifier ["" (format method-prefix member-separator import-field-name)]) + setter-name (code.identifier ["" (format method-prefix member-separator import-field-name "!")])] getter-interop (with-gensyms [g!obj] (let [getter-call (if import-field-static? getter-name @@ -1969,7 +1969,7 @@ {#.doc (doc "Loads an element from an array." (array-read +10 my-array))} (case array - [_ (#.Symbol array-name)] + [_ (#.Identifier array-name)] (do Monad [array-type (macro.find-type array-name) array-jvm-type (type->class-name array-type)] @@ -1998,7 +1998,7 @@ {#.doc (doc "Stores an element into an array." (array-write +10 my-object my-array))} (case array - [_ (#.Symbol array-name)] + [_ (#.Identifier array-name)] (do Monad [array-type (macro.find-type array-name) array-jvm-type (type->class-name array-type)] @@ -2025,7 +2025,7 @@ (def: simple-bindings^ (Syntax (List [Text Code])) - (s.tuple (p.some (p.seq s.local-symbol s.any)))) + (s.tuple (p.some (p.seq s.local-identifier s.any)))) (syntax: #export (with-open {bindings simple-bindings^} @@ -2040,10 +2040,10 @@ (do-one-last-thing foo bar))))} (with-gensyms [g!output g!_] (let [inits (list/join (list/map (function (_ [res-name res-ctor]) - (list (code.symbol ["" res-name]) res-ctor)) + (list (code.identifier ["" res-name]) res-ctor)) bindings)) closes (list/map (function (_ res) - (` (try ("jvm invokevirtual:java.io.Closeable:close:" (~ (code.symbol ["" (product.left res)])))))) + (` (try ("jvm invokevirtual:java.io.Closeable:close:" (~ (code.identifier ["" (product.left res)])))))) bindings)] (wrap (list (` (do (~! io.Monad) [(~+ inits) diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index 5ccd6788d..f772f60fa 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -21,7 +21,7 @@ "Some value...")))} (case tokens (^ (list value)) - (let [blank (: Code [["" +0 +0] (#.Symbol ["" ""])])] + (let [blank (: Code [["" +0 +0] (#.Identifier ["" ""])])] (#.Right [state (list (` ([(~ blank) (~ blank)] (~ value))))])) _ diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index f6dc72204..1909aeca6 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -173,15 +173,15 @@ _ #.None))] - [get-bit-ann #.Bit Bit] - [get-int-ann #.Int Int] - [get-frac-ann #.Frac Frac] - [get-text-ann #.Text Text] - [get-symbol-ann #.Symbol Name] - [get-tag-ann #.Tag Name] - [get-form-ann #.Form (List Code)] - [get-tuple-ann #.Tuple (List Code)] - [get-record-ann #.Record (List [Code Code])] + [get-bit-ann #.Bit Bit] + [get-int-ann #.Int Int] + [get-frac-ann #.Frac Frac] + [get-text-ann #.Text Text] + [get-identifier-ann #.Identifier Name] + [get-tag-ann #.Tag Name] + [get-form-ann #.Form (List Code)] + [get-tuple-ann #.Tuple (List Code)] + [get-record-ann #.Record (List [Code Code])] ) (def: #export (get-doc anns) @@ -210,7 +210,7 @@ (def: #export (aliased? annotations) (-> Code Bit) - (case (get-symbol-ann (name-for #.alias) annotations) + (case (get-identifier-ann (name-for #.alias) annotations) (#.Some _) #1 @@ -255,7 +255,7 @@ (if (and (macro? def-anns) (or (export? def-anns) (text/= module this-module))) (#.Some (:coerce Macro def-value)) - (case (get-symbol-ann (name-for #.alias) def-anns) + (case (get-identifier-ann (name-for #.alias) def-anns) (#.Some [r-module r-name]) (find-macro' modules this-module r-module r-name) @@ -291,7 +291,7 @@ Otherwise, returns the code as-is."} (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Cons [[_ (#.Symbol name)] args]))] + [_ (#.Form (#.Cons [[_ (#.Identifier name)] args]))] (do Monad [?macro (find-macro name)] (case ?macro @@ -310,7 +310,7 @@ Otherwise, returns the code as-is."} (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Cons [[_ (#.Symbol name)] args]))] + [_ (#.Form (#.Cons [[_ (#.Identifier name)] args]))] (do Monad [?macro (find-macro name)] (case ?macro @@ -330,7 +330,7 @@ {#.doc "Expands all macro-calls everywhere recursively, until only primitive/base code remains."} (-> Code (Meta (List Code))) (case syntax - [_ (#.Form (#.Cons [[_ (#.Symbol name)] args]))] + [_ (#.Form (#.Cons [[_ (#.Identifier name)] args]))] (do Monad [?macro (find-macro name)] (case ?macro @@ -342,7 +342,7 @@ #.None (do Monad - [parts' (monad.map Monad expand-all (list& (code.symbol name) args))] + [parts' (monad.map Monad expand-all (list& (code.identifier name) args))] (wrap (list (code.form (list/join parts'))))))) [_ (#.Form (#.Cons [harg targs]))] @@ -370,19 +370,19 @@ (get@ #.seed) (:: number.Codec encode) ($_ text/compose "__gensym__" prefix) - [""] code.symbol)]))) + [""] code.identifier)]))) -(def: (get-local-symbol ast) +(def: (get-local-identifier ast) (-> Code (Meta Text)) (case ast - [_ (#.Symbol [_ name])] + [_ (#.Identifier [_ name])] (:: Monad wrap name) _ - (fail (text/compose "Code is not a local symbol: " (code.to-text ast))))) + (fail (text/compose "Code is not a local identifier: " (code.to-text ast))))) (macro: #export (with-gensyms tokens) - {#.doc (doc "Creates new symbols and offers them to the body expression." + {#.doc (doc "Creates new identifiers and offers them to the body expression." (syntax: #export (synchronized lock body) (with-gensyms [g!lock g!body g!_] (wrap (list (` (let [(~ g!lock) (~ lock) @@ -392,14 +392,14 @@ (~ g!body))))) )))} (case tokens - (^ (list [_ (#.Tuple symbols)] body)) + (^ (list [_ (#.Tuple identifiers)] body)) (do Monad - [symbol-names (monad.map @ get-local-symbol symbols) - #let [symbol-defs (list/join (list/map (: (-> Text (List Code)) - (function (_ name) (list (code.symbol ["" name]) (` (gensym (~ (code.text name))))))) - symbol-names))]] + [identifier-names (monad.map @ get-local-identifier identifiers) + #let [identifier-defs (list/join (list/map (: (-> Text (List Code)) + (function (_ name) (list (code.identifier ["" name]) (` (gensym (~ (code.text name))))))) + identifier-names))]] (wrap (list (` ((~! do) (~! Monad) - [(~+ symbol-defs)] + [(~+ identifier-defs)] (~ body)))))) _ @@ -671,7 +671,7 @@ (-> Name (Meta Name)) (do Monad [[_ def-anns _] (find-def def-name)] - (case (get-symbol-ann (name-for #.alias) def-anns) + (case (get-identifier-ann (name-for #.alias) def-anns) (#.Some real-def-name) (wrap real-def-name) diff --git a/stdlib/source/lux/macro/code.lux b/stdlib/source/lux/macro/code.lux index b48406f13..f6896343c 100644 --- a/stdlib/source/lux/macro/code.lux +++ b/stdlib/source/lux/macro/code.lux @@ -17,8 +17,8 @@ ## (#.Int Int) ## (#.Frac Frac) ## (#.Text Text) -## (#.Symbol Text Text) -## (#.Tag Text Text) +## (#.Identifier Name) +## (#.Tag Name) ## (#.Form (List (w (Code' w)))) ## (#.Tuple (List (w (Code' w)))) ## (#.Record (List [(w (Code' w)) (w (Code' w))]))) @@ -35,17 +35,17 @@ (-> Code) [_cursor ( x)])] - [bit Bit #.Bit] - [nat Nat #.Nat] - [int Int #.Int] - [rev Rev #.Rev] - [frac Frac #.Frac] - [text Text #.Text] - [symbol Name #.Symbol] - [tag Name #.Tag] - [form (List Code) #.Form] - [tuple (List Code) #.Tuple] - [record (List [Code Code]) #.Record] + [bit Bit #.Bit] + [nat Nat #.Nat] + [int Int #.Int] + [rev Rev #.Rev] + [frac Frac #.Frac] + [text Text #.Text] + [identifier Name #.Identifier] + [tag Name #.Tag] + [form (List Code) #.Form] + [tuple (List Code) #.Tuple] + [record (List [Code Code]) #.Record] ) (do-template [ ] @@ -54,8 +54,8 @@ (-> Text Code) [_cursor ( ["" name])])] - [local-symbol #.Symbol "Produces a local symbol (a symbol with no module prefix)."] - [local-tag #.Tag "Produces a local tag (a tag with no module prefix)."]) + [local-identifier #.Identifier "Produces a local identifier (an identifier with no module prefix)."] + [local-tag #.Tag "Produces a local tag (a tag with no module prefix)."]) ## [Structures] (structure: #export _ (Equivalence Code) @@ -64,14 +64,14 @@ (^template [ ] [[_ ( x')] [_ ( y')]] (:: = x' y')) - ([#.Bit Equivalence] - [#.Nat Equivalence] - [#.Int Equivalence] - [#.Rev Equivalence] - [#.Frac Equivalence] - [#.Text Equivalence] - [#.Symbol Equivalence] - [#.Tag Equivalence]) + ([#.Bit Equivalence] + [#.Nat Equivalence] + [#.Int Equivalence] + [#.Rev Equivalence] + [#.Frac Equivalence] + [#.Text Equivalence] + [#.Identifier Equivalence] + [#.Tag Equivalence]) (^template [] [[_ ( xs')] [_ ( ys')]] @@ -93,12 +93,12 @@ (^template [ ] [_ ( value)] (:: encode value)) - ([#.Bit Codec] - [#.Nat Codec] - [#.Int Codec] - [#.Rev Codec] - [#.Frac Codec] - [#.Symbol Codec]) + ([#.Bit Codec] + [#.Nat Codec] + [#.Int Codec] + [#.Rev Codec] + [#.Frac Codec] + [#.Identifier Codec]) [_ (#.Text value)] (text.encode value) diff --git a/stdlib/source/lux/macro/poly.lux b/stdlib/source/lux/macro/poly.lux index 1dffc77ea..7cfa74fce 100644 --- a/stdlib/source/lux/macro/poly.lux +++ b/stdlib/source/lux/macro/poly.lux @@ -131,7 +131,7 @@ (def: (label idx) (-> Nat Code) - (code.local-symbol (text/compose "label\u0000" (nat/encode idx)))) + (code.local-identifier (text/compose "label\u0000" (nat/encode idx)))) (def: #export (with-extension type poly) (All [a] (-> Type (Poly a) (Poly [Code a]))) @@ -353,11 +353,11 @@ ## [Syntax] (syntax: #export (poly: {export csr.export} - {name s.local-symbol} + {name s.local-identifier} body) (with-gensyms [g!_ g!type g!output] - (let [g!name (code.symbol ["" name])] - (wrap (.list (` (syntax: (~+ (csw.export export)) ((~ g!name) {(~ g!type) s.symbol}) + (let [g!name (code.identifier ["" name])] + (wrap (.list (` (syntax: (~+ (csw.export export)) ((~ g!name) {(~ g!type) s.identifier}) (do macro.Monad [(~ g!type) (macro.find-type-def (~ g!type))] (case (|> (~ body) @@ -383,8 +383,8 @@ #.None)) (syntax: #export (derived: {export csr.export} - {?name (p.maybe s.local-symbol)} - {[poly-func poly-args] (s.form (p.seq s.symbol (p.many s.symbol)))} + {?name (p.maybe s.local-identifier)} + {[poly-func poly-args] (s.form (p.seq s.identifier (p.many s.identifier)))} {?custom-impl (p.maybe s.any)}) (do @ [poly-args (monad.map @ macro.normalize poly-args) @@ -404,9 +404,9 @@ custom-impl #.None - (` ((~ (code.symbol poly-func)) (~+ (list/map code.symbol poly-args)))))]] + (` ((~ (code.identifier poly-func)) (~+ (list/map code.identifier poly-args)))))]] (wrap (.list (` (def: (~+ (csw.export export)) - (~ (code.symbol ["" name])) + (~ (code.identifier ["" name])) {#.struct? #1} (~ impl))))))) @@ -448,7 +448,7 @@ [#.Product & type.flatten-tuple]) (#.Named name sub-type) - (code.symbol name) + (code.identifier name) (^template [] ( scope body) diff --git a/stdlib/source/lux/macro/poly/equivalence.lux b/stdlib/source/lux/macro/poly/equivalence.lux index 8c2f8dd21..80606aeb2 100644 --- a/stdlib/source/lux/macro/poly/equivalence.lux +++ b/stdlib/source/lux/macro/poly/equivalence.lux @@ -35,7 +35,7 @@ ## [Derivers] (poly: #export Equivalence (`` (do @ - [#let [g!_ (code.local-symbol "_____________")] + [#let [g!_ (code.local-identifier "_____________")] *env* poly.env inputT poly.peek #let [@Equivalence (: (-> Type Code) @@ -99,9 +99,9 @@ ## Variants (do @ [members (poly.variant (p.many Equivalence)) - #let [g!_ (code.local-symbol "_____________") - g!left (code.local-symbol "_____________left") - g!right (code.local-symbol "_____________right")]] + #let [g!_ (code.local-identifier "_____________") + g!left (code.local-identifier "_____________left") + g!right (code.local-identifier "_____________right")]] (wrap (` (: (~ (@Equivalence inputT)) (function ((~ g!_) (~ g!left) (~ g!right)) (case [(~ g!left) (~ g!right)] @@ -115,10 +115,10 @@ ## Tuples (do @ [g!eqs (poly.tuple (p.many Equivalence)) - #let [g!_ (code.local-symbol "_____________") + #let [g!_ (code.local-identifier "_____________") indices (|> (list.size g!eqs) dec (list.n/range +0)) - g!lefts (list/map (|>> nat/encode (text/compose "left") code.local-symbol) indices) - g!rights (list/map (|>> nat/encode (text/compose "right") code.local-symbol) indices)]] + g!lefts (list/map (|>> nat/encode (text/compose "left") code.local-identifier) indices) + g!rights (list/map (|>> nat/encode (text/compose "right") code.local-identifier) indices)]] (wrap (` (: (~ (@Equivalence inputT)) (function ((~ g!_) [(~+ g!lefts)] [(~+ g!rights)]) (and (~+ (|> (list.zip3 g!eqs g!lefts g!rights) @@ -127,7 +127,7 @@ ## Type recursion (do @ [[g!self bodyC] (poly.recursive Equivalence) - #let [g!_ (code.local-symbol "_____________")]] + #let [g!_ (code.local-identifier "_____________")]] (wrap (` (: (~ (@Equivalence inputT)) (eq.rec (.function ((~ g!_) (~ g!self)) (~ bodyC))))))) diff --git a/stdlib/source/lux/macro/poly/functor.lux b/stdlib/source/lux/macro/poly/functor.lux index 3b9e851a4..d28e98337 100644 --- a/stdlib/source/lux/macro/poly/functor.lux +++ b/stdlib/source/lux/macro/poly/functor.lux @@ -19,9 +19,9 @@ (poly: #export Functor (do @ - [#let [type-funcC (code.local-symbol "____________type-funcC") - funcC (code.local-symbol "____________funcC") - inputC (code.local-symbol "____________inputC")] + [#let [type-funcC (code.local-identifier "____________type-funcC") + funcC (code.local-identifier "____________funcC") + inputC (code.local-identifier "____________inputC")] *env* poly.env inputT poly.peek [polyC varsC non-functorT] (poly.local (list inputT) @@ -31,7 +31,7 @@ (function (_ unwrappedT) (if (n/= +1 num-vars) (` ((~! functor.Functor) (~ (poly.to-code *env* unwrappedT)))) - (let [paramsC (|> num-vars dec list.indices (list/map (|>> %n code.local-symbol)))] + (let [paramsC (|> num-vars dec list.indices (list/map (|>> %n code.local-identifier)))] (` (All [(~+ paramsC)] ((~! functor.Functor) ((~ (poly.to-code *env* unwrappedT)) (~+ paramsC))))))))) Arg (: (-> Code (poly.Poly Code)) @@ -57,7 +57,7 @@ (poly.tuple (loop [idx +0 pairsCC (: (List [Code Code]) (list))] - (p.either (let [slotC (|> idx %n (format "____________slot") code.local-symbol)] + (p.either (let [slotC (|> idx %n (format "____________slot") code.local-identifier)] (do @ [_ (wrap []) memberC (Arg slotC)] @@ -70,13 +70,13 @@ ## Functions (do @ [_ (wrap []) - #let [g! (code.local-symbol "____________") - outL (code.local-symbol "____________outL")] + #let [g! (code.local-identifier "____________") + outL (code.local-identifier "____________outL")] [inT+ outC] (poly.function (p.many poly.any) (Arg outL)) #let [inC+ (|> (list.size inT+) dec (list.n/range +0) - (list/map (|>> %n (format "____________inC") code.local-symbol)))]] + (list/map (|>> %n (format "____________inC") code.local-identifier)))]] (wrap (` (function ((~ g!) (~+ inC+)) (let [(~ outL) ((~ valueC) (~+ inC+))] (~ outC)))))) diff --git a/stdlib/source/lux/macro/poly/json.lux b/stdlib/source/lux/macro/poly/json.lux index 7cd02657f..4217ce704 100644 --- a/stdlib/source/lux/macro/poly/json.lux +++ b/stdlib/source/lux/macro/poly/json.lux @@ -86,12 +86,12 @@ (with-expansions [ (do-template [ ] [(do @ - [#let [g!_ (code.local-symbol "_______")] + [#let [g!_ (code.local-identifier "_______")] _ ] (wrap (` (: (~ (@JSON//encode inputT)) ))))] - [(poly.exactly Any) (function ((~ g!_) (~ (code.symbol ["" "0"]))) #//.Null)] + [(poly.exactly Any) (function ((~ g!_) (~ (code.identifier ["" "0"]))) #//.Null)] [(poly.sub Bit) (|>> #//.Boolean)] [(poly.sub Nat) (:: (~! ..Codec) (~' encode))] [(poly.sub Int) (:: (~! ..Codec) (~' encode))] @@ -123,9 +123,9 @@ (wrap (` (: (~ (@JSON//encode inputT)) (:: (~! Codec) (~' encode)))))) (do @ - [#let [g!_ (code.local-symbol "_______") - g!key (code.local-symbol "_______key") - g!val (code.local-symbol "_______val")] + [#let [g!_ (code.local-identifier "_______") + g!key (code.local-identifier "_______key") + g!val (code.local-identifier "_______val")] [_ _ =val=] (poly.apply ($_ p.seq (poly.exactly d.Dictionary) (poly.exactly .Text) @@ -149,8 +149,8 @@ (wrap (` (: (~ (@JSON//encode inputT)) (|>> ((~! list/map) (~ =sub=)) row.from-list #//.Array))))) (do @ - [#let [g!_ (code.local-symbol "_______") - g!input (code.local-symbol "_______input")] + [#let [g!_ (code.local-identifier "_______") + g!input (code.local-identifier "_______input")] members (poly.variant (p.many Codec//encode))] (wrap (` (: (~ (@JSON//encode inputT)) (function ((~ g!_) (~ g!input)) @@ -162,10 +162,10 @@ (list.enumerate members)))))))))) (do @ [g!encoders (poly.tuple (p.many Codec//encode)) - #let [g!_ (code.local-symbol "_______") + #let [g!_ (code.local-identifier "_______") g!members (|> (list.size g!encoders) dec (list.n/range +0) - (list/map (|>> nat/encode code.local-symbol)))]] + (list/map (|>> nat/encode code.local-identifier)))]] (wrap (` (: (~ (@JSON//encode inputT)) (function ((~ g!_) [(~+ g!members)]) (//.json [(~+ (list/map (function (_ [g!member g!encode]) @@ -174,7 +174,7 @@ ## Type recursion (do @ [[selfC non-recC] (poly.recursive Codec//encode) - #let [g! (code.local-symbol "____________")]] + #let [g! (code.local-identifier "____________")]] (wrap (` (: (~ (@JSON//encode inputT)) ((~! ..rec-encode) (.function ((~ g!) (~ selfC)) (~ non-recC))))))) @@ -271,7 +271,7 @@ ## Type recursion (do @ [[selfC bodyC] (poly.recursive Codec//decode) - #let [g! (code.local-symbol "____________")]] + #let [g! (code.local-identifier "____________")]] (wrap (` (: (~ (@JSON//decode inputT)) (p.rec (.function ((~ g!) (~ selfC)) (~ bodyC))))))) diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 1334296da..db5e086b6 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -55,14 +55,14 @@ _ (#error.Error ($_ text/compose "Cannot parse " (remaining-inputs tokens))))))] - [ bit Bit #.Bit bit.Equivalence "bit"] - [ nat Nat #.Nat number.Equivalence "nat"] - [ int Int #.Int number.Equivalence "int"] - [ rev Rev #.Rev number.Equivalence "rev"] - [ frac Frac #.Frac number.Equivalence "frac"] - [ text Text #.Text text.Equivalence "text"] - [symbol Name #.Symbol name.Equivalence "symbol"] - [ tag Name #.Tag name.Equivalence "tag"] + [ bit Bit #.Bit bit.Equivalence "bit"] + [ nat Nat #.Nat number.Equivalence "nat"] + [ int Int #.Int number.Equivalence "int"] + [ rev Rev #.Rev number.Equivalence "rev"] + [ frac Frac #.Frac number.Equivalence "frac"] + [ text Text #.Text text.Equivalence "text"] + [identifier Name #.Identifier name.Equivalence "identifier"] + [ tag Name #.Tag name.Equivalence "tag"] ) (def: #export (this? ast) @@ -106,7 +106,7 @@ _ (#error.Error ($_ text/compose "Cannot parse local " (remaining-inputs tokens))))))] - [local-symbol #.Symbol "symbol"] + [local-identifier #.Identifier "identifier"] [ local-tag #.Tag "tag"] ) @@ -221,11 +221,11 @@ [#0 tokens])) ?parts (: (Maybe [Text (List Code) Code Code]) (case tokens - (^ (list [_ (#.Form (list& [_ (#.Symbol ["" name])] args))] + (^ (list [_ (#.Form (list& [_ (#.Identifier ["" name])] args))] body)) (#.Some name args (` {}) body) - (^ (list [_ (#.Form (list& [_ (#.Symbol ["" name])] args))] + (^ (list [_ (#.Form (list& [_ (#.Identifier ["" name])] args))] meta-data body)) (#.Some name args meta-data body) @@ -243,19 +243,19 @@ (^ [_ (#.Record (list [var parser]))]) (wrap [var parser]) - [_ (#.Symbol var-name)] - (wrap [(code.symbol var-name) (` any)]) + [_ (#.Identifier var-name)] + (wrap [(code.identifier var-name) (` any)]) _ - (//.fail "Syntax pattern expects records or symbols.")))) + (//.fail "Syntax pattern expects records or identifiers.")))) args) - #let [g!state (code.symbol ["" "*compiler*"]) + #let [g!state (code.identifier ["" "*compiler*"]) error-msg (code.text (text/compose "Wrong syntax for " name)) export-ast (: (List Code) (if exported? (list (' #export)) (list)))]] - (wrap (list (` (macro: (~+ export-ast) ((~ (code.symbol ["" name])) (~ g!tokens) (~ g!state)) + (wrap (list (` (macro: (~+ export-ast) ((~ (code.identifier ["" name])) (~ g!tokens) (~ g!state)) (~ meta) ({(#error.Success (~ g!body)) ((~ g!body) (~ g!state)) diff --git a/stdlib/source/lux/macro/syntax/common/reader.lux b/stdlib/source/lux/macro/syntax/common/reader.lux index 2ec2ee95d..fb4238317 100644 --- a/stdlib/source/lux/macro/syntax/common/reader.lux +++ b/stdlib/source/lux/macro/syntax/common/reader.lux @@ -26,10 +26,10 @@ quux (foo bar baz))} (Syntax //.Declaration) - (p.either (p.seq s.local-symbol + (p.either (p.seq s.local-identifier (parser/wrap (list))) - (s.form (p.seq s.local-symbol - (p.many s.local-symbol))))) + (s.form (p.seq s.local-identifier + (p.many s.local-identifier))))) ## Annotations (def: #export annotations @@ -114,7 +114,7 @@ (s.local me-definition-raw (s.form (do @ [_ (s.this (' "lux def")) - definition-name s.local-symbol + definition-name s.local-identifier [?definition-type definition-value] check^ definition-anns s.any definition-anns (s.local (list definition-anns) @@ -147,4 +147,4 @@ (def: #export type-variables {#.doc "Reader for the common type var/param used by many macros."} (Syntax (List Text)) - (s.tuple (p.some s.local-symbol))) + (s.tuple (p.some s.local-identifier))) diff --git a/stdlib/source/lux/macro/syntax/common/writer.lux b/stdlib/source/lux/macro/syntax/common/writer.lux index 114a41505..9133cdfa0 100644 --- a/stdlib/source/lux/macro/syntax/common/writer.lux +++ b/stdlib/source/lux/macro/syntax/common/writer.lux @@ -17,8 +17,8 @@ (def: #export (declaration declaration) (-> //.Declaration Code) - (` ((~ (code.local-symbol (get@ #//.declaration-name declaration))) - (~+ (list/map code.local-symbol + (` ((~ (code.local-identifier (get@ #//.declaration-name declaration))) + (~+ (list/map code.local-identifier (get@ #//.declaration-args declaration)))))) (def: #export (annotations anns) @@ -27,4 +27,4 @@ (def: #export (type-variables vars) (-> (List Text) (List Code)) - (list/map code.local-symbol vars)) + (list/map code.local-identifier vars)) diff --git a/stdlib/source/lux/math.lux b/stdlib/source/lux/math.lux index 8692449a1..fea20ba9c 100644 --- a/stdlib/source/lux/math.lux +++ b/stdlib/source/lux/math.lux @@ -199,7 +199,7 @@ (parser/map code.rev s.rev) (parser/map code.frac s.frac) (parser/map code.text s.text) - (parser/map code.symbol s.symbol) + (parser/map code.identifier s.identifier) (parser/map code.tag s.tag)) (s.form (p.many s.any)) (s.tuple (p.seq s.any infix^)) diff --git a/stdlib/source/lux/test.lux b/stdlib/source/lux/test.lux index 75879343c..307b71b89 100644 --- a/stdlib/source/lux/test.lux +++ b/stdlib/source/lux/test.lux @@ -239,7 +239,7 @@ (~ g!total-failures) +0] (~+ (|> tests (list/map (function (_ [module-name test desc]) - (` [(~ (code.text module-name)) (~ (code.symbol [module-name test])) (~ (code.text desc))]))) + (` [(~ (code.text module-name)) (~ (code.identifier [module-name test])) (~ (code.text desc))]))) (list.split-all promise.parallelism) (list/map (function (_ group) (list (` [(~ g!successes) (~ g!failures)]) (` ((~! run') (list (~+ group)))) diff --git a/stdlib/source/lux/type.lux b/stdlib/source/lux/type.lux index 929967e84..79f13333d 100644 --- a/stdlib/source/lux/type.lux +++ b/stdlib/source/lux/type.lux @@ -183,7 +183,7 @@ ([#.Sum] [#.Product] [#.Function] [#.Apply]) (#.Named name sub-type) - (code.symbol name) + (code.identifier name) (^template [] ( env body) @@ -336,7 +336,7 @@ +0 elem-type _ (|> elem-type (array (dec level)) (list) (#.Primitive "#Array")))) -(syntax: #export (:log! {input (p.alt s.symbol +(syntax: #export (:log! {input (p.alt s.identifier s.any)}) (case input (#.Left valueN) @@ -355,13 +355,13 @@ (def: type-parameters (Syntax (List Text)) - (s.tuple (p.some s.local-symbol))) + (s.tuple (p.some s.local-identifier))) (syntax: #export (:cast {type-vars type-parameters} input output {value (p.maybe s.any)}) - (let [casterC (` (: (All [(~+ (list/map code.local-symbol type-vars))] + (let [casterC (` (: (All [(~+ (list/map code.local-identifier type-vars))] (-> (~ input) (~ output))) (|>> :assume)))] (case value @@ -383,7 +383,7 @@ {exemplar typed} {computation typed}) (macro.with-gensyms [g!_] - (let [shareC (` (: (All [(~+ (list/map code.local-symbol type-vars))] + (let [shareC (` (: (All [(~+ (list/map code.local-identifier type-vars))] (-> (~ (get@ #type exemplar)) (~ (get@ #type computation)))) (.function ((~ g!_) (~ g!_)) diff --git a/stdlib/source/lux/type/abstract.lux b/stdlib/source/lux/type/abstract.lux index 648435721..a7fd3ead9 100644 --- a/stdlib/source/lux/type/abstract.lux +++ b/stdlib/source/lux/type/abstract.lux @@ -78,9 +78,9 @@ (-> Text Text (List Text) (Meta Any)) (do macro.Monad [this-module (macro.find-module this-module-name) - #let [type-varsC (list/map code.local-symbol type-vars) - abstraction-declaration (` ((~ (code.local-symbol name)) (~+ type-varsC))) - representation-declaration (` ((~ (code.local-symbol (representation-name name))) (~+ type-varsC))) + #let [type-varsC (list/map code.local-identifier type-vars) + abstraction-declaration (` ((~ (code.local-identifier name)) (~+ type-varsC))) + representation-declaration (` ((~ (code.local-identifier (representation-name name))) (~+ type-varsC))) this-module (|> this-module (update@ #.definitions (put down-cast (: Definition [Macro macro-anns @@ -103,8 +103,8 @@ (#error.Success [(update@ #.modules (put this-module-name this-module) compiler) []])))) -(syntax: (install-casts {name s.local-symbol} - {type-vars (s.tuple (p.some s.local-symbol))}) +(syntax: (install-casts {name s.local-identifier} + {type-vars (s.tuple (p.some s.local-identifier))}) (do @ [this-module-name macro.current-module-name ?down-cast (macro.find-macro [this-module-name down-cast]) @@ -134,8 +134,8 @@ (def: declaration (s.Syntax [Text (List Text)]) - (p.either (s.form (p.seq s.local-symbol (p.some s.local-symbol))) - (p.seq s.local-symbol (:: p.Monad wrap (list))))) + (p.either (s.form (p.seq s.local-identifier (p.some s.local-identifier))) + (p.seq s.local-identifier (:: p.Monad wrap (list))))) (syntax: #export (abstract: {export csr.export} @@ -144,25 +144,25 @@ representation-type {primitives (p.some s.any)}) (let [hidden-name (representation-name name) - type-varsC (list/map code.local-symbol type-vars) - abstraction-declaration (` ((~ (code.local-symbol name)) (~+ type-varsC))) - representation-declaration (` ((~ (code.local-symbol hidden-name)) (~+ type-varsC)))] + type-varsC (list/map code.local-identifier type-vars) + abstraction-declaration (` ((~ (code.local-identifier name)) (~+ type-varsC))) + representation-declaration (` ((~ (code.local-identifier hidden-name)) (~+ type-varsC)))] (wrap (list& (` (type: (~+ (csw.export export)) (~ abstraction-declaration) (~ (csw.annotations annotations)) (primitive (~ (code.text hidden-name)) [(~+ type-varsC)]))) (` (type: (~+ (csw.export export)) (~ representation-declaration) (~ representation-type))) - (` ((~! install-casts) (~ (code.local-symbol name)) [(~+ type-varsC)])) + (` ((~! install-casts) (~ (code.local-identifier name)) [(~+ type-varsC)])) (list/compose primitives (list (` ((~! un-install-casts))))))))) -(syntax: #export (^:representation {name (s.form s.local-symbol)} +(syntax: #export (^:representation {name (s.form s.local-identifier)} body {branches (p.some s.any)}) - (let [g!representation (code.local-symbol name)] + (let [g!representation (code.local-identifier name)] (do @ [current-module macro.current-module-name - #let [g!:representation (code.symbol [current-module up-cast])]] + #let [g!:representation (code.identifier [current-module up-cast])]] (wrap (list& g!representation (` (.let [(~ g!representation) ((~ g!:representation) (~ g!representation))] (~ body))) diff --git a/stdlib/source/lux/type/implicit.lux b/stdlib/source/lux/type/implicit.lux index b38ade514..8c1718d84 100644 --- a/stdlib/source/lux/type/implicit.lux +++ b/stdlib/source/lux/type/implicit.lux @@ -286,7 +286,7 @@ (def: (var? input) (-> Code Bit) (case input - [_ (#.Symbol _)] + [_ (#.Identifier _)] #1 _ @@ -300,14 +300,14 @@ (-> Instance Code) (case dependencies #.Nil - (code.symbol constructor) + (code.identifier constructor) _ - (` ((~ (code.symbol constructor)) (~+ (list/map instance$ dependencies)))))) + (` ((~ (code.identifier constructor)) (~+ (list/map instance$ dependencies)))))) (syntax: #export (::: - {member s.symbol} - {args (p.alt (p.seq (p.some s.symbol) s.end!) + {member s.identifier} + {args (p.alt (p.seq (p.some s.identifier) s.end!) (p.seq (p.some s.any) s.end!))}) {#.doc (doc "Automatic structure selection (for type-class style polymorphism)." "This feature layers type-class style polymorphism on top of Lux's signatures and structures." @@ -345,8 +345,8 @@ (#.Cons chosen #.Nil) (wrap (list (` (:: (~ (instance$ chosen)) - (~ (code.local-symbol (product.right member))) - (~+ (list/map code.symbol args)))))) + (~ (code.local-identifier (product.right member))) + (~+ (list/map code.identifier args)))))) _ (macro.fail (format "Too many options available: " @@ -359,7 +359,7 @@ (do @ [labels (|> (macro.gensym "") (list.repeat (list.size args)) (monad.seq @))] (wrap (list (` (let [(~+ (|> (list.zip2 labels args) (list/map join-pair) list/join))] - (..::: (~ (code.symbol member)) (~+ labels))))))) + (..::: (~ (code.identifier member)) (~+ labels))))))) )) (def: (implicit-bindings amount) diff --git a/stdlib/source/lux/type/quotient.lux b/stdlib/source/lux/type/quotient.lux index 8f22f4702..03119d865 100644 --- a/stdlib/source/lux/type/quotient.lux +++ b/stdlib/source/lux/type/quotient.lux @@ -58,7 +58,7 @@ ($_ p.seq poly.any poly.any poly.existential))] (wrap (.type (..Quotient valueT classT (:~ (#.Ex quotient-ex)))))))) -(syntax: #export (type {quotient s.symbol}) +(syntax: #export (type {quotient s.identifier}) (do @ [constructorT (macro.find-type quotient) quotientT (case (quotient-type constructorT) diff --git a/stdlib/source/lux/type/refinement.lux b/stdlib/source/lux/type/refinement.lux index dd8664236..01504af3c 100644 --- a/stdlib/source/lux/type/refinement.lux +++ b/stdlib/source/lux/type/refinement.lux @@ -92,7 +92,7 @@ (p.seq poly.any poly.existential)))] (wrap (.type (..Refined un-refinedT (#.Ex refined-ex))))))) -(syntax: #export (type {refinement s.symbol}) +(syntax: #export (type {refinement s.identifier}) (do @ [constructorT (macro.find-type refinement) refinementT (case (refinement-type constructorT) diff --git a/stdlib/source/lux/type/unit.lux b/stdlib/source/lux/type/unit.lux index 230818e30..a7d4effbc 100644 --- a/stdlib/source/lux/type/unit.lux +++ b/stdlib/source/lux/type/unit.lux @@ -70,13 +70,13 @@ (syntax: #export (unit: {export csr.export} - {name s.local-symbol} + {name s.local-identifier} {annotations (p.default cs.empty-annotations csr.annotations)}) - (wrap (list (` (type: (~+ (csw.export export)) (~ (code.local-symbol name)) + (wrap (list (` (type: (~+ (csw.export export)) (~ (code.local-identifier name)) (~ (csw.annotations annotations)) (primitive (~ (code.text (unit-name name)))))) - (` (def: (~+ (csw.export export)) (~ (code.local-symbol (format "@" name))) - (~ (code.local-symbol name)) + (` (def: (~+ (csw.export export)) (~ (code.local-identifier (format "@" name))) + (~ (code.local-identifier name)) (:assume []))) ))) @@ -93,14 +93,14 @@ (syntax: #export (scale: {export csr.export} - {name s.local-symbol} + {name s.local-identifier} {(^slots [#r.numerator #r.denominator]) ratio^} {annotations (p.default cs.empty-annotations csr.annotations)}) - (let [g!scale (code.local-symbol name)] + (let [g!scale (code.local-identifier name)] (wrap (list (` (type: (~+ (csw.export export)) ((~ g!scale) (~' u)) (~ (csw.annotations annotations)) (primitive (~ (code.text (scale-name name))) [(~' u)]))) - (` (structure: (~+ (csw.export export)) (~ (code.local-symbol (format "@" name))) + (` (structure: (~+ (csw.export export)) (~ (code.local-identifier (format "@" name))) (..Scale (~ g!scale)) (def: (~' scale) (|>> ..out diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux index b5140f782..66c5f1a23 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/function.lux @@ -53,7 +53,7 @@ arg-name (|> (r.unicode +5) (r.filter (|>> (text/= func-name) not))) [outputT outputC] _primitive.primitive [inputT _] _primitive.primitive - #let [g!arg (code.local-symbol arg-name)]] + #let [g!arg (code.local-identifier arg-name)]] ($_ seq (test "Can analyse function." (and (|> (typeA.with-type (All [a] (-> a outputT)) @@ -71,7 +71,7 @@ _structure.check-succeeds))) (test "The function's name is bound to the function's type." (|> (typeA.with-type (Rec self (-> inputT self)) - (/.function ..analyse func-name arg-name (code.local-symbol func-name))) + (/.function ..analyse func-name arg-name (code.local-identifier func-name))) _structure.check-succeeds)) )))) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux index 70679e22a..5c7296eff 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/procedure/common.lux @@ -178,7 +178,7 @@ idxC (|> r.nat (:: @ map code.nat)) var-name (r.unicode +5) #let [arrayT (type (Array elemT)) - g!array (code.local-symbol var-name) + g!array (code.local-identifier var-name) array-operation (function (_ output-type code) (|> (scope.with-scope "" (scope.with-local [var-name arrayT] @@ -253,7 +253,7 @@ (|> (scope.with-scope "" (scope.with-local [var-name atomT] (typeA.with-type elemT - (_primitive.analyse (` ("lux atom read" (~ (code.symbol ["" var-name])))))))) + (_primitive.analyse (` ("lux atom read" (~ (code.identifier ["" var-name])))))))) (phase.run [analysisE.bundle (init.compiler [])]) (case> (#e.Success _) #1 @@ -265,7 +265,7 @@ (scope.with-local [var-name atomT] (typeA.with-type Bit (_primitive.analyse (` ("lux atom compare-and-swap" - (~ (code.symbol ["" var-name])) + (~ (code.identifier ["" var-name])) (~ elemC) (~ elemC))))))) (phase.run [analysisE.bundle (init.compiler [])]) diff --git a/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux b/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux index de813de4e..5c5ac9ee5 100644 --- a/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux +++ b/stdlib/test/test/lux/compiler/default/phase/analysis/reference.lux @@ -60,7 +60,7 @@ (module.import def-module) (wrap []))] (typeA.with-inference - (..analyse (code.symbol [def-module var-name])))))) + (..analyse (code.identifier [def-module var-name])))))) (phase.run [analysisE.bundle (init.compiler [])]) check!)) @@ -78,7 +78,7 @@ (|> (scope.with-scope scope-name (scope.with-local [var-name expectedT] (typeA.with-inference - (..analyse (code.local-symbol var-name))))) + (..analyse (code.local-identifier var-name))))) (phase.run [analysisE.bundle (init.compiler [])]) (case> (^ (#e.Success [inferredT (#analysis.Reference (reference.local var))])) (and (type/= expectedT inferredT) @@ -91,7 +91,7 @@ (|> (do phase.Monad [_ (module.define var-name [expectedT (' {}) []])] (typeA.with-inference - (..analyse (code.symbol def-name)))) + (..analyse (code.identifier def-name)))) (module.with-module +0 def-module) (phase.run [analysisE.bundle (init.compiler [])]) (case> (^ (#e.Success [_ inferredT (#analysis.Reference (reference.constant constant-name))])) diff --git a/stdlib/test/test/lux/compiler/default/syntax.lux b/stdlib/test/test/lux/compiler/default/syntax.lux index a0d5ce367..8717f03fa 100644 --- a/stdlib/test/test/lux/compiler/default/syntax.lux +++ b/stdlib/test/test/lux/compiler/default/syntax.lux @@ -59,7 +59,7 @@ (do r.Monad [size (|> r.nat (r/map (n/% +20)))] (|> (r.unicode size) (r/map code.text))) - (|> name^ (r/map code.symbol)) + (|> name^ (r/map code.identifier)) (|> name^ (r/map code.tag)))) simple^ (: (r.Random Code) ($_ r.either diff --git a/stdlib/test/test/lux/data/name.lux b/stdlib/test/test/lux/data/name.lux index 699b76bb2..296e9c1bf 100644 --- a/stdlib/test/test/lux/data/name.lux +++ b/stdlib/test/test/lux/data/name.lux @@ -60,7 +60,7 @@ (context: "Name-related macros." (let [(^open "&/.") &.Equivalence] ($_ seq - (test "Can obtain Name from symbol." + (test "Can obtain Name from identifier." (and (&/= ["lux" "yolo"] (name-for .yolo)) (&/= ["test/lux/data/name" "yolo"] (name-for ..yolo)) (&/= ["" "yolo"] (name-for yolo)) diff --git a/stdlib/test/test/lux/macro/code.lux b/stdlib/test/test/lux/macro/code.lux index 735c28f64..d4739c894 100644 --- a/stdlib/test/test/lux/macro/code.lux +++ b/stdlib/test/test/lux/macro/code.lux @@ -24,11 +24,11 @@ [(&.frac 123.0) "123.0"] [(&.text "\n") "\"\\n\""] [(&.tag ["yolo" "lol"]) "#yolo.lol"] - [(&.symbol ["yolo" "lol"]) "yolo.lol"] + [(&.identifier ["yolo" "lol"]) "yolo.lol"] [(&.form (list (&.bit #1) (&.int 123))) "(#1 123)"] [(&.tuple (list (&.bit #1) (&.int 123))) "[#1 123]"] [(&.record (list [(&.bit #1) (&.int 123)])) "{#1 123}"] [(&.local-tag "lol") "#lol"] - [(&.local-symbol "lol") "lol"] + [(&.local-identifier "lol") "lol"] )] ($_ seq ))) diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index d378153bc..dfeacb0c6 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -72,24 +72,24 @@ (found? (s.this? ( )) (list ( ))) (enforced? (s.this ( )) (list ( )))))] - ["Can parse Bit syntax." #1 code.bit bit.Equivalence s.bit] - ["Can parse Nat syntax." +123 code.nat number.Equivalence s.nat] - ["Can parse Int syntax." 123 code.int number.Equivalence s.int] - ["Can parse Rev syntax." .123 code.rev number.Equivalence s.rev] - ["Can parse Frac syntax." 123.0 code.frac number.Equivalence s.frac] - ["Can parse Text syntax." "\n" code.text text.Equivalence s.text] - ["Can parse Symbol syntax." ["yolo" "lol"] code.symbol name.Equivalence s.symbol] - ["Can parse Tag syntax." ["yolo" "lol"] code.tag name.Equivalence s.tag] + ["Can parse Bit syntax." #1 code.bit bit.Equivalence s.bit] + ["Can parse Nat syntax." +123 code.nat number.Equivalence s.nat] + ["Can parse Int syntax." 123 code.int number.Equivalence s.int] + ["Can parse Rev syntax." .123 code.rev number.Equivalence s.rev] + ["Can parse Frac syntax." 123.0 code.frac number.Equivalence s.frac] + ["Can parse Text syntax." "\n" code.text text.Equivalence s.text] + ["Can parse Identifier syntax." ["yolo" "lol"] code.identifier name.Equivalence s.identifier] + ["Can parse Tag syntax." ["yolo" "lol"] code.tag name.Equivalence s.tag] )] ($_ seq - (test "Can parse symbols belonging to the current namespace." + (test "Can parse identifiers belonging to the current namespace." (and (match "yolo" - (p.run (list (code.local-symbol "yolo")) - s.local-symbol)) - (fails? (p.run (list (code.symbol ["yolo" "lol"])) - s.local-symbol)))) + (p.run (list (code.local-identifier "yolo")) + s.local-identifier)) + (fails? (p.run (list (code.identifier ["yolo" "lol"])) + s.local-identifier)))) (test "Can parse tags belonging to the current namespace." (and (match "yolo" -- cgit v1.2.3