diff options
author | Eduardo Julian | 2017-05-03 23:51:16 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-05-03 23:51:16 -0400 |
commit | c700bb87641d37b2db9f31cd8db157fce170f866 (patch) | |
tree | 5be5950a095451f0c08707deb3628ea6edfd5df5 | |
parent | 9849d179f644927be036ee66f32e219623a59021 (diff) |
- Removed the "S" suffix from AST tags.
Diffstat (limited to '')
25 files changed, 690 insertions, 690 deletions
diff --git a/luxc/src/lux/analyser.clj b/luxc/src/lux/analyser.clj index c47eaddfa..18bfdcd3e 100644 --- a/luxc/src/lux/analyser.clj +++ b/luxc/src/lux/analyser.clj @@ -24,7 +24,7 @@ :let [is-last? (= idx (dec (&/|length group)))]] (if (= 1 (&/|length group)) (|do [_cursor &/cursor] - (analyse exo-type (&/T [_cursor (&/$TupleS values)]))) + (analyse exo-type (&/T [_cursor (&/$Tuple values)]))) (|case exo-type (&/$VarT id) (|do [? (&type/bound? id)] @@ -66,53 +66,53 @@ macro-caller (aget compilers 2)] (|case token ;; Standard special forms - (&/$BoolS ?value) + (&/$Bool ?value) (|do [_ (&type/check exo-type &type/Bool)] (return (&/|list (&&/|meta exo-type cursor (&&/$bool ?value))))) - (&/$NatS ?value) + (&/$Nat ?value) (|do [_ (&type/check exo-type &type/Nat)] (return (&/|list (&&/|meta exo-type cursor (&&/$nat ?value))))) - (&/$IntS ?value) + (&/$Int ?value) (|do [_ (&type/check exo-type &type/Int)] (return (&/|list (&&/|meta exo-type cursor (&&/$int ?value))))) - (&/$DegS ?value) + (&/$Deg ?value) (|do [_ (&type/check exo-type &type/Deg)] (return (&/|list (&&/|meta exo-type cursor (&&/$deg ?value))))) - (&/$RealS ?value) + (&/$Real ?value) (|do [_ (&type/check exo-type &type/Real)] (return (&/|list (&&/|meta exo-type cursor (&&/$real ?value))))) - (&/$CharS ?value) + (&/$Char ?value) (|do [_ (&type/check exo-type &type/Char)] (return (&/|list (&&/|meta exo-type cursor (&&/$char ?value))))) - (&/$TextS ?value) + (&/$Text ?value) (|do [_ (&type/check exo-type &type/Text)] (return (&/|list (&&/|meta exo-type cursor (&&/$text ?value))))) - (&/$TupleS ?elems) + (&/$Tuple ?elems) (&/with-analysis-meta cursor exo-type (&&lux/analyse-tuple analyse (&/$Right exo-type) ?elems)) - (&/$RecordS ?elems) + (&/$Record ?elems) (&/with-analysis-meta cursor exo-type (&&lux/analyse-record analyse exo-type ?elems)) - (&/$TagS ?ident) + (&/$Tag ?ident) (&/with-analysis-meta cursor exo-type (analyse-variant+ analyse exo-type ?ident &/$Nil)) - (&/$SymbolS ?ident) + (&/$Symbol ?ident) (&/with-analysis-meta cursor exo-type (&&lux/analyse-symbol analyse exo-type ?ident)) - (&/$FormS (&/$Cons [command-meta command] parameters)) + (&/$Form (&/$Cons [command-meta command] parameters)) (|case command - (&/$SymbolS _ command-name) + (&/$Symbol _ command-name) (case command-name "_lux_case" (|let [(&/$Cons ?value ?branches) parameters] @@ -120,18 +120,18 @@ (&&lux/analyse-case analyse exo-type ?value ?branches))) "_lux_function" - (|let [(&/$Cons [_ (&/$SymbolS "" ?self)] - (&/$Cons [_ (&/$SymbolS "" ?arg)] + (|let [(&/$Cons [_ (&/$Symbol "" ?self)] + (&/$Cons [_ (&/$Symbol "" ?arg)] (&/$Cons ?body (&/$Nil)))) parameters] (&/with-analysis-meta cursor exo-type (&&lux/analyse-function analyse exo-type ?self ?arg ?body))) "_lux_proc" - (|let [(&/$Cons [_ (&/$TupleS (&/$Cons [_ (&/$TextS ?category)] - (&/$Cons [_ (&/$TextS ?proc)] + (|let [(&/$Cons [_ (&/$Tuple (&/$Cons [_ (&/$Text ?category)] + (&/$Cons [_ (&/$Text ?proc)] (&/$Nil))))] - (&/$Cons [_ (&/$TupleS ?args)] + (&/$Cons [_ (&/$Tuple ?args)] (&/$Nil))) parameters] (&/with-analysis-meta cursor exo-type (case ?category @@ -158,7 +158,7 @@ (&&lux/analyse-coerce analyse eval! exo-type ?type ?value))) "_lux_def" - (|let [(&/$Cons [_ (&/$SymbolS "" ?name)] + (|let [(&/$Cons [_ (&/$Symbol "" ?name)] (&/$Cons ?value (&/$Cons ?meta (&/$Nil)) @@ -172,7 +172,7 @@ (&&lux/analyse-module analyse optimize eval! compile-module ?meta))) "_lux_program" - (|let [(&/$Cons [_ (&/$SymbolS "" ?args)] + (|let [(&/$Cons [_ (&/$Symbol "" ?args)] (&/$Cons ?body (&/$Nil))) parameters] (&/with-cursor cursor @@ -183,11 +183,11 @@ (|do [=fn (just-analyse analyse (&/T [command-meta command]))] (&&lux/analyse-apply analyse cursor exo-type macro-caller =fn parameters)))) - (&/$NatS idx) + (&/$Nat idx) (&/with-analysis-meta cursor exo-type (&&lux/analyse-variant analyse (&/$Right exo-type) idx nil parameters)) - (&/$TagS ?ident) + (&/$Tag ?ident) (&/with-analysis-meta cursor exo-type (analyse-variant+ analyse exo-type ?ident parameters)) diff --git a/luxc/src/lux/analyser/case.clj b/luxc/src/lux/analyser/case.clj index 2f3a4d575..1e3214dad 100644 --- a/luxc/src/lux/analyser/case.clj +++ b/luxc/src/lux/analyser/case.clj @@ -37,7 +37,7 @@ ;; [Utils] (def ^:private unit-tuple - (&/T [(&/T ["" -1 -1]) (&/$TupleS &/$Nil)])) + (&/T [(&/T ["" -1 -1]) (&/$Tuple &/$Nil)])) (defn ^:private resolve-type [type] (|case type @@ -255,7 +255,7 @@ (defn ^:private analyse-pattern [var?? value-type pattern kont] (|let [[meta pattern*] pattern] (|case pattern* - (&/$SymbolS "" name) + (&/$Symbol "" name) (|case var?? (&/$Some var-analysis) (|do [=kont (&env/with-alias name var-analysis @@ -268,45 +268,45 @@ idx &env/next-local-idx] (return (&/T [($StoreTestAC idx) =kont])))) - (&/$SymbolS ident) + (&/$Symbol ident) (&/fail-with-loc (str "[Pattern-matching Error] Symbols must be unqualified: " (&/ident->text ident))) - (&/$BoolS ?value) + (&/$Bool ?value) (|do [_ (&type/check value-type &type/Bool) =kont kont] (return (&/T [($BoolTestAC ?value) =kont]))) - (&/$NatS ?value) + (&/$Nat ?value) (|do [_ (&type/check value-type &type/Nat) =kont kont] (return (&/T [($NatTestAC ?value) =kont]))) - (&/$IntS ?value) + (&/$Int ?value) (|do [_ (&type/check value-type &type/Int) =kont kont] (return (&/T [($IntTestAC ?value) =kont]))) - (&/$DegS ?value) + (&/$Deg ?value) (|do [_ (&type/check value-type &type/Deg) =kont kont] (return (&/T [($DegTestAC ?value) =kont]))) - (&/$RealS ?value) + (&/$Real ?value) (|do [_ (&type/check value-type &type/Real) =kont kont] (return (&/T [($RealTestAC ?value) =kont]))) - (&/$CharS ?value) + (&/$Char ?value) (|do [_ (&type/check value-type &type/Char) =kont kont] (return (&/T [($CharTestAC ?value) =kont]))) - (&/$TextS ?value) + (&/$Text ?value) (|do [_ (&type/check value-type &type/Text) =kont kont] (return (&/T [($TextTestAC ?value) =kont]))) - (&/$TupleS ?members) + (&/$Tuple ?members) (|case ?members (&/$Nil) (|do [_ (&type/check value-type &/$UnitT) @@ -343,16 +343,16 @@ _ (&/fail-with-loc (str "[Pattern-matching Error] Tuples require tuple-types: " (&type/show-type value-type)))))) - (&/$RecordS pairs) + (&/$Record pairs) (|do [[rec-members rec-type] (&&record/order-record pairs) must-infer? (&type/unknown? value-type) rec-type* (if must-infer? (&type/instantiate-inference rec-type) (return value-type)) _ (&type/check value-type rec-type*)] - (analyse-pattern &/$None rec-type* (&/T [meta (&/$TupleS rec-members)]) kont)) + (analyse-pattern &/$None rec-type* (&/T [meta (&/$Tuple rec-members)]) kont)) - (&/$TagS ?ident) + (&/$Tag ?ident) (|do [[=module =name] (&&/resolved-ident ?ident) must-infer? (&type/unknown? value-type) variant-type (if must-infer? @@ -368,17 +368,17 @@ [=test =kont] (analyse-pattern &/$None case-type unit-tuple kont)] (return (&/T [($VariantTestAC (&/T [idx (&/|length group) =test])) =kont]))) - (&/$FormS (&/$Cons [_ (&/$NatS idx)] ?values)) + (&/$Form (&/$Cons [_ (&/$Nat idx)] ?values)) (|do [value-type* (adjust-type value-type) case-type (&type/sum-at idx value-type*) [=test =kont] (case (int (&/|length ?values)) 0 (analyse-pattern &/$None case-type unit-tuple kont) 1 (analyse-pattern &/$None case-type (&/|head ?values) kont) ;; 1+ - (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$TupleS ?values)]) kont))] + (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$Tuple ?values)]) kont))] (return (&/T [($VariantTestAC (&/T [idx (&/|length (&type/flatten-sum value-type*)) =test])) =kont]))) - (&/$FormS (&/$Cons [_ (&/$TagS ?ident)] ?values)) + (&/$Form (&/$Cons [_ (&/$Tag ?ident)] ?values)) (|do [[=module =name] (&&/resolved-ident ?ident) must-infer? (&type/unknown? value-type) variant-type (if must-infer? @@ -395,7 +395,7 @@ 0 (analyse-pattern &/$None case-type unit-tuple kont) 1 (analyse-pattern &/$None case-type (&/|head ?values) kont) ;; 1+ - (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$TupleS ?values)]) kont))] + (analyse-pattern &/$None case-type (&/T [(&/T ["" -1 -1]) (&/$Tuple ?values)]) kont))] (return (&/T [($VariantTestAC (&/T [idx (&/|length group) =test])) =kont]))) _ diff --git a/luxc/src/lux/analyser/proc/js.clj b/luxc/src/lux/analyser/proc/js.clj index ff6a21c11..986720108 100644 --- a/luxc/src/lux/analyser/proc/js.clj +++ b/luxc/src/lux/analyser/proc/js.clj @@ -32,7 +32,7 @@ (&&/$proc (&/T ["js" "object-call"]) (&/$Cons =object (&/$Cons =field =args)) (&/|list))))))) (defn ^:private analyse-js-ref [analyse exo-type ?values] - (|do [:let [(&/$Cons [_ (&/$TextS ?ref-name)] (&/$Nil)) ?values] + (|do [:let [(&/$Cons [_ (&/$Text ?ref-name)] (&/$Nil)) ?values] _ (&type/check exo-type (&/$HostT "object" &/$Nil)) _cursor &/cursor] (return (&/|list (&&/|meta exo-type _cursor diff --git a/luxc/src/lux/analyser/proc/jvm.clj b/luxc/src/lux/analyser/proc/jvm.clj index 3fc3e2e8c..ba9be52b1 100644 --- a/luxc/src/lux/analyser/proc/jvm.clj +++ b/luxc/src/lux/analyser/proc/jvm.clj @@ -553,7 +553,7 @@ (let [length-type &type/Nat idx-type &type/Nat] (defn ^:private analyse-jvm-anewarray [analyse exo-type ?values] - (|do [:let [(&/$Cons [_ (&/$TextS _gclass)] (&/$Cons length (&/$Nil))) ?values] + (|do [:let [(&/$Cons [_ (&/$Text _gclass)] (&/$Cons length (&/$Nil))) ?values] gclass (&reader/with-source "jvm-anewarray" _gclass &&a-parser/parse-gclass) gtype-env &/get-type-env @@ -805,7 +805,7 @@ (&&/$proc (&/T ["jvm" "instanceof"]) (&/|list =object) (&/|list class))))))) (defn ^:private analyse-jvm-load-class [analyse exo-type ?values] - (|do [:let [(&/$Cons [_ (&/$TextS _class-name)] (&/$Nil)) ?values] + (|do [:let [(&/$Cons [_ (&/$Text _class-name)] (&/$Nil)) ?values] ^ClassLoader class-loader &/loader _ (try (do (.loadClass class-loader _class-name) (return nil)) @@ -856,7 +856,7 @@ &/$Nil &/$Nil &/$Nil - (&/$TupleS &/$Nil)])) + (&/$Tuple &/$Nil)])) captured-slot-class "java.lang.Object" captured-slot-type (&/$GenericClass captured-slot-class &/$Nil)] (defn ^:private analyse-jvm-anon-class [analyse compile-class exo-type super-class interfaces ctor-args methods] diff --git a/luxc/src/lux/analyser/record.clj b/luxc/src/lux/analyser/record.clj index 9268f4c22..90be7d330 100644 --- a/luxc/src/lux/analyser/record.clj +++ b/luxc/src/lux/analyser/record.clj @@ -13,7 +13,7 @@ (&/$Nil) (return (&/T [&/$Nil &/$UnitT])) - (&/$Cons [[_ (&/$TagS tag1)] _] _) + (&/$Cons [[_ (&/$Tag tag1)] _] _) (|do [[module name] (&&/resolved-ident tag1) tags (&&module/tag-group module name) type (&&module/tag-type module name)] @@ -23,7 +23,7 @@ (&/fail-with-loc "[Analyser Error] Wrong syntax for records. Odd elements must be tags.")) =pairs (&/map% (fn [kv] (|case kv - [[_ (&/$TagS k)] v] + [[_ (&/$Tag k)] v] (|do [=k (&&/resolved-ident k)] (return (&/T [(&/ident->text =k) v]))) diff --git a/luxc/src/lux/base.clj b/luxc/src/lux/base.clj index 536009a39..7e36ca903 100644 --- a/luxc/src/lux/base.clj +++ b/luxc/src/lux/base.clj @@ -71,18 +71,18 @@ ;; AST (defvariant - ("BoolS" 1) - ("NatS" 1) - ("IntS" 1) - ("DegS" 1) - ("RealS" 1) - ("CharS" 1) - ("TextS" 1) - ("SymbolS" 1) - ("TagS" 1) - ("FormS" 1) - ("TupleS" 1) - ("RecordS" 1)) + ("Bool" 1) + ("Nat" 1) + ("Int" 1) + ("Deg" 1) + ("Real" 1) + ("Char" 1) + ("Text" 1) + ("Symbol" 1) + ("Tag" 1) + ("Form" 1) + ("Tuple" 1) + ("Record" 1)) ;; Type (defvariant @@ -1205,48 +1205,48 @@ (defn show-ast [ast] (|case ast - [_ ($BoolS ?value)] + [_ ($Bool ?value)] (pr-str ?value) - [_ ($NatS ?value)] + [_ ($Nat ?value)] (str "+" (Long/toUnsignedString ?value)) - [_ ($IntS ?value)] + [_ ($Int ?value)] (pr-str ?value) - [_ ($DegS ?value)] + [_ ($Deg ?value)] (encode-deg ?value) - [_ ($RealS ?value)] + [_ ($Real ?value)] (pr-str ?value) - [_ ($CharS ?value)] + [_ ($Char ?value)] (str "#\"" (pr-str ?value) "\"") - [_ ($TextS ?value)] + [_ ($Text ?value)] (str "\"" ?value "\"") - [_ ($TagS ?module ?tag)] + [_ ($Tag ?module ?tag)] (if (.equals "" ?module) (str "#" ?tag) (str "#" ?module ";" ?tag)) - [_ ($SymbolS ?module ?name)] + [_ ($Symbol ?module ?name)] (if (.equals "" ?module) ?name (str ?module ";" ?name)) - [_ ($TupleS ?elems)] + [_ ($Tuple ?elems)] (str "[" (->> ?elems (|map show-ast) (|interpose " ") (fold str "")) "]") - [_ ($RecordS ?elems)] + [_ ($Record ?elems)] (str "{" (->> ?elems (|map (fn [elem] (|let [[k v] elem] (str (show-ast k) " " (show-ast v))))) (|interpose " ") (fold str "")) "}") - [_ ($FormS ?elems)] + [_ ($Form ?elems)] (str "(" (->> ?elems (|map show-ast) (|interpose " ") (fold str "")) ")") _ diff --git a/luxc/src/lux/parser.clj b/luxc/src/lux/parser.clj index 3f0a95653..c502efff2 100644 --- a/luxc/src/lux/parser.clj +++ b/luxc/src/lux/parser.clj @@ -35,8 +35,8 @@ (&/fail-with-loc (str "[Parser Error] Unbalanced " <description> ".")) ))) - ^:private parse-form &lexer/$Close_Paren "parantheses" &/$FormS - ^:private parse-tuple &lexer/$Close_Bracket "brackets" &/$TupleS + ^:private parse-form &lexer/$Close_Paren "parantheses" &/$Form + ^:private parse-tuple &lexer/$Close_Bracket "brackets" &/$Tuple ) (defn ^:private parse-record [parse] @@ -47,7 +47,7 @@ [meta (&lexer/$Close_Brace _)] (|do [_ (&/assert! (even? (&/|length elems)) (&/fail-with-loc base-uneven-record-error))] - (return (&/$RecordS (&/|as-pairs elems)))) + (return (&/$Record (&/|as-pairs elems)))) _ (&/fail-with-loc "[Parser Error] Unbalanced braces.") @@ -65,31 +65,31 @@ (return &/$Nil) (&lexer/$Bool ?value) - (return (&/|list (&/T [meta (&/$BoolS (Boolean/parseBoolean ?value))]))) + (return (&/|list (&/T [meta (&/$Bool (Boolean/parseBoolean ?value))]))) (&lexer/$Nat ?value) - (return (&/|list (&/T [meta (&/$NatS (Long/parseUnsignedLong ?value))]))) + (return (&/|list (&/T [meta (&/$Nat (Long/parseUnsignedLong ?value))]))) (&lexer/$Int ?value) - (return (&/|list (&/T [meta (&/$IntS (Long/parseLong ?value))]))) + (return (&/|list (&/T [meta (&/$Int (Long/parseLong ?value))]))) (&lexer/$Deg ?value) - (return (&/|list (&/T [meta (&/$DegS (&/decode-deg ?value))]))) + (return (&/|list (&/T [meta (&/$Deg (&/decode-deg ?value))]))) (&lexer/$Real ?value) - (return (&/|list (&/T [meta (&/$RealS (Double/parseDouble ?value))]))) + (return (&/|list (&/T [meta (&/$Real (Double/parseDouble ?value))]))) (&lexer/$Char ^String ?value) - (return (&/|list (&/T [meta (&/$CharS (.charAt ?value 0))]))) + (return (&/|list (&/T [meta (&/$Char (.charAt ?value 0))]))) (&lexer/$Text ?value) - (return (&/|list (&/T [meta (&/$TextS ?value)]))) + (return (&/|list (&/T [meta (&/$Text ?value)]))) (&lexer/$Symbol ?ident) - (return (&/|list (&/T [meta (&/$SymbolS ?ident)]))) + (return (&/|list (&/T [meta (&/$Symbol ?ident)]))) (&lexer/$Tag ?ident) - (return (&/|list (&/T [meta (&/$TagS ?ident)]))) + (return (&/|list (&/T [meta (&/$Tag ?ident)]))) (&lexer/$Open_Paren _) (|do [syntax (parse-form parse)] diff --git a/luxc/test/test/lux/parser.clj b/luxc/test/test/lux/parser.clj index 327b61bb3..2cf76def7 100644 --- a/luxc/test/test/lux/parser.clj +++ b/luxc/test/test/lux/parser.clj @@ -44,7 +44,7 @@ output2 &parser/parse] (return (&/|++ output1 output2))) (make-state (str input1 "\n" input2))) - (&/$Right state (&/$Cons [_ (&/$BoolS output1)] (&/$Cons [_ (&/$BoolS output2)] (&/$Nil)))) + (&/$Right state (&/$Cons [_ (&/$Bool output1)] (&/$Cons [_ (&/$Bool output2)] (&/$Nil)))) (are [input output] (= input output) true output1 false output2) @@ -62,7 +62,7 @@ output3 &parser/parse] (return (&/|++ output1 (&/|++ output2 output3)))) (make-state (str input1 "\n" input2 "\n" input3))) - (&/$Right state (&/$Cons [_ (&/$IntS output1)] (&/$Cons [_ (&/$IntS output2)] (&/$Cons [_ (&/$IntS output3)] (&/$Nil))))) + (&/$Right state (&/$Cons [_ (&/$Int output1)] (&/$Cons [_ (&/$Int output2)] (&/$Cons [_ (&/$Int output3)] (&/$Nil))))) (are [input output] (= input output) 0 output1 12 output2 @@ -81,7 +81,7 @@ output3 &parser/parse] (return (&/|++ output1 (&/|++ output2 output3)))) (make-state (str input1 "\n" input2 "\n" input3))) - (&/$Right state (&/$Cons [_ (&/$RealS output1)] (&/$Cons [_ (&/$RealS output2)] (&/$Cons [_ (&/$RealS output3)] (&/$Nil))))) + (&/$Right state (&/$Cons [_ (&/$Real output1)] (&/$Cons [_ (&/$Real output2)] (&/$Cons [_ (&/$Real output3)] (&/$Nil))))) (are [input output] (= input output) 0.00123 output1 12.010203 output2 @@ -114,15 +114,15 @@ (make-state (str "#\"" input1 "\"" "\n" "#\"" input2 "\"" "\n" "#\"" input3 "\"" "\n" "#\"" input4 "\"" "\n" "#\"" input5 "\"" "\n" "#\"" input6 "\"" "\n" "#\"" input7 "\"" "\n" "#\"" input8 "\"" "\n" "#\"" input9 "\""))) - (&/$Right state (&/$Cons [_ (&/$CharS output1)] - (&/$Cons [_ (&/$CharS output2)] - (&/$Cons [_ (&/$CharS output3)] - (&/$Cons [_ (&/$CharS output4)] - (&/$Cons [_ (&/$CharS output5)] - (&/$Cons [_ (&/$CharS output6)] - (&/$Cons [_ (&/$CharS output7)] - (&/$Cons [_ (&/$CharS output8)] - (&/$Cons [_ (&/$CharS output9)] + (&/$Right state (&/$Cons [_ (&/$Char output1)] + (&/$Cons [_ (&/$Char output2)] + (&/$Cons [_ (&/$Char output3)] + (&/$Cons [_ (&/$Char output4)] + (&/$Cons [_ (&/$Char output5)] + (&/$Cons [_ (&/$Char output6)] + (&/$Cons [_ (&/$Char output7)] + (&/$Cons [_ (&/$Char output8)] + (&/$Cons [_ (&/$Char output9)] (&/$Nil))))))))))) (are [input output] (= input output) \a output1 @@ -150,7 +150,7 @@ output4 &parser/parse] (return (&/|++ output1 (&/|++ output2 (&/|++ output3 output4))))) (make-state (str "\"" input1 "\"" "\n" "\"" input2 "\"" "\n" "\"" input3 "\"" "\n" "\"" input4 "\""))) - (&/$Right state (&/$Cons [_ (&/$TextS output1)] (&/$Cons [_ (&/$TextS output2)] (&/$Cons [_ (&/$TextS output3)] (&/$Cons [_ (&/$TextS output4)] (&/$Nil)))))) + (&/$Right state (&/$Cons [_ (&/$Text output1)] (&/$Cons [_ (&/$Text output2)] (&/$Cons [_ (&/$Text output3)] (&/$Cons [_ (&/$Text output4)] (&/$Nil)))))) (are [input output] (= input output) input1 output1 input2 output2 @@ -175,11 +175,11 @@ output5 &parser/parse] (return (&/|++ output1 (&/|++ output2 (&/|++ output3 (&/|++ output4 output5)))))) (make-state (str input1 "\n" input2 "\n" input3 "\n" input4 "\n" input5 " "))) - (&/$Right state (&/$Cons [_ (&/$SymbolS output1)] - (&/$Cons [_ (&/$SymbolS output2)] - (&/$Cons [_ (&/$SymbolS output3)] - (&/$Cons [_ (&/$SymbolS output4)] - (&/$Cons [_ (&/$SymbolS output5)] + (&/$Right state (&/$Cons [_ (&/$Symbol output1)] + (&/$Cons [_ (&/$Symbol output2)] + (&/$Cons [_ (&/$Symbol output3)] + (&/$Cons [_ (&/$Symbol output4)] + (&/$Cons [_ (&/$Symbol output5)] (&/$Nil))))))) (are [input output] (&/ident= input output) (&/T ["" "foo"]) output1 @@ -206,11 +206,11 @@ output5 &parser/parse] (return (&/|++ output1 (&/|++ output2 (&/|++ output3 (&/|++ output4 output5)))))) (make-state (str "#" input1 "\n" "#" input2 "\n" "#" input3 "\n" "#" input4 "\n" "#" input5 " "))) - (&/$Right state (&/$Cons [_ (&/$TagS output1)] - (&/$Cons [_ (&/$TagS output2)] - (&/$Cons [_ (&/$TagS output3)] - (&/$Cons [_ (&/$TagS output4)] - (&/$Cons [_ (&/$TagS output5)] + (&/$Right state (&/$Cons [_ (&/$Tag output1)] + (&/$Cons [_ (&/$Tag output2)] + (&/$Cons [_ (&/$Tag output3)] + (&/$Cons [_ (&/$Tag output4)] + (&/$Cons [_ (&/$Tag output5)] (&/$Nil))))))) (are [input output] (&/ident= input output) (&/T ["" "foo"]) output1 @@ -228,10 +228,10 @@ (let [input1 "yolo 123 \"lol\" #meme"] (|case (&/run-state &parser/parse (make-state (str <open> input1 <close>))) - (&/$Right state (&/$Cons [_ (<tag> (&/$Cons [_ (&/$SymbolS symv)] - (&/$Cons [_ (&/$IntS intv)] - (&/$Cons [_ (&/$TextS textv)] - (&/$Cons [_ (&/$TagS tagv)] + (&/$Right state (&/$Cons [_ (<tag> (&/$Cons [_ (&/$Symbol symv)] + (&/$Cons [_ (&/$Int intv)] + (&/$Cons [_ (&/$Text textv)] + (&/$Cons [_ (&/$Tag tagv)] (&/$Nil))))))] (&/$Nil))) (do (is (&/ident= (&/T ["" "yolo"]) symv)) @@ -243,17 +243,17 @@ (is false "Couldn't read.") ))) - parse-form &/$FormS "(" ")" - parse-tuple &/$TupleS "[" "]" + parse-form &/$Form "(" ")" + parse-tuple &/$Tuple "[" "]" ) (deftest parse-record (let [input1 "yolo 123 \"lol\" #meme"] (|case (&/run-state &parser/parse (make-state (str "{" input1 "}"))) - (&/$Right state (&/$Cons [_ (&/$RecordS (&/$Cons [[_ (&/$SymbolS symv)] [_ (&/$IntS intv)]] - (&/$Cons [[_ (&/$TextS textv)] [_ (&/$TagS tagv)]] - (&/$Nil))))] + (&/$Right state (&/$Cons [_ (&/$Record (&/$Cons [[_ (&/$Symbol symv)] [_ (&/$Int intv)]] + (&/$Cons [[_ (&/$Text textv)] [_ (&/$Tag tagv)]] + (&/$Nil))))] (&/$Nil))) (do (is (&/ident= (&/T ["" "yolo"]) symv)) (is (= 123 intv)) diff --git a/new-luxc/source/luxc/analyser.lux b/new-luxc/source/luxc/analyser.lux index 2a77d8bb5..7de7bab57 100644 --- a/new-luxc/source/luxc/analyser.lux +++ b/new-luxc/source/luxc/analyser.lux @@ -26,38 +26,38 @@ (^template [<tag> <analyser>] [cursor (<tag> value)] (<analyser> cursor value)) - ([#;BoolS &&lux;analyse-bool] - [#;NatS &&lux;analyse-nat] - [#;IntS &&lux;analyse-int] - [#;DegS &&lux;analyse-deg] - [#;RealS &&lux;analyse-real] - [#;CharS &&lux;analyse-char] - [#;TextS &&lux;analyse-text]) + ([#;Bool &&lux;analyse-bool] + [#;Nat &&lux;analyse-nat] + [#;Int &&lux;analyse-int] + [#;Deg &&lux;analyse-deg] + [#;Real &&lux;analyse-real] + [#;Char &&lux;analyse-char] + [#;Text &&lux;analyse-text]) - (^ [cursor (#;TupleS (list))]) + (^ [cursor (#;Tuple (list))]) (&&lux;analyse-unit cursor) - (^ [cursor (#;TupleS (list singleton))]) + (^ [cursor (#;Tuple (list singleton))]) (analyse eval singleton) - (^ [cursor (#;TupleS elems)]) + (^ [cursor (#;Tuple elems)]) (&&lux;analyse-tuple (analyse eval) cursor elems) - [cursor (#;SymbolS reference)] + [cursor (#;Symbol reference)] (&&lux;analyse-reference cursor reference) - (^ [cursor (#;FormS (list [_ (#;SymbolS ["" "_lux_check"])] - type - value))]) + (^ [cursor (#;Form (list [_ (#;Symbol ["" "_lux_check"])] + type + value))]) (&&lux;analyse-check analyse eval cursor type value) - (^ [cursor (#;FormS (list [_ (#;SymbolS ["" "_lux_coerce"])] - type - value))]) + (^ [cursor (#;Form (list [_ (#;Symbol ["" "_lux_coerce"])] + type + value))]) (&&lux;analyse-coerce analyse eval cursor type value) - (^ [cursor (#;FormS (list [_ (#;NatS tag)] - value))]) + (^ [cursor (#;Form (list [_ (#;Nat tag)] + value))]) (&&lux;analyse-variant (analyse eval) cursor tag value) _ diff --git a/new-luxc/source/luxc/compiler.lux b/new-luxc/source/luxc/compiler.lux index 4ac865786..12966ba00 100644 --- a/new-luxc/source/luxc/compiler.lux +++ b/new-luxc/source/luxc/compiler.lux @@ -17,15 +17,15 @@ (def: (compile ast) (-> AST (Lux Unit)) (case ast - (^ [_ (#;FormS (list [_ (#;SymbolS ["" "_lux_def"])] - [_ (#;SymbolS ["" def-name])] - def-value - def-meta))]) + (^ [_ (#;Form (list [_ (#;Symbol ["" "_lux_def"])] + [_ (#;Symbol ["" def-name])] + def-value + def-meta))]) (&&statement;compile-def def-name def-value def-meta) - (^ [_ (#;FormS (list [_ (#;SymbolS ["" "_lux_program"])] - [_ (#;SymbolS ["" prog-args])] - prog-body))]) + (^ [_ (#;Form (list [_ (#;Symbol ["" "_lux_program"])] + [_ (#;Symbol ["" prog-args])] + prog-body))]) (&&statement;compile-program prog-args prog-body) _ diff --git a/new-luxc/source/luxc/parser.lux b/new-luxc/source/luxc/parser.lux index 6565ba65f..0115d1924 100644 --- a/new-luxc/source/luxc/parser.lux +++ b/new-luxc/source/luxc/parser.lux @@ -219,20 +219,20 @@ (wrap [(update@ #;column (n.+ (text;size chunk)) where) [where (<tag> value)]]))))] - [parse-bool #;BoolS + [parse-bool #;Bool (l;either (l;text "true") (l;text "false")) bool;Codec<Text,Bool>] - [parse-nat #;NatS + [parse-nat #;Nat (l;seq' (l;text "+") (l;many' l;digit)) number;Codec<Text,Nat>] - [parse-int #;IntS + [parse-int #;Int (l;seq' (l;default "" (l;text "-")) (l;many' l;digit)) number;Codec<Text,Int>] - [parse-real #;RealS + [parse-real #;Real ($_ l;seq' (l;default "" (l;text "-")) (l;many' l;digit) @@ -240,7 +240,7 @@ (l;many' l;digit)) number;Codec<Text,Real>] - [parse-deg #;DegS + [parse-deg #;Deg (l;seq' (l;text ".") (l;many' l;digit)) number;Codec<Text,Deg>] @@ -254,7 +254,7 @@ [[chunk value] (l;enclosed ["#\"" "\""] raw-char^)] (wrap [(update@ #;column (|>. ($_ n.+ +3 (text;size chunk))) where) - [where (#;CharS value)]]))) + [where (#;Char value)]]))) ## This parser looks so complex because text in Lux can be multi-line ## and there are rules regarding how this is handled. @@ -342,7 +342,7 @@ (set@ #;column +0)) true)))))] (wrap [where' - [where (#;TextS text-read)]]))) + [where (#;Text text-read)]]))) ## Form and tuple syntax is mostly the same, differing only in the ## delimiters involved. @@ -374,8 +374,8 @@ (wrap [where' [where (<tag> elems)]])))] - [parse-form #;FormS "(" ")"] - [parse-tuple #;TupleS "[" "]"] + [parse-form #;Form "(" ")"] + [parse-tuple #;Tuple "[" "]"] ) ## Records are almost (syntactically) the same as forms and tuples, @@ -407,7 +407,7 @@ (wrap [(update@ #;column n.inc where') (V;to-list elems)]))))] (wrap [where' - [where (#;RecordS elems)]]))) + [where (#;Record elems)]]))) ## The parts of an identifier are separated by a single mark. ## E.g. module;name. @@ -504,8 +504,8 @@ (wrap [(update@ #;column (|>. ($_ n.+ <extra> length)) where) [where (<tag> value)]])))] - [parse-symbol #;SymbolS ident^ +0] - [parse-tag #;TagS (l;after (l;char #"#") ident^) +1] + [parse-symbol #;Symbol ident^ +0] + [parse-tag #;Tag (l;after (l;char #"#") ident^) +1] ) (def: (parse-ast where) diff --git a/new-luxc/test/test/luxc/parser.lux b/new-luxc/test/test/luxc/parser.lux index 9259c1101..9f8584b2c 100644 --- a/new-luxc/test/test/luxc/parser.lux +++ b/new-luxc/test/test/luxc/parser.lux @@ -42,19 +42,19 @@ (R;Random AST) (let [numeric^ (: (R;Random AST) ($_ R;either - (|> R;bool (R/map (|>. #;BoolS [default-cursor]))) - (|> R;nat (R/map (|>. #;NatS [default-cursor]))) - (|> R;int (R/map (|>. #;IntS [default-cursor]))) - (|> R;deg (R/map (|>. #;DegS [default-cursor]))) - (|> R;real (R/map (|>. #;RealS [default-cursor]))))) + (|> R;bool (R/map (|>. #;Bool [default-cursor]))) + (|> R;nat (R/map (|>. #;Nat [default-cursor]))) + (|> R;int (R/map (|>. #;Int [default-cursor]))) + (|> R;deg (R/map (|>. #;Deg [default-cursor]))) + (|> R;real (R/map (|>. #;Real [default-cursor]))))) textual^ (: (R;Random AST) ($_ R;either - (|> R;char (R/map (|>. #;CharS [default-cursor]))) + (|> R;char (R/map (|>. #;Char [default-cursor]))) (do R;Monad<Random> [size (|> R;nat (R/map (n.% +20)))] - (|> (R;text size) (R/map (|>. #;TextS [default-cursor])))) - (|> ident^ (R/map (|>. #;SymbolS [default-cursor]))) - (|> ident^ (R/map (|>. #;TagS [default-cursor]))))) + (|> (R;text size) (R/map (|>. #;Text [default-cursor])))) + (|> ident^ (R/map (|>. #;Symbol [default-cursor]))) + (|> ident^ (R/map (|>. #;Tag [default-cursor]))))) simple^ (: (R;Random AST) ($_ R;either numeric^ @@ -66,12 +66,12 @@ (R;list size ast^)) composite^ (: (R;Random AST) ($_ R;either - (|> multi^ (R/map (|>. #;FormS [default-cursor]))) - (|> multi^ (R/map (|>. #;TupleS [default-cursor]))) + (|> multi^ (R/map (|>. #;Form [default-cursor]))) + (|> multi^ (R/map (|>. #;Tuple [default-cursor]))) (do R;Monad<Random> [size (|> R;nat (R/map (n.% +3)))] (|> (R;list size (R;seq ast^ ast^)) - (R/map (|>. #;RecordS [default-cursor]))))))] + (R/map (|>. #;Record [default-cursor]))))))] (R;either simple^ composite^)))))) diff --git a/stdlib/source/lux.lux b/stdlib/source/lux.lux index cd547a517..b49d831b0 100644 --- a/stdlib/source/lux.lux +++ b/stdlib/source/lux.lux @@ -388,18 +388,18 @@ default-def-meta-exported)) ## (type: (AST' w) -## (#BoolS Bool) -## (#NatS Nat) -## (#IntS Int) -## (#DegS Deg) -## (#RealS Real) -## (#CharS Char) -## (#TextS Text) -## (#SymbolS Text Text) -## (#TagS Text Text) -## (#FormS (List (w (AST' w)))) -## (#TupleS (List (w (AST' w)))) -## (#RecordS (List [(w (AST' w)) (w (AST' w))]))) +## (#Bool Bool) +## (#Nat Nat) +## (#Int Int) +## (#Deg Deg) +## (#Real Real) +## (#Char Char) +## (#Text Text) +## (#Symbol Text Text) +## (#Tag Text Text) +## (#Form (List (w (AST' w)))) +## (#Tuple (List (w (AST' w)))) +## (#Record (List [(w (AST' w)) (w (AST' w))]))) (_lux_def AST' (#NamedT ["lux" "AST'"] (_lux_case (#AppT (#BoundT +1) @@ -409,44 +409,44 @@ (_lux_case (#AppT [List AST]) AST-List (#UnivQ #Nil - (#SumT ## "lux;BoolS" + (#SumT ## "lux;Bool" Bool - (#SumT ## "lux;NatS" + (#SumT ## "lux;Nat" Nat - (#SumT ## "lux;IntS" + (#SumT ## "lux;Int" Int - (#SumT ## "lux;DegS" + (#SumT ## "lux;Deg" Deg - (#SumT ## "lux;RealS" + (#SumT ## "lux;Real" Real - (#SumT ## "lux;CharS" + (#SumT ## "lux;Char" Char - (#SumT ## "lux;TextS" + (#SumT ## "lux;Text" Text - (#SumT ## "lux;SymbolS" + (#SumT ## "lux;Symbol" Ident - (#SumT ## "lux;TagS" + (#SumT ## "lux;Tag" Ident - (#SumT ## "lux;FormS" + (#SumT ## "lux;Form" AST-List - (#SumT ## "lux;TupleS" + (#SumT ## "lux;Tuple" AST-List - ## "lux;RecordS" + ## "lux;Record" (#AppT List (#ProdT AST AST)) ))))))))))) )))) - (#Cons [["lux" "tags"] (#ListA (#Cons (#TextA "BoolS") - (#Cons (#TextA "NatS") - (#Cons (#TextA "IntS") - (#Cons (#TextA "DegS") - (#Cons (#TextA "RealS") - (#Cons (#TextA "CharS") - (#Cons (#TextA "TextS") - (#Cons (#TextA "SymbolS") - (#Cons (#TextA "TagS") - (#Cons (#TextA "FormS") - (#Cons (#TextA "TupleS") - (#Cons (#TextA "RecordS") + (#Cons [["lux" "tags"] (#ListA (#Cons (#TextA "Bool") + (#Cons (#TextA "Nat") + (#Cons (#TextA "Int") + (#Cons (#TextA "Deg") + (#Cons (#TextA "Real") + (#Cons (#TextA "Char") + (#Cons (#TextA "Text") + (#Cons (#TextA "Symbol") + (#Cons (#TextA "Tag") + (#Cons (#TextA "Form") + (#Cons (#TextA "Tuple") + (#Cons (#TextA "Record") #Nil)))))))))))))] (#Cons [["lux" "type-args"] (#ListA (#Cons (#TextA "w") #;Nil))] default-def-meta-exported))) @@ -730,62 +730,62 @@ (_lux_def bool$ (_lux_: (#FunctionT Bool AST) - (_lux_function _ value (_meta (#BoolS value)))) + (_lux_function _ value (_meta (#Bool value)))) #Nil) (_lux_def nat$ (_lux_: (#FunctionT Nat AST) - (_lux_function _ value (_meta (#NatS value)))) + (_lux_function _ value (_meta (#Nat value)))) #Nil) (_lux_def int$ (_lux_: (#FunctionT Int AST) - (_lux_function _ value (_meta (#IntS value)))) + (_lux_function _ value (_meta (#Int value)))) #Nil) (_lux_def deg$ (_lux_: (#FunctionT Deg AST) - (_lux_function _ value (_meta (#DegS value)))) + (_lux_function _ value (_meta (#Deg value)))) #Nil) (_lux_def real$ (_lux_: (#FunctionT Real AST) - (_lux_function _ value (_meta (#RealS value)))) + (_lux_function _ value (_meta (#Real value)))) #Nil) (_lux_def char$ (_lux_: (#FunctionT Char AST) - (_lux_function _ value (_meta (#CharS value)))) + (_lux_function _ value (_meta (#Char value)))) #Nil) (_lux_def text$ (_lux_: (#FunctionT Text AST) - (_lux_function _ text (_meta (#TextS text)))) + (_lux_function _ text (_meta (#Text text)))) #Nil) (_lux_def symbol$ (_lux_: (#FunctionT Ident AST) - (_lux_function _ ident (_meta (#SymbolS ident)))) + (_lux_function _ ident (_meta (#Symbol ident)))) #Nil) (_lux_def tag$ (_lux_: (#FunctionT Ident AST) - (_lux_function _ ident (_meta (#TagS ident)))) + (_lux_function _ ident (_meta (#Tag ident)))) #Nil) (_lux_def form$ (_lux_: (#FunctionT (#AppT List AST) AST) - (_lux_function _ tokens (_meta (#FormS tokens)))) + (_lux_function _ tokens (_meta (#Form tokens)))) #Nil) (_lux_def tuple$ (_lux_: (#FunctionT (#AppT List AST) AST) - (_lux_function _ tokens (_meta (#TupleS tokens)))) + (_lux_function _ tokens (_meta (#Tuple tokens)))) #Nil) (_lux_def record$ (_lux_: (#FunctionT (#AppT List (#ProdT AST AST)) AST) - (_lux_function _ tokens (_meta (#RecordS tokens)))) + (_lux_function _ tokens (_meta (#Record tokens)))) #Nil) (_lux_def default-macro-meta @@ -811,34 +811,34 @@ (_lux_: Macro (_lux_function _ tokens (_lux_case tokens - (#Cons [_ (#TupleS (#Cons arg args'))] (#Cons body #Nil)) - (return (#Cons (_meta (#FormS (#Cons (_meta (#SymbolS "" "_lux_function")) - (#Cons (_meta (#SymbolS "" "")) - (#Cons arg - (#Cons (_lux_case args' - #Nil - body - - _ - (_meta (#FormS (#Cons (_meta (#SymbolS "lux" "function''")) - (#Cons (_meta (#TupleS args')) - (#Cons body #Nil)))))) - #Nil)))))) + (#Cons [_ (#Tuple (#Cons arg args'))] (#Cons body #Nil)) + (return (#Cons (_meta (#Form (#Cons (_meta (#Symbol "" "_lux_function")) + (#Cons (_meta (#Symbol "" "")) + (#Cons arg + (#Cons (_lux_case args' + #Nil + body + + _ + (_meta (#Form (#Cons (_meta (#Symbol "lux" "function''")) + (#Cons (_meta (#Tuple args')) + (#Cons body #Nil)))))) + #Nil)))))) #Nil)) - (#Cons [_ (#SymbolS "" self)] (#Cons [_ (#TupleS (#Cons arg args'))] (#Cons body #Nil))) - (return (#Cons (_meta (#FormS (#Cons (_meta (#SymbolS "" "_lux_function")) - (#Cons (_meta (#SymbolS "" self)) - (#Cons arg - (#Cons (_lux_case args' - #Nil - body - - _ - (_meta (#FormS (#Cons (_meta (#SymbolS "lux" "function''")) - (#Cons (_meta (#TupleS args')) - (#Cons body #Nil)))))) - #Nil)))))) + (#Cons [_ (#Symbol "" self)] (#Cons [_ (#Tuple (#Cons arg args'))] (#Cons body #Nil))) + (return (#Cons (_meta (#Form (#Cons (_meta (#Symbol "" "_lux_function")) + (#Cons (_meta (#Symbol "" self)) + (#Cons arg + (#Cons (_lux_case args' + #Nil + body + + _ + (_meta (#Form (#Cons (_meta (#Symbol "lux" "function''")) + (#Cons (_meta (#Tuple args')) + (#Cons body #Nil)))))) + #Nil)))))) #Nil)) _ @@ -900,53 +900,53 @@ (_lux_: Macro (function'' [tokens] (_lux_case tokens - (#Cons [[_ (#TagS ["" "export"])] - (#Cons [[_ (#FormS (#Cons [name args]))] + (#Cons [[_ (#Tag ["" "export"])] + (#Cons [[_ (#Form (#Cons [name args]))] (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) - (return (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["" "_lux_def"])) - (#Cons [name - (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["" "_lux_:"])) - (#Cons [type - (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["lux" "function''"])) - (#Cons [name - (#Cons [(_meta (#TupleS args)) - (#Cons [body #Nil])])])]))) - #Nil])])]))) - (#Cons (with-export-meta meta) #Nil)])])]))) + (return (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["" "_lux_def"])) + (#Cons [name + (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["" "_lux_:"])) + (#Cons [type + (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["lux" "function''"])) + (#Cons [name + (#Cons [(_meta (#Tuple args)) + (#Cons [body #Nil])])])]))) + #Nil])])]))) + (#Cons (with-export-meta meta) #Nil)])])]))) #Nil])) - (#Cons [[_ (#TagS ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) - (return (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["" "_lux_def"])) - (#Cons [name - (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["" "_lux_:"])) - (#Cons [type - (#Cons [body - #Nil])])]))) - (#Cons (with-export-meta meta) #Nil)])])]))) + (#Cons [[_ (#Tag ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) + (return (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["" "_lux_def"])) + (#Cons [name + (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["" "_lux_:"])) + (#Cons [type + (#Cons [body + #Nil])])]))) + (#Cons (with-export-meta meta) #Nil)])])]))) #Nil])) - (#Cons [[_ (#FormS (#Cons [name args]))] + (#Cons [[_ (#Form (#Cons [name args]))] (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) - (return (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["" "_lux_def"])) - (#Cons [name - (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["" "_lux_:"])) - (#Cons [type - (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["lux" "function''"])) - (#Cons [name - (#Cons [(_meta (#TupleS args)) - (#Cons [body #Nil])])])]))) - #Nil])])]))) - (#Cons meta #Nil)])])]))) + (return (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["" "_lux_def"])) + (#Cons [name + (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["" "_lux_:"])) + (#Cons [type + (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["lux" "function''"])) + (#Cons [name + (#Cons [(_meta (#Tuple args)) + (#Cons [body #Nil])])])]))) + #Nil])])]))) + (#Cons meta #Nil)])])]))) #Nil])) (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) - (return (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["" "_lux_def"])) - (#Cons [name - (#Cons [(_meta (#FormS (#Cons [(_meta (#SymbolS ["" "_lux_:"])) - (#Cons [type - (#Cons [body - #Nil])])]))) - (#Cons meta #Nil)])])]))) + (return (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["" "_lux_def"])) + (#Cons [name + (#Cons [(_meta (#Form (#Cons [(_meta (#Symbol ["" "_lux_:"])) + (#Cons [type + (#Cons [body + #Nil])])]))) + (#Cons meta #Nil)])])]))) #Nil])) _ @@ -958,7 +958,7 @@ default-macro-meta Macro (_lux_case tokens - (#Cons [_ (#FormS (#Cons name args))] (#Cons body #Nil)) + (#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil)) (return (#Cons (form$ (#Cons (symbol$ ["lux" "def:''"]) (#Cons (form$ (#Cons name args)) (#Cons (with-macro-meta (tag$ ["lux" "Nil"])) @@ -968,7 +968,7 @@ ))) #Nil)) - (#Cons [_ (#TagS ["" "export"])] (#Cons [_ (#FormS (#Cons name args))] (#Cons body #Nil))) + (#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil))) (return (#Cons (form$ (#Cons (symbol$ ["lux" "def:''"]) (#Cons (tag$ ["" "export"]) (#Cons (form$ (#Cons name args)) @@ -979,7 +979,7 @@ )))) #Nil)) - (#Cons [_ (#TagS ["" "export"])] (#Cons [_ (#FormS (#Cons name args))] (#Cons meta-data (#Cons body #Nil)))) + (#Cons [_ (#Tag ["" "export"])] (#Cons [_ (#Form (#Cons name args))] (#Cons meta-data (#Cons body #Nil)))) (return (#Cons (form$ (#Cons (symbol$ ["lux" "def:''"]) (#Cons (tag$ ["" "export"]) (#Cons (form$ (#Cons name args)) @@ -1068,7 +1068,7 @@ #Nil (#FunctionT RepEnv (#FunctionT AST AST)) (_lux_case syntax - [_ (#SymbolS "" name)] + [_ (#Symbol "" name)] (_lux_case (get-rep name reps) (#Some replacement) replacement @@ -1076,19 +1076,19 @@ #None syntax) - [meta (#FormS parts)] - [meta (#FormS (map (replace-syntax reps) parts))] + [meta (#Form parts)] + [meta (#Form (map (replace-syntax reps) parts))] - [meta (#TupleS members)] - [meta (#TupleS (map (replace-syntax reps) members))] + [meta (#Tuple members)] + [meta (#Tuple (map (replace-syntax reps) members))] - [meta (#RecordS slots)] - [meta (#RecordS (map (_lux_: (#FunctionT (#ProdT AST AST) (#ProdT AST AST)) - (function'' [slot] - (_lux_case slot - [k v] - [(replace-syntax reps k) (replace-syntax reps v)]))) - slots))] + [meta (#Record slots)] + [meta (#Record (map (_lux_: (#FunctionT (#ProdT AST AST) (#ProdT AST AST)) + (function'' [slot] + (_lux_case slot + [k v] + [(replace-syntax reps k) (replace-syntax reps v)]))) + slots))] _ syntax) @@ -1098,20 +1098,20 @@ #Nil (#FunctionT AST AST) (_lux_case ast - [_ (#TupleS members)] + [_ (#Tuple members)] (tuple$ (map update-bounds members)) - [_ (#RecordS pairs)] + [_ (#Record pairs)] (record$ (map (_lux_: (#FunctionT (#ProdT AST AST) (#ProdT AST AST)) (function'' [pair] (let'' [name val] pair [name (update-bounds val)]))) pairs)) - [_ (#FormS (#Cons [_ (#TagS "lux" "BoundT")] (#Cons [_ (#NatS idx)] #Nil)))] + [_ (#Form (#Cons [_ (#Tag "lux" "BoundT")] (#Cons [_ (#Nat idx)] #Nil)))] (form$ (#Cons (tag$ ["lux" "BoundT"]) (#Cons (nat$ (_lux_proc ["nat" "+"] [+2 idx])) #Nil))) - [_ (#FormS members)] + [_ (#Form members)] (form$ (map update-bounds members)) _ @@ -1128,7 +1128,7 @@ #Nil (next #Nil) - (#Cons [_ (#SymbolS "" arg-name)] args') + (#Cons [_ (#Symbol "" arg-name)] args') (parse-quantified-args args' (function'' [names] (next (#Cons arg-name names)))) _ @@ -1173,13 +1173,13 @@ [a (List a)]))")] #;Nil) (let'' [self-name tokens] (_lux_case tokens - (#Cons [_ (#SymbolS "" self-name)] tokens) + (#Cons [_ (#Symbol "" self-name)] tokens) [self-name tokens] _ ["" tokens]) (_lux_case tokens - (#Cons [_ (#TupleS args)] (#Cons body #Nil)) + (#Cons [_ (#Tuple args)] (#Cons body #Nil)) (parse-quantified-args args (function'' [names] (let'' body' (fold (_lux_: (#FunctionT Text (#FunctionT AST AST)) @@ -1224,13 +1224,13 @@ (List (Self a))])")] #;Nil) (let'' [self-name tokens] (_lux_case tokens - (#Cons [_ (#SymbolS "" self-name)] tokens) + (#Cons [_ (#Symbol "" self-name)] tokens) [self-name tokens] _ ["" tokens]) (_lux_case tokens - (#Cons [_ (#TupleS args)] (#Cons body #Nil)) + (#Cons [_ (#Tuple args)] (#Cons body #Nil)) (parse-quantified-args args (function'' [names] (let'' body' (fold (_lux_: (#FunctionT Text (#FunctionT AST AST)) @@ -1350,13 +1350,13 @@ (macro:' (function' tokens) (let'' [name tokens'] (_lux_case tokens - (#Cons [[_ (#SymbolS ["" name])] tokens']) + (#Cons [[_ (#Symbol ["" name])] tokens']) [name tokens'] _ ["" tokens]) (_lux_case tokens' - (#Cons [[_ (#TupleS args)] (#Cons [body #Nil])]) + (#Cons [[_ (#Tuple args)] (#Cons [body #Nil])]) (_lux_case args #Nil (fail "function' requires a non-empty arguments tuple.") @@ -1378,8 +1378,8 @@ (macro:' (def:''' tokens) (_lux_case tokens - (#Cons [[_ (#TagS ["" "export"])] - (#Cons [[_ (#FormS (#Cons [name args]))] + (#Cons [[_ (#Tag ["" "export"])] + (#Cons [[_ (#Form (#Cons [name args]))] (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) (return (list (form$ (list (symbol$ ["" "_lux_def"]) name @@ -1391,7 +1391,7 @@ body)))) (with-export-meta meta))))) - (#Cons [[_ (#TagS ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) + (#Cons [[_ (#Tag ["" "export"])] (#Cons [name (#Cons [meta (#Cons [type (#Cons [body #Nil])])])])]) (return (list (form$ (list (symbol$ ["" "_lux_def"]) name (form$ (list (symbol$ ["" "_lux_:"]) @@ -1399,7 +1399,7 @@ body)) (with-export-meta meta))))) - (#Cons [[_ (#FormS (#Cons [name args]))] + (#Cons [[_ (#Form (#Cons [name args]))] (#Cons [meta (#Cons [type (#Cons [body #Nil])])])]) (return (list (form$ (list (symbol$ ["" "_lux_def"]) name @@ -1433,7 +1433,7 @@ (macro:' (let' tokens) (_lux_case tokens - (#Cons [[_ (#TupleS bindings)] (#Cons [body #Nil])]) + (#Cons [[_ (#Tuple bindings)] (#Cons [body #Nil])]) (return (list (fold (_lux_: (-> (& AST AST) AST AST) (function' [binding body] @@ -1463,7 +1463,7 @@ #Nil (-> AST Bool) (_lux_case token - [_ (#FormS (#Cons [[_ (#SymbolS ["" "~@"])] (#Cons [_ #Nil])]))] + [_ (#Form (#Cons [[_ (#Symbol ["" "~@"])] (#Cons [_ #Nil])]))] true _ @@ -1480,10 +1480,10 @@ (-> ($' List AST) AST) (_lux_case tokens #Nil - (_meta (#TagS ["lux" "Nil"])) + (_meta (#Tag ["lux" "Nil"])) (#Cons [token tokens']) - (_meta (#FormS (list (_meta (#TagS ["lux" "Cons"])) token (untemplate-list tokens')))))) + (_meta (#Form (list (_meta (#Tag ["lux" "Cons"])) token (untemplate-list tokens')))))) (def:''' (List/append xs ys) #Nil @@ -1596,14 +1596,14 @@ (macro:' (do tokens) (_lux_case tokens - (#Cons monad (#Cons [_ (#TupleS bindings)] (#Cons body #Nil))) + (#Cons monad (#Cons [_ (#Tuple bindings)] (#Cons body #Nil))) (let' [g!wrap (symbol$ ["" "wrap"]) g!bind (symbol$ ["" " bind "]) body' (fold (_lux_: (-> (& AST AST) AST AST) (function' [binding body'] (let' [[var value] binding] (_lux_case var - [_ (#TagS "" "let")] + [_ (#Tag "" "let")] (form$ (list (symbol$ ["lux" "let'"]) value body')) _ @@ -1759,7 +1759,7 @@ (_lux_: (-> AST ($' Lux AST)) (function' [elem] (_lux_case elem - [_ (#FormS (#Cons [[_ (#SymbolS ["" "~@"])] (#Cons [spliced #Nil])]))] + [_ (#Form (#Cons [[_ (#Symbol ["" "~@"])] (#Cons [spliced #Nil])]))] (wrap spliced) _ @@ -1787,40 +1787,40 @@ #Nil (-> Bool Text AST ($' Lux AST)) (_lux_case [replace? token] - [_ [_ (#BoolS value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "BoolS"]) (bool$ value))))) + [_ [_ (#Bool value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Bool"]) (bool$ value))))) - [_ [_ (#NatS value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "NatS"]) (nat$ value))))) + [_ [_ (#Nat value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Nat"]) (nat$ value))))) - [_ [_ (#IntS value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "IntS"]) (int$ value))))) + [_ [_ (#Int value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Int"]) (int$ value))))) - [_ [_ (#DegS value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "DegS"]) (deg$ value))))) + [_ [_ (#Deg value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Deg"]) (deg$ value))))) - [_ [_ (#RealS value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "RealS"]) (real$ value))))) + [_ [_ (#Real value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Real"]) (real$ value))))) - [_ [_ (#CharS value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "CharS"]) (char$ value))))) + [_ [_ (#Char value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Char"]) (char$ value))))) - [_ [_ (#TextS value)]] - (return (wrap-meta (form$ (list (tag$ ["lux" "TextS"]) (text$ value))))) + [_ [_ (#Text value)]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Text"]) (text$ value))))) - [false [_ (#TagS [module name])]] - (return (wrap-meta (form$ (list (tag$ ["lux" "TagS"]) (tuple$ (list (text$ module) (text$ name))))))) + [false [_ (#Tag [module name])]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Tag"]) (tuple$ (list (text$ module) (text$ name))))))) - [true [_ (#TagS [module name])]] + [true [_ (#Tag [module name])]] (let' [module' (_lux_case module "" subst _ module)] - (return (wrap-meta (form$ (list (tag$ ["lux" "TagS"]) (tuple$ (list (text$ module') (text$ name)))))))) + (return (wrap-meta (form$ (list (tag$ ["lux" "Tag"]) (tuple$ (list (text$ module') (text$ name)))))))) - [true [_ (#SymbolS [module name])]] + [true [_ (#Symbol [module name])]] (do Monad<Lux> [real-name (_lux_case module "" @@ -1831,27 +1831,27 @@ _ (wrap [module name])) #let [[module name] real-name]] - (return (wrap-meta (form$ (list (tag$ ["lux" "SymbolS"]) (tuple$ (list (text$ module) (text$ name)))))))) + (return (wrap-meta (form$ (list (tag$ ["lux" "Symbol"]) (tuple$ (list (text$ module) (text$ name)))))))) - [false [_ (#SymbolS [module name])]] - (return (wrap-meta (form$ (list (tag$ ["lux" "SymbolS"]) (tuple$ (list (text$ module) (text$ name))))))) + [false [_ (#Symbol [module name])]] + (return (wrap-meta (form$ (list (tag$ ["lux" "Symbol"]) (tuple$ (list (text$ module) (text$ name))))))) - [_ [_ (#TupleS elems)]] - (splice replace? (untemplate replace? subst) (tag$ ["lux" "TupleS"]) elems) + [_ [_ (#Tuple elems)]] + (splice replace? (untemplate replace? subst) (tag$ ["lux" "Tuple"]) elems) - [true [_ (#FormS (#Cons [[_ (#SymbolS ["" "~"])] (#Cons [unquoted #Nil])]))]] + [true [_ (#Form (#Cons [[_ (#Symbol ["" "~"])] (#Cons [unquoted #Nil])]))]] (return unquoted) - [true [_ (#FormS (#Cons [[_ (#SymbolS ["" "~'"])] (#Cons [keep-quoted #Nil])]))]] + [true [_ (#Form (#Cons [[_ (#Symbol ["" "~'"])] (#Cons [keep-quoted #Nil])]))]] (untemplate false subst keep-quoted) - [_ [meta (#FormS elems)]] + [_ [meta (#Form elems)]] (do Monad<Lux> - [output (splice replace? (untemplate replace? subst) (tag$ ["lux" "FormS"]) elems) + [output (splice replace? (untemplate replace? subst) (tag$ ["lux" "Form"]) elems) #let [[_ form'] output]] (return [meta form'])) - [_ [_ (#RecordS fields)]] + [_ [_ (#Record fields)]] (do Monad<Lux> [=fields (mapM Monad<Lux> (_lux_: (-> (& AST AST) ($' Lux AST)) @@ -1862,7 +1862,7 @@ =v (untemplate replace? subst v)] (wrap (tuple$ (list =k =v))))))) fields)] - (wrap (wrap-meta (form$ (list (tag$ ["lux" "RecordS"]) (untemplate-list =fields)))))) + (wrap (wrap-meta (form$ (list (tag$ ["lux" "Record"]) (untemplate-list =fields)))))) )) (macro:' #export (host tokens) @@ -1871,10 +1871,10 @@ (host java.util.List [java.lang.Long])")]) (_lux_case tokens - (#Cons [_ (#SymbolS "" class-name)] #Nil) + (#Cons [_ (#Symbol "" class-name)] #Nil) (return (list (form$ (list (tag$ ["lux" "HostT"]) (text$ class-name) (tag$ ["lux" "Nil"]))))) - (#Cons [_ (#SymbolS "" class-name)] (#Cons [_ (#TupleS params)] #Nil)) + (#Cons [_ (#Symbol "" class-name)] (#Cons [_ (#Tuple params)] #Nil)) (return (list (form$ (list (tag$ ["lux" "HostT"]) (text$ class-name) (untemplate-list params))))) _ @@ -1951,10 +1951,10 @@ (return (list (fold (_lux_: (-> AST AST AST) (function' [app acc] (_lux_case app - [_ (#TupleS parts)] + [_ (#Tuple parts)] (tuple$ (List/append parts (list acc))) - [_ (#FormS parts)] + [_ (#Form parts)] (form$ (List/append parts (list acc))) _ @@ -1978,10 +1978,10 @@ (return (list (fold (_lux_: (-> AST AST AST) (function' [app acc] (_lux_case app - [_ (#TupleS parts)] + [_ (#Tuple parts)] (tuple$ (List/append parts (list acc))) - [_ (#FormS parts)] + [_ (#Form parts)] (form$ (List/append parts (list acc))) _ @@ -2002,7 +2002,7 @@ #Nil (-> AST ($' Maybe Ident)) (_lux_case x - [_ (#SymbolS sname)] + [_ (#Symbol sname)] (#Some sname) _ @@ -2012,7 +2012,7 @@ #Nil (-> AST ($' Maybe Ident)) (_lux_case x - [_ (#TagS sname)] + [_ (#Tag sname)] (#Some sname) _ @@ -2022,7 +2022,7 @@ #Nil (-> AST ($' Maybe Text)) (_lux_case x - [_ (#SymbolS "" sname)] + [_ (#Symbol "" sname)] (#Some sname) _ @@ -2032,7 +2032,7 @@ #Nil (-> AST ($' Maybe ($' List AST))) (_lux_case tuple - [_ (#TupleS members)] + [_ (#Tuple members)] (#Some members) _ @@ -2042,7 +2042,7 @@ #Nil (-> RepEnv AST AST) (_lux_case template - [_ (#SymbolS "" sname)] + [_ (#Symbol "" sname)] (_lux_case (get-rep sname env) (#Some subst) subst @@ -2050,18 +2050,18 @@ _ template) - [meta (#TupleS elems)] - [meta (#TupleS (map (apply-template env) elems))] + [meta (#Tuple elems)] + [meta (#Tuple (map (apply-template env) elems))] - [meta (#FormS elems)] - [meta (#FormS (map (apply-template env) elems))] + [meta (#Form elems)] + [meta (#Form (map (apply-template env) elems))] - [meta (#RecordS members)] - [meta (#RecordS (map (_lux_: (-> (& AST AST) (& AST AST)) - (function' [kv] - (let' [[slot value] kv] - [(apply-template env slot) (apply-template env value)]))) - members))] + [meta (#Record members)] + [meta (#Record (map (_lux_: (-> (& AST AST) (& AST AST)) + (function' [kv] + (let' [[slot value] kv] + [(apply-template env slot) (apply-template env value)]))) + members))] _ template)) @@ -2093,7 +2093,7 @@ [i.inc 1] [i.dec -1])")]) (_lux_case tokens - (#Cons [[_ (#TupleS bindings)] (#Cons [[_ (#TupleS templates)] data])]) + (#Cons [[_ (#Tuple bindings)] (#Cons [[_ (#Tuple templates)] data])]) (_lux_case [(mapM Monad<Maybe> get-name bindings) (mapM Monad<Maybe> tuple->list data)] [(#Some bindings') (#Some data')] @@ -2407,7 +2407,7 @@ #Nil (-> AST ($' Lux ($' List AST))) (_lux_case token - [_ (#FormS (#Cons [_ (#SymbolS macro-name)] args))] + [_ (#Form (#Cons [_ (#Symbol macro-name)] args))] (do Monad<Lux> [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -2425,7 +2425,7 @@ #Nil (-> AST ($' Lux ($' List AST))) (_lux_case token - [_ (#FormS (#Cons [_ (#SymbolS macro-name)] args))] + [_ (#Form (#Cons [_ (#Symbol macro-name)] args))] (do Monad<Lux> [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -2446,7 +2446,7 @@ #Nil (-> AST ($' Lux ($' List AST))) (_lux_case syntax - [_ (#FormS (#Cons [_ (#SymbolS macro-name)] args))] + [_ (#Form (#Cons [_ (#Symbol macro-name)] args))] (do Monad<Lux> [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -2462,17 +2462,17 @@ [args' (mapM Monad<Lux> macro-expand-all args)] (wrap (list (form$ (#Cons (symbol$ macro-name) (List/join args')))))))) - [_ (#FormS members)] + [_ (#Form members)] (do Monad<Lux> [members' (mapM Monad<Lux> macro-expand-all members)] (wrap (list (form$ (List/join members'))))) - [_ (#TupleS members)] + [_ (#Tuple members)] (do Monad<Lux> [members' (mapM Monad<Lux> macro-expand-all members)] (wrap (list (tuple$ (List/join members'))))) - [_ (#RecordS pairs)] + [_ (#Record pairs)] (do Monad<Lux> [pairs' (mapM Monad<Lux> (function' [kv] @@ -2495,13 +2495,13 @@ #Nil (-> AST AST) (_lux_case type - [_ (#FormS (#Cons [_ (#TagS tag)] parts))] + [_ (#Form (#Cons [_ (#Tag tag)] parts))] (form$ (#Cons [(tag$ tag) (map walk-type parts)])) - [_ (#TupleS members)] + [_ (#Tuple members)] (` (& (~@ (map walk-type members)))) - [_ (#FormS (#Cons type-fn args))] + [_ (#Form (#Cons type-fn args))] (fold (_lux_: (-> AST AST AST) (function' [arg type-fn] (` (#;AppT (~ type-fn) (~ arg))))) (walk-type type-fn) @@ -2567,13 +2567,13 @@ #Nil (-> ($' List AST) ($' Lux (& AST ($' Maybe ($' List Text))))) (_lux_case type-asts - (#Cons [_ (#RecordS pairs)] #;Nil) + (#Cons [_ (#Record pairs)] #;Nil) (do Monad<Lux> [members (mapM Monad<Lux> (: (-> [AST AST] (Lux [Text AST])) (function' [pair] (_lux_case pair - [[_ (#TagS "" member-name)] member-type] + [[_ (#Tag "" member-name)] member-type] (return [member-name member-type]) _ @@ -2584,10 +2584,10 @@ (#Cons type #Nil) (_lux_case type - [_ (#TagS "" member-name)] + [_ (#Tag "" member-name)] (return [(` #;UnitT) (#;Some (list member-name))]) - [_ (#FormS (#Cons [_ (#TagS "" member-name)] member-types))] + [_ (#Form (#Cons [_ (#Tag "" member-name)] member-types))] (return [(` (& (~@ member-types))) (#;Some (list member-name))]) _ @@ -2599,13 +2599,13 @@ (: (-> AST (Lux [Text AST])) (function' [case] (_lux_case case - [_ (#TagS "" member-name)] + [_ (#Tag "" member-name)] (return [member-name (` Unit)]) - [_ (#FormS (#Cons [_ (#TagS "" member-name)] (#Cons member-type #Nil)))] + [_ (#Form (#Cons [_ (#Tag "" member-name)] (#Cons member-type #Nil)))] (return [member-name member-type]) - [_ (#FormS (#Cons [_ (#TagS "" member-name)] member-types))] + [_ (#Form (#Cons [_ (#Tag "" member-name)] member-types))] (return [member-name (` (& (~@ member-types)))]) _ @@ -2639,7 +2639,7 @@ (Rec Self [Int (List Self)])")]) (_lux_case tokens - (#Cons [_ (#SymbolS "" name)] (#Cons body #Nil)) + (#Cons [_ (#Symbol "" name)] (#Cons body #Nil)) (let' [body' (replace-syntax (list [name (` (#AppT (~ (make-bound +0)) (~ (make-bound +1))))]) (update-bounds body))] (return (list (` (#AppT (#UnivQ #Nil (~ body')) Void))))) @@ -2667,20 +2667,20 @@ (macro:' (def:' tokens) (let' [[export? tokens'] (_lux_case tokens - (#Cons [_ (#TagS "" "export")] tokens') + (#Cons [_ (#Tag "" "export")] tokens') [true tokens'] _ [false tokens]) parts (: (Maybe [AST (List AST) (Maybe AST) AST]) (_lux_case tokens' - (#Cons [_ (#FormS (#Cons name args))] (#Cons type (#Cons body #Nil))) + (#Cons [_ (#Form (#Cons name args))] (#Cons type (#Cons body #Nil))) (#Some name args (#Some type) body) (#Cons name (#Cons type (#Cons body #Nil))) (#Some name #Nil (#Some type) body) - (#Cons [_ (#FormS (#Cons name args))] (#Cons body #Nil)) + (#Cons [_ (#Form (#Cons name args))] (#Cons body #Nil)) (#Some name args #None body) (#Cons name (#Cons body #Nil)) @@ -2718,52 +2718,52 @@ (def:' (ast-to-text ast) (-> AST Text) (_lux_case ast - [_ (#BoolS value)] + [_ (#Bool value)] (Bool/encode value) - [_ (#NatS value)] + [_ (#Nat value)] (Nat/encode value) - [_ (#IntS value)] + [_ (#Int value)] (Int/encode value) - [_ (#DegS value)] + [_ (#Deg value)] (Deg/encode value) - [_ (#RealS value)] + [_ (#Real value)] (Real/encode value) - [_ (#CharS value)] + [_ (#Char value)] ($_ Text/append "#" "\"" (Char/encode value) "\"") - [_ (#TextS value)] + [_ (#Text value)] ($_ Text/append "\"" value "\"") - [_ (#SymbolS [prefix name])] + [_ (#Symbol [prefix name])] (if (Text/= "" prefix) name ($_ Text/append prefix ";" name)) - [_ (#TagS [prefix name])] + [_ (#Tag [prefix name])] (if (Text/= "" prefix) ($_ Text/append "#" name) ($_ Text/append "#" prefix ";" name)) - [_ (#FormS xs)] + [_ (#Form xs)] ($_ Text/append "(" (|> xs (map ast-to-text) (interpose " ") reverse (fold Text/append "")) ")") - [_ (#TupleS xs)] + [_ (#Tuple xs)] ($_ Text/append "[" (|> xs (map ast-to-text) (interpose " ") reverse (fold Text/append "")) "]") - [_ (#RecordS kvs)] + [_ (#Record kvs)] ($_ Text/append "{" (|> kvs (map (function' [kv] (_lux_case kv [k v] ($_ Text/append (ast-to-text k) " " (ast-to-text v))))) (interpose " ") @@ -2774,7 +2774,7 @@ (def:' (expander branches) (-> (List AST) (Lux (List AST))) (_lux_case branches - (#;Cons [_ (#FormS (#Cons [_ (#SymbolS macro-name)] macro-args))] + (#;Cons [_ (#Form (#Cons [_ (#Symbol macro-name)] macro-args))] (#;Cons body branches')) (do Monad<Lux> @@ -2832,7 +2832,7 @@ _ #None)")]) (case tokens - (#Cons [_ (#FormS (#Cons pattern #Nil))] (#Cons body branches)) + (#Cons [_ (#Form (#Cons pattern #Nil))] (#Cons body branches)) (do Monad<Lux> [pattern+ (macro-expand-all pattern)] (case pattern+ @@ -2866,7 +2866,7 @@ _ false))")]) (case tokens - (^ (list& [_ (#FormS patterns)] body branches)) + (^ (list& [_ (#Form patterns)] body branches)) (case patterns #Nil (fail "^or cannot have 0 patterns") @@ -2882,7 +2882,7 @@ (def:' (symbol? ast) (-> AST Bool) (case ast - [_ (#SymbolS _)] + [_ (#Symbol _)] true _ @@ -2895,7 +2895,7 @@ y (baz quux)] (op x y))")]) (case tokens - (^ (list [_ (#TupleS bindings)] body)) + (^ (list [_ (#Tuple bindings)] body)) (if (multiple? 2 (length bindings)) (|> bindings as-pairs reverse (fold (: (-> [AST AST] AST AST) @@ -2922,10 +2922,10 @@ (function const [x y] x))")]) (case (: (Maybe [Ident AST (List AST) AST]) (case tokens - (^ (list [_ (#TupleS (#Cons head tail))] body)) + (^ (list [_ (#Tuple (#Cons head tail))] body)) (#Some ["" ""] head tail body) - (^ (list [_ (#SymbolS ["" name])] [_ (#TupleS (#Cons head tail))] body)) + (^ (list [_ (#Symbol ["" name])] [_ (#Tuple (#Cons head tail))] body)) (#Some ["" name] head tail body) _ @@ -2951,45 +2951,45 @@ (def:' (process-def-meta-value ast) (-> AST (Lux AST)) (case ast - [_ (#BoolS value)] + [_ (#Bool value)] (return (form$ (list (tag$ ["lux" "BoolA"]) (bool$ value)))) - [_ (#NatS value)] + [_ (#Nat value)] (return (form$ (list (tag$ ["lux" "NatA"]) (nat$ value)))) - [_ (#IntS value)] + [_ (#Int value)] (return (form$ (list (tag$ ["lux" "IntA"]) (int$ value)))) - [_ (#DegS value)] + [_ (#Deg value)] (return (form$ (list (tag$ ["lux" "DegA"]) (deg$ value)))) - [_ (#RealS value)] + [_ (#Real value)] (return (form$ (list (tag$ ["lux" "RealA"]) (real$ value)))) - [_ (#CharS value)] + [_ (#Char value)] (return (form$ (list (tag$ ["lux" "CharA"]) (char$ value)))) - [_ (#TextS value)] + [_ (#Text value)] (return (form$ (list (tag$ ["lux" "TextA"]) (text$ value)))) - [_ (#TagS [prefix name])] + [_ (#Tag [prefix name])] (return (form$ (list (tag$ ["lux" "IdentA"]) (tuple$ (list (text$ prefix) (text$ name)))))) - (^or [_ (#FormS _)] [_ (#SymbolS _)]) + (^or [_ (#Form _)] [_ (#Symbol _)]) (return ast) - [_ (#TupleS xs)] + [_ (#Tuple xs)] (do Monad<Lux> [=xs (mapM Monad<Lux> process-def-meta-value xs)] (wrap (form$ (list (tag$ ["lux" "ListA"]) (untemplate-list =xs))))) - [_ (#RecordS kvs)] + [_ (#Record kvs)] (do Monad<Lux> [=xs (mapM Monad<Lux> (: (-> [AST AST] (Lux AST)) (function [[k v]] (case k - [_ (#TextS =k)] + [_ (#Text =k)] (do Monad<Lux> [=v (process-def-meta-value v)] (wrap (tuple$ (list (text$ =k) =v)))) @@ -3003,13 +3003,13 @@ (def:' (process-def-meta ast) (-> AST (Lux AST)) (case ast - [_ (#RecordS kvs)] + [_ (#Record kvs)] (do Monad<Lux> [=kvs (mapM Monad<Lux> (: (-> [AST AST] (Lux AST)) (function [[k v]] (case k - [_ (#TagS [pk nk])] + [_ (#Tag [pk nk])] (do Monad<Lux> [=v (process-def-meta-value v)] (wrap (tuple$ (list (tuple$ (list (text$ pk) (text$ nk))) @@ -3052,10 +3052,10 @@ (def:' (export-level^ tokens) (-> (List AST) [(Maybe Export-Level) (List AST)]) (case tokens - (#Cons [_ (#TagS [_ "export"])] tokens') + (#Cons [_ (#Tag [_ "export"])] tokens') [(#;Some (#;Left [])) tokens'] - (#Cons [_ (#TagS [_ "hidden"])] tokens') + (#Cons [_ (#Tag [_ "hidden"])] tokens') [(#;Some (#;Right [])) tokens'] _ @@ -3086,25 +3086,25 @@ (let [[export? tokens'] (export-level^ tokens) parts (: (Maybe [AST (List AST) (Maybe AST) AST AST]) (case tokens' - (^ (list [_ (#FormS (#Cons name args))] meta type body)) + (^ (list [_ (#Form (#Cons name args))] meta type body)) (#Some [name args (#Some type) body meta]) (^ (list name meta type body)) (#Some [name #Nil (#Some type) body meta]) - (^ (list [_ (#FormS (#Cons name args))] [_ (#RecordS meta-kvs)] body)) + (^ (list [_ (#Form (#Cons name args))] [_ (#Record meta-kvs)] body)) (#Some [name args #None body (record$ meta-kvs)]) - (^ (list name [_ (#RecordS meta-kvs)] body)) + (^ (list name [_ (#Record meta-kvs)] body)) (#Some [name #Nil #None body (record$ meta-kvs)]) - (^ (list [_ (#FormS (#Cons name args))] type body)) + (^ (list [_ (#Form (#Cons name args))] type body)) (#Some [name args (#Some type) body (' {})]) (^ (list name type body)) (#Some [name #Nil (#Some type) body (' {})]) - (^ (list [_ (#FormS (#Cons name args))] body)) + (^ (list [_ (#Form (#Cons name args))] body)) (#Some [name args #None body (' {})]) (^ (list name body)) @@ -3148,8 +3148,8 @@ (def: (meta-ast-add addition meta) (-> [AST AST] AST AST) (case [addition meta] - [[name value] [cursor (#;RecordS pairs)]] - [cursor (#;RecordS (#;Cons [name value] pairs))] + [[name value] [cursor (#;Record pairs)]] + [cursor (#;Record (#;Cons [name value] pairs))] _ meta)) @@ -3157,7 +3157,7 @@ (def: (meta-ast-merge addition base) (-> AST AST AST) (case addition - [cursor (#;RecordS pairs)] + [cursor (#;Record pairs)] (fold meta-ast-add base pairs) _ @@ -3171,24 +3171,24 @@ (^template [<tag>] (^ (list [_ (<tag> [prefix name])])) (return (list (` [(~ (text$ prefix)) (~ (text$ name))])))) - ([#;SymbolS] [#;TagS]) + ([#;Symbol] [#;Tag]) _ (fail \"Wrong syntax for ident-for\")))")]) (let [[exported? tokens] (export-level^ tokens) name+args+meta+body?? (: (Maybe [Ident (List AST) AST AST]) (case tokens - (^ (list [_ (#;FormS (list& [_ (#SymbolS name)] args))] body)) + (^ (list [_ (#;Form (list& [_ (#Symbol name)] args))] body)) (#Some [name args (` {}) body]) - (^ (list [_ (#;SymbolS name)] body)) + (^ (list [_ (#;Symbol name)] body)) (#Some [name #Nil (` {}) body]) - (^ (list [_ (#;FormS (list& [_ (#SymbolS name)] args))] [meta-rec-cursor (#;RecordS meta-rec-parts)] body)) - (#Some [name args [meta-rec-cursor (#;RecordS meta-rec-parts)] body]) + (^ (list [_ (#;Form (list& [_ (#Symbol name)] args))] [meta-rec-cursor (#;Record meta-rec-parts)] body)) + (#Some [name args [meta-rec-cursor (#;Record meta-rec-parts)] body]) - (^ (list [_ (#;SymbolS name)] [meta-rec-cursor (#;RecordS meta-rec-parts)] body)) - (#Some [name #Nil [meta-rec-cursor (#;RecordS meta-rec-parts)] body]) + (^ (list [_ (#;Symbol name)] [meta-rec-cursor (#;Record meta-rec-parts)] body)) + (#Some [name #Nil [meta-rec-cursor (#;Record meta-rec-parts)] body]) _ #None))] @@ -3226,16 +3226,16 @@ (let [[exported? tokens'] (export-level^ tokens) ?parts (: (Maybe [Ident (List AST) AST (List AST)]) (case tokens' - (^ (list& [_ (#FormS (list& [_ (#SymbolS name)] args))] [meta-rec-cursor (#;RecordS meta-rec-parts)] sigs)) - (#Some name args [meta-rec-cursor (#;RecordS meta-rec-parts)] sigs) + (^ (list& [_ (#Form (list& [_ (#Symbol name)] args))] [meta-rec-cursor (#;Record meta-rec-parts)] sigs)) + (#Some name args [meta-rec-cursor (#;Record meta-rec-parts)] sigs) - (^ (list& [_ (#SymbolS name)] [meta-rec-cursor (#;RecordS meta-rec-parts)] sigs)) - (#Some name #Nil [meta-rec-cursor (#;RecordS meta-rec-parts)] sigs) + (^ (list& [_ (#Symbol name)] [meta-rec-cursor (#;Record meta-rec-parts)] sigs)) + (#Some name #Nil [meta-rec-cursor (#;Record meta-rec-parts)] sigs) - (^ (list& [_ (#FormS (list& [_ (#SymbolS name)] args))] sigs)) + (^ (list& [_ (#Form (list& [_ (#Symbol name)] args))] sigs)) (#Some name args (` {}) sigs) - (^ (list& [_ (#SymbolS name)] sigs)) + (^ (list& [_ (#Symbol name)] sigs)) (#Some name #Nil (` {}) sigs) _ @@ -3250,7 +3250,7 @@ (: (-> AST (Lux [Text AST])) (function [token] (case token - (^ [_ (#FormS (list [_ (#SymbolS _ "_lux_:")] type [_ (#SymbolS ["" name])]))]) + (^ [_ (#Form (list [_ (#Symbol _ "_lux_:")] type [_ (#Symbol ["" name])]))]) (wrap [name type]) _ @@ -3321,7 +3321,7 @@ (default 20 #;None) => 20"} (case tokens (^ (list else maybe)) - (let [g!temp (: AST [_cursor (#;SymbolS ["" ""])]) + (let [g!temp (: AST [_cursor (#;Symbol ["" ""])]) code (` (case (~ maybe) (#;Some (~ g!temp)) (~ g!temp) @@ -3586,7 +3586,7 @@ (: (-> AST (Lux [AST AST])) (function [token] (case token - (^ [_ (#FormS (list [_ (#SymbolS _ "_lux_def")] [_ (#SymbolS "" tag-name)] value meta))]) + (^ [_ (#Form (list [_ (#Symbol _ "_lux_def")] [_ (#Symbol "" tag-name)] value meta))]) (case (get tag-name tag-mappings) (#Some tag) (wrap [tag value]) @@ -3620,13 +3620,13 @@ (let [[exported? tokens'] (export-level^ tokens) ?parts (: (Maybe [AST (List AST) AST AST (List AST)]) (case tokens' - (^ (list& [_ (#FormS (list& name args))] [meta-rec-cursor (#;RecordS meta-rec-parts)] type defs)) - (#Some name args type [meta-rec-cursor (#;RecordS meta-rec-parts)] defs) + (^ (list& [_ (#Form (list& name args))] [meta-rec-cursor (#;Record meta-rec-parts)] type defs)) + (#Some name args type [meta-rec-cursor (#;Record meta-rec-parts)] defs) - (^ (list& name [meta-rec-cursor (#;RecordS meta-rec-parts)] type defs)) - (#Some name #Nil type [meta-rec-cursor (#;RecordS meta-rec-parts)] defs) + (^ (list& name [meta-rec-cursor (#;Record meta-rec-parts)] type defs)) + (#Some name #Nil type [meta-rec-cursor (#;Record meta-rec-parts)] defs) - (^ (list& [_ (#FormS (list& name args))] type defs)) + (^ (list& [_ (#Form (list& name args))] type defs)) (#Some name args type (` {}) defs) (^ (list& name type defs)) @@ -3637,14 +3637,14 @@ (case ?parts (#Some [name args type meta defs]) (case (case name - [_ (#;SymbolS ["" "_"])] + [_ (#;Symbol ["" "_"])] (case type - (^ [_ (#;FormS (list& [_ (#;SymbolS [_ sig-name])] sig-args))]) + (^ [_ (#;Form (list& [_ (#;Symbol [_ sig-name])] sig-args))]) (case (: (Maybe (List Text)) (mapM Monad<Maybe> (function [sa] (case sa - [_ (#;SymbolS [_ arg-name])] + [_ (#;Symbol [_ arg-name])] (#;Some arg-name) _ @@ -3711,29 +3711,29 @@ (#Cons a (List a)))"} (let [[exported? tokens'] (export-level^ tokens) [rec? tokens'] (case tokens' - (#Cons [_ (#TagS [_ "rec"])] tokens') + (#Cons [_ (#Tag [_ "rec"])] tokens') [true tokens'] _ [false tokens']) parts (: (Maybe [Text (List AST) AST (List AST)]) (case tokens' - (^ (list [_ (#SymbolS "" name)] [meta-cursor (#;RecordS meta-parts)] [type-cursor (#;RecordS type-parts)])) - (#Some [name #Nil [meta-cursor (#;RecordS meta-parts)] (list [type-cursor (#;RecordS type-parts)])]) + (^ (list [_ (#Symbol "" name)] [meta-cursor (#;Record meta-parts)] [type-cursor (#;Record type-parts)])) + (#Some [name #Nil [meta-cursor (#;Record meta-parts)] (list [type-cursor (#;Record type-parts)])]) - (^ (list& [_ (#SymbolS "" name)] [meta-cursor (#;RecordS meta-parts)] type-ast1 type-asts)) - (#Some [name #Nil [meta-cursor (#;RecordS meta-parts)] (#;Cons type-ast1 type-asts)]) + (^ (list& [_ (#Symbol "" name)] [meta-cursor (#;Record meta-parts)] type-ast1 type-asts)) + (#Some [name #Nil [meta-cursor (#;Record meta-parts)] (#;Cons type-ast1 type-asts)]) - (^ (list& [_ (#SymbolS "" name)] type-asts)) + (^ (list& [_ (#Symbol "" name)] type-asts)) (#Some [name #Nil (` {}) type-asts]) - (^ (list [_ (#FormS (#Cons [_ (#SymbolS "" name)] args))] [meta-cursor (#;RecordS meta-parts)] [type-cursor (#;RecordS type-parts)])) - (#Some [name args [meta-cursor (#;RecordS meta-parts)] (list [type-cursor (#;RecordS type-parts)])]) + (^ (list [_ (#Form (#Cons [_ (#Symbol "" 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& [_ (#FormS (#Cons [_ (#SymbolS "" name)] args))] [meta-cursor (#;RecordS meta-parts)] type-ast1 type-asts)) - (#Some [name args [meta-cursor (#;RecordS meta-parts)] (#;Cons type-ast1 type-asts)]) + (^ (list& [_ (#Form (#Cons [_ (#Symbol "" name)] args))] [meta-cursor (#;Record meta-parts)] type-ast1 type-asts)) + (#Some [name args [meta-cursor (#;Record meta-parts)] (#;Cons type-ast1 type-asts)]) - (^ (list& [_ (#FormS (#Cons [_ (#SymbolS "" name)] args))] type-asts)) + (^ (list& [_ (#Form (#Cons [_ (#Symbol "" name)] args))] type-asts)) (#Some [name args (` {}) type-asts]) _ @@ -3815,7 +3815,7 @@ (: (-> AST (Lux Text)) (function [def] (case def - [_ (#SymbolS ["" name])] + [_ (#Symbol ["" name])] (return name) _ @@ -3825,7 +3825,7 @@ (def: (parse-alias tokens) (-> (List AST) (Lux [(Maybe Text) (List AST)])) (case tokens - (^ (list& [_ (#TagS "" "as")] [_ (#SymbolS "" alias)] tokens')) + (^ (list& [_ (#Tag "" "as")] [_ (#Symbol "" alias)] tokens')) (return [(#Some alias) tokens']) _ @@ -3834,17 +3834,17 @@ (def: (parse-referrals tokens) (-> (List AST) (Lux [Referrals (List AST)])) (case tokens - (^ (list& [_ (#TagS ["" "refer"])] referral tokens')) + (^ (list& [_ (#Tag ["" "refer"])] referral tokens')) (case referral - [_ (#TagS "" "all")] + [_ (#Tag "" "all")] (return [#All tokens']) - (^ [_ (#FormS (list& [_ (#TagS ["" "only"])] defs))]) + (^ [_ (#Form (list& [_ (#Tag ["" "only"])] defs))]) (do Monad<Lux> [defs' (extract-defs defs)] (return [(#Only defs') tokens'])) - (^ [_ (#FormS (list& [_ (#TagS ["" "exclude"])] defs))]) + (^ [_ (#Form (list& [_ (#Tag ["" "exclude"])] defs))]) (do Monad<Lux> [defs' (extract-defs defs)] (return [(#Exclude defs') tokens'])) @@ -3876,19 +3876,19 @@ (def: (parse-short-referrals tokens) (-> (List AST) (Lux [Referrals (List AST)])) (case tokens - (^ (list& [_ (#TagS "" "+")] tokens')) + (^ (list& [_ (#Tag "" "+")] tokens')) (let [[defs tokens'] (split-with symbol? tokens')] (do Monad<Lux> [defs' (extract-defs defs)] (return [(#Only defs') tokens']))) - (^ (list& [_ (#TagS "" "-")] tokens')) + (^ (list& [_ (#Tag "" "-")] tokens')) (let [[defs tokens'] (split-with symbol? tokens')] (do Monad<Lux> [defs' (extract-defs defs)] (return [(#Exclude defs') tokens']))) - (^ (list& [_ (#TagS "" "*")] tokens')) + (^ (list& [_ (#Tag "" "*")] tokens')) (return [#All tokens']) _ @@ -3897,7 +3897,7 @@ (def: (extract-symbol syntax) (-> AST (Lux Ident)) (case syntax - [_ (#SymbolS ident)] + [_ (#Symbol ident)] (return ident) _ @@ -3906,12 +3906,12 @@ (def: (parse-openings tokens) (-> (List AST) (Lux [(List Openings) (List AST)])) (case tokens - (^ (list& [_ (#TagS "" "open")] [_ (#FormS parts)] tokens')) + (^ (list& [_ (#Tag "" "open")] [_ (#Form parts)] tokens')) (if (|> parts (map (: (-> AST Bool) (function [part] (case part - (^or [_ (#TextS _)] [_ (#SymbolS _)]) + (^or [_ (#Text _)] [_ (#Symbol _)]) true _ @@ -3920,10 +3920,10 @@ (let [openings (fold (: (-> AST (List Openings) (List Openings)) (function [part openings] (case part - [_ (#TextS prefix)] + [_ (#Text prefix)] (list& [prefix (list)] openings) - [_ (#SymbolS struct-name)] + [_ (#Symbol struct-name)] (case openings #Nil (list ["" (list struct-name)]) @@ -3947,7 +3947,7 @@ (map (: (-> AST Bool) (function [part] (case part - (^or [_ (#TextS _)] [_ (#SymbolS _)]) + (^or [_ (#Text _)] [_ (#Symbol _)]) true _ @@ -3956,10 +3956,10 @@ (let [openings (fold (: (-> AST (List Openings) (List Openings)) (function [part openings] (case part - [_ (#TextS prefix)] + [_ (#Text prefix)] (list& [prefix (list)] openings) - [_ (#SymbolS struct-name)] + [_ (#Symbol struct-name)] (case openings #Nil (list ["" (list struct-name)]) @@ -4020,13 +4020,13 @@ (: (-> AST (Lux (List Importation))) (function [token] (case token - [_ (#SymbolS "" m-name)] + [_ (#Symbol "" m-name)] (do Monad<Lux> [m-name (clean-module m-name)] (wrap (list [m-name #None {#refer-defs #All #refer-open (list)}]))) - (^ [_ (#FormS (list& [_ (#SymbolS "" m-name)] extra))]) + (^ [_ (#Form (list& [_ (#Symbol "" m-name)] extra))]) (do Monad<Lux> [m-name (clean-module m-name) alias+extra (parse-alias extra) @@ -4045,7 +4045,7 @@ #refer-open openings}} sub-imports)))) - (^ [_ (#TupleS (list& [_ (#TextS alias)] [_ (#SymbolS "" m-name)] extra))]) + (^ [_ (#Tuple (list& [_ (#Text alias)] [_ (#Symbol "" m-name)] extra))]) (do Monad<Lux> [m-name (clean-module m-name) referral+extra (parse-short-referrals extra) @@ -4057,7 +4057,7 @@ #import-refer {#refer-defs referral #refer-open openings}}))) - (^ [_ (#TupleS (list& [_ (#SymbolS "" m-name)] extra))]) + (^ [_ (#Tuple (list& [_ (#Symbol "" m-name)] extra))]) (do Monad<Lux> [m-name (clean-module m-name) referral+extra (parse-short-referrals extra) @@ -4296,7 +4296,7 @@ (macro: #hidden (^open' tokens) (case tokens - (^ (list [_ (#SymbolS name)] [_ (#TextS prefix)] body)) + (^ (list [_ (#Symbol name)] [_ (#Text prefix)] body)) (do Monad<Lux> [init-type (find-type name) struct-evidence (resolve-type-tags init-type)] @@ -4341,12 +4341,12 @@ (All [a] (-> (Enum a) a a (List a))) (range' <= succ from to))"} (case tokens - (^ (list& [_ (#FormS (list [_ (#TextS prefix)]))] body branches)) + (^ (list& [_ (#Form (list [_ (#Text prefix)]))] body branches)) (do Monad<Lux> [g!temp (gensym "temp")] (return (list& g!temp (` (^open' (~ g!temp) (~ (text$ prefix)) (~ body))) branches))) - (^ (list& [_ (#FormS (list))] body branches)) + (^ (list& [_ (#Form (list))] body branches)) (return (list& (` (;;^open "")) body branches)) _ @@ -4397,7 +4397,7 @@ (let [getter (get@ [#foo #bar #baz])] (getter my-record))"} (case tokens - (^ (list [_ (#TagS slot')] record)) + (^ (list [_ (#Tag slot')] record)) (do Monad<Lux> [slot (normalize slot') output (resolve-tag slot) @@ -4417,7 +4417,7 @@ _ (fail "get@ can only use records."))) - (^ (list [_ (#TupleS slots)] record)) + (^ (list [_ (#Tuple slots)] record)) (return (list (fold (: (-> AST AST AST) (function [slot inner] (` (;;get@ (~ slot) (~ inner))))) @@ -4460,11 +4460,11 @@ (def: i:* (:: Number<Int> *)) ..."} (case tokens - (^ (list& [_ (#SymbolS struct-name)] tokens')) + (^ (list& [_ (#Symbol struct-name)] tokens')) (do Monad<Lux> [@module current-module-name #let [prefix (case tokens' - (^ (list [_ (#TextS prefix)])) + (^ (list [_ (#Text prefix)])) prefix _ @@ -4594,7 +4594,7 @@ (macro: #hidden (refer tokens) (case tokens - (^ (list& [_ (#TextS module-name)] options)) + (^ (list& [_ (#Text module-name)] options)) (do Monad<Lux> [=refer (read-refer module-name options)] (write-refer module-name =refer)) @@ -4656,7 +4656,7 @@ (do Monad<Lux> [#let [[_meta _imports] (: [(List [AST AST]) (List AST)] (case tokens - (^ (list& [_ (#RecordS _meta)] _imports)) + (^ (list& [_ (#Record _meta)] _imports)) [_meta _imports] _ @@ -4682,10 +4682,10 @@ ## Also allows using that value as a function. (:: Codec<Text,Int> encode 123)"} (case tokens - (^ (list struct [_ (#SymbolS member)])) + (^ (list struct [_ (#Symbol member)])) (return (list (` (let [(^open) (~ struct)] (~ (symbol$ member)))))) - (^ (list& struct [_ (#SymbolS member)] args)) + (^ (list& struct [_ (#Symbol member)] args)) (return (list (` ((let [(^open) (~ struct)] (~ (symbol$ member))) (~@ args))))) _ @@ -4706,7 +4706,7 @@ (let [setter (set@ [#foo #bar #baz])] (setter value my-record))"} (case tokens - (^ (list [_ (#TagS slot')] value record)) + (^ (list [_ (#Tag slot')] value record)) (do Monad<Lux> [slot (normalize slot') output (resolve-tag slot) @@ -4736,7 +4736,7 @@ _ (fail "set@ can only use records."))) - (^ (list [_ (#TupleS slots)] value record)) + (^ (list [_ (#Tuple slots)] value record)) (case slots #;Nil (fail "Wrong syntax for set@") @@ -4792,7 +4792,7 @@ (let [updater (update@ [#foo #bar #baz])] (updater func my-record))"} (case tokens - (^ (list [_ (#TagS slot')] fun record)) + (^ (list [_ (#Tag slot')] fun record)) (do Monad<Lux> [slot (normalize slot') output (resolve-tag slot) @@ -4822,7 +4822,7 @@ _ (fail "update@ can only use records."))) - (^ (list [_ (#TupleS slots)] fun record)) + (^ (list [_ (#Tuple slots)] fun record)) (case slots #;Nil (fail "Wrong syntax for update@") @@ -4886,8 +4886,8 @@ type ))"} (case tokens - (^ (list& [_ (#FormS (list& [_ (#TupleS bindings)] templates))] - [_ (#FormS data)] + (^ (list& [_ (#Form (list& [_ (#Tuple bindings)] templates))] + [_ (#Form data)] branches)) (case (: (Maybe (List AST)) (do Monad<Maybe> @@ -4924,23 +4924,23 @@ (^template [<tag>] [[_ _ column] (<tag> _)] column) - ([#BoolS] - [#NatS] - [#IntS] - [#DegS] - [#RealS] - [#CharS] - [#TextS] - [#SymbolS] - [#TagS]) + ([#Bool] + [#Nat] + [#Int] + [#Deg] + [#Real] + [#Char] + [#Text] + [#Symbol] + [#Tag]) (^template [<tag>] [[_ _ column] (<tag> parts)] (fold n.min column (map find-baseline-column parts))) - ([#FormS] - [#TupleS]) + ([#Form] + [#Tuple]) - [[_ _ column] (#RecordS pairs)] + [[_ _ column] (#Record pairs)] (fold n.min column (List/append (map (. find-baseline-column first) pairs) (map (. find-baseline-column second) pairs))) @@ -4953,7 +4953,7 @@ (def: (identify-doc-fragment ast) (-> AST Doc-Fragment) (case ast - [_ (#;TextS comment)] + [_ (#;Text comment)] (#Doc-Comment comment) _ @@ -5043,15 +5043,15 @@ [(update-cursor new-cursor as-text) (Text/append (cursor-padding baseline prev-cursor new-cursor) as-text)])) - ([#BoolS Bool/encode] - [#NatS Nat/encode] - [#IntS Int/encode] - [#DegS Deg/encode] - [#RealS Real/encode] - [#CharS Char/encode] - [#TextS Text/encode] - [#SymbolS Ident/encode] - [#TagS Tag/encode]) + ([#Bool Bool/encode] + [#Nat Nat/encode] + [#Int Int/encode] + [#Deg Deg/encode] + [#Real Real/encode] + [#Char Char/encode] + [#Text Text/encode] + [#Symbol Ident/encode] + [#Tag Tag/encode]) (^template [<tag> <open> <close> <prep>] [group-cursor (<tag> parts)] @@ -5065,9 +5065,9 @@ <open> parts-text <close>)])) - ([#FormS "(" ")" id] - [#TupleS "[" "]" id] - [#RecordS "{" "}" rejoin-all-pairs]) + ([#Form "(" ")" id] + [#Tuple "[" "]" id] + [#Record "{" "}" rejoin-all-pairs]) )) (def: (with-baseline baseline [file line column]) @@ -5173,7 +5173,7 @@ (recur (i.inc count) (f x)) x)))} (case tokens - (^ (list [_ (#TupleS bindings)] body)) + (^ (list [_ (#Tuple bindings)] body)) (let [pairs (as-pairs bindings) vars (map first pairs) inits (map second pairs)] @@ -5208,7 +5208,7 @@ (let [(^slots [#foo #bar #baz]) quux] (f foo bar baz)))} (case tokens - (^ (list& [_ (#FormS (list [_ (#TupleS (list& hslot' tslots'))]))] body branches)) + (^ (list& [_ (#Form (list [_ (#Tuple (list& hslot' tslots'))]))] body branches)) (do Monad<Lux> [slots (: (Lux [Ident (List Ident)]) (case (: (Maybe [Ident (List Ident)]) @@ -5245,10 +5245,10 @@ (def: (place-tokens label tokens target) (-> Text (List AST) AST (Maybe (List AST))) (case target - (^or [_ (#BoolS _)] [_ (#NatS _)] [_ (#IntS _)] [_ (#DegS _)] [_ (#RealS _)] [_ (#CharS _)] [_ (#TextS _)] [_ (#TagS _)]) + (^or [_ (#Bool _)] [_ (#Nat _)] [_ (#Int _)] [_ (#Deg _)] [_ (#Real _)] [_ (#Char _)] [_ (#Text _)] [_ (#Tag _)]) (#Some (list target)) - [_ (#SymbolS [prefix name])] + [_ (#Symbol [prefix name])] (if (and (Text/= "" prefix) (Text/= label name)) (#Some tokens) @@ -5259,10 +5259,10 @@ (do Monad<Maybe> [placements (mapM Monad<Maybe> (place-tokens label tokens) elems)] (wrap (list (<ctor> (List/join placements)))))) - ([#TupleS tuple$] - [#FormS form$]) + ([#Tuple tuple$] + [#Form form$]) - [_ (#RecordS pairs)] + [_ (#Record pairs)] (do Monad<Maybe> [=pairs (mapM Monad<Maybe> (: (-> [AST AST] (Maybe [AST AST])) @@ -5290,25 +5290,25 @@ (compare <text> (:: AST/encode show <expr>)) (compare true (:: Eq<AST> = <expr> <expr>))] - [(bool true) "true" [_ (#;BoolS true)]] - [(bool false) "false" [_ (#;BoolS false)]] - [(int 123) "123" [_ (#;IntS 123)]] - [(real 123.0) "123.0" [_ (#;RealS 123.0)]] - [(char #"\n") "#\"\\n\"" [_ (#;CharS #"\n")]] - [(text "\n") "\"\\n\"" [_ (#;TextS "\n")]] - [(tag ["yolo" "lol"]) "#yolo;lol" [_ (#;TagS ["yolo" "lol"])]] - [(symbol ["yolo" "lol"]) "yolo;lol" [_ (#;SymbolS ["yolo" "lol"])]] - [(form (list (bool true) (int 123))) "(true 123)" (^ [_ (#;FormS (list [_ (#;BoolS true)] [_ (#;IntS 123)]))])] - [(tuple (list (bool true) (int 123))) "[true 123]" (^ [_ (#;TupleS (list [_ (#;BoolS true)] [_ (#;IntS 123)]))])] - [(record (list [(bool true) (int 123)])) "{true 123}" (^ [_ (#;RecordS (list [[_ (#;BoolS true)] [_ (#;IntS 123)]]))])] - [(local-tag "lol") "#lol" [_ (#;TagS ["" "lol"])]] - [(local-symbol "lol") "lol" [_ (#;SymbolS ["" "lol"])]] + [(bool true) "true" [_ (#;Bool true)]] + [(bool false) "false" [_ (#;Bool false)]] + [(int 123) "123" [_ (#;Int 123)]] + [(real 123.0) "123.0" [_ (#;Real 123.0)]] + [(char #"\n") "#\"\\n\"" [_ (#;Char #"\n")]] + [(text "\n") "\"\\n\"" [_ (#;Text "\n")]] + [(tag ["yolo" "lol"]) "#yolo;lol" [_ (#;Tag ["yolo" "lol"])]] + [(symbol ["yolo" "lol"]) "yolo;lol" [_ (#;Symbol ["yolo" "lol"])]] + [(form (list (bool true) (int 123))) "(true 123)" (^ [_ (#;Form (list [_ (#;Bool true)] [_ (#;Int 123)]))])] + [(tuple (list (bool true) (int 123))) "[true 123]" (^ [_ (#;Tuple (list [_ (#;Bool true)] [_ (#;Int 123)]))])] + [(record (list [(bool true) (int 123)])) "{true 123}" (^ [_ (#;Record (list [[_ (#;Bool true)] [_ (#;Int 123)]]))])] + [(local-tag "lol") "#lol" [_ (#;Tag ["" "lol"])]] + [(local-symbol "lol") "lol" [_ (#;Symbol ["" "lol"])]] )] (test-all <tests>))))} (case tokens - (^ (list& [_ (#TupleS bindings)] bodies)) + (^ (list& [_ (#Tuple bindings)] bodies)) (case bindings - (^ (list& [_ (#SymbolS ["" var-name])] macro-expr bindings')) + (^ (list& [_ (#Symbol ["" var-name])] macro-expr bindings')) (do Monad<Lux> [expansion (macro-expand-once macro-expr)] (case (place-tokens var-name expansion (` (;let% [(~@ bindings')] (~@ bodies)))) @@ -5370,7 +5370,7 @@ (def: (anti-quote token) (-> AST (Lux AST)) (case token - [_ (#SymbolS [def-prefix def-name])] + [_ (#Symbol [def-prefix def-name])] (if (Text/= "" def-prefix) (:: Monad<Lux> return token) (anti-quote-def [def-prefix def-name])) @@ -5380,10 +5380,10 @@ (do Monad<Lux> [=parts (mapM Monad<Lux> anti-quote parts)] (wrap [meta (<tag> =parts)]))) - ([#FormS] - [#TupleS]) + ([#Form] + [#Tuple]) - [meta (#RecordS pairs)] + [meta (#Record pairs)] (do Monad<Lux> [=pairs (mapM Monad<Lux> (: (-> [AST AST] (Lux [AST AST])) @@ -5392,7 +5392,7 @@ [=value (anti-quote value)] (wrap [slot =value])))) pairs)] - (wrap [meta (#RecordS =pairs)])) + (wrap [meta (#Record =pairs)])) _ (:: Monad<Lux> return token) @@ -5410,7 +5410,7 @@ _ false)))} (case tokens - (^ (list& [_ (#FormS (list pattern))] body branches)) + (^ (list& [_ (#Form (list pattern))] body branches)) (do Monad<Lux> [module-name current-module-name pattern+ (macro-expand-all pattern)] @@ -5432,7 +5432,7 @@ (def: (case-level^ level) (-> AST (Lux [AST AST])) (case level - (^ [_ (#;TupleS (list expr binding))]) + (^ [_ (#;Tuple (list expr binding))]) (return [expr binding]) _ @@ -5483,7 +5483,7 @@ _ (#;Left (format "Static part " (%t static) " does not match URI: " uri))))} (case tokens - (^ (list& [_meta (#;FormS levels)] body next-branches)) + (^ (list& [_meta (#;Form levels)] body next-branches)) (do Monad<Lux> [mlc (multi-level-case^ levels) expected get-expected-type @@ -5515,7 +5515,7 @@ (^template [<tag>] (^ (list [_ (<tag> [prefix name])])) (return (list (` [(~ (text$ prefix)) (~ (text$ name))])))) - ([#;SymbolS] [#;TagS]) + ([#;Symbol] [#;Tag]) _ (fail "Wrong syntax for ident-for"))) @@ -5563,7 +5563,7 @@ empty) list)))} (case tokens - (^ (list [_ (#NatS idx)])) + (^ (list [_ (#Nat idx)])) (do Monad<Lux> [stvs get-scope-type-vars] (case (list-at idx (reverse stvs)) @@ -5594,7 +5594,7 @@ +0 (to-list set))))} (case tokens - (^ (list& [_meta (#;FormS (list [_ (#;SymbolS ["" name])] pattern))] body branches)) + (^ (list& [_meta (#;Form (list [_ (#;Symbol ["" name])] pattern))] body branches)) (let [g!whole (symbol$ ["" name])] (return (list& g!whole (` (case (~ g!whole) (~ pattern) (~ body))) @@ -5609,7 +5609,7 @@ (^|> value [n.inc (n.% +10) (n.max +1)]) (foo value)))} (case tokens - (^ (list& [_meta (#;FormS (list [_ (#;SymbolS ["" name])] [_ (#;TupleS steps)]))] body branches)) + (^ (list& [_meta (#;Form (list [_ (#;Symbol ["" name])] [_ (#;Tuple steps)]))] body branches)) (let [g!name (symbol$ ["" name])] (return (list& g!name (` (let [(~ g!name) (|> (~ g!name) (~@ steps))] @@ -5652,7 +5652,7 @@ "==" Int)} (case tokens - (^ (list [_ (#;SymbolS var-name)])) + (^ (list [_ (#;Symbol var-name)])) (do Monad<Lux> [var-type (find-type var-name)] (wrap (list (type-to-ast var-type)))) @@ -5667,10 +5667,10 @@ (def: (parse-export-level tokens) (-> (List AST) (Lux [(Maybe Export-Level') (List AST)])) (case tokens - (^ (list& [_ (#TagS ["" "export"])] tokens')) + (^ (list& [_ (#Tag ["" "export"])] tokens')) (:: Monad<Lux> wrap [(#;Some #Export) tokens']) - (^ (list& [_ (#TagS ["" "hidden"])] tokens')) + (^ (list& [_ (#Tag ["" "hidden"])] tokens')) (:: Monad<Lux> wrap [(#;Some #Hidden) tokens']) _ @@ -5693,12 +5693,12 @@ (def: (parse-complex-declaration tokens) (-> (List AST) (Lux [[Text (List Text)] (List AST)])) (case tokens - (^ (list& [_ (#FormS (list& [_ (#SymbolS ["" name])] args'))] tokens')) + (^ (list& [_ (#Form (list& [_ (#Symbol ["" name])] args'))] tokens')) (do Monad<Lux> [args (mapM Monad<Lux> (function [arg'] (case arg' - [_ (#SymbolS ["" arg-name])] + [_ (#Symbol ["" arg-name])] (wrap arg-name) _ @@ -5733,7 +5733,7 @@ (def: (parse-anns tokens) (-> (List AST) (Lux [AST (List AST)])) (case tokens - (^ (list& [_ (#RecordS _anns)] tokens')) + (^ (list& [_ (#Record _anns)] tokens')) (:: Monad<Lux> wrap [(record$ _anns) tokens']) _ diff --git a/stdlib/source/lux/control/comonad.lux b/stdlib/source/lux/control/comonad.lux index abf281a0a..12e16655e 100644 --- a/stdlib/source/lux/control/comonad.lux +++ b/stdlib/source/lux/control/comonad.lux @@ -32,14 +32,14 @@ [inputs (iterate i.inc 2)] (square (head inputs)))))} (case tokens - (#;Cons comonad (#;Cons [_ (#;TupleS bindings)] (#;Cons body #;Nil))) - (let [g!map (: AST [_cursor (#;SymbolS ["" " map "])]) - g!split (: AST [_cursor (#;SymbolS ["" " split "])]) + (#;Cons comonad (#;Cons [_ (#;Tuple bindings)] (#;Cons body #;Nil))) + (let [g!map (: AST [_cursor (#;Symbol ["" " map "])]) + g!split (: AST [_cursor (#;Symbol ["" " split "])]) body' (fold (: (-> [AST AST] AST AST) (function [binding body'] (let [[var value] binding] (case var - [_ (#;TagS ["" "let"])] + [_ (#;Tag ["" "let"])] (` (let (~ value) (~ body'))) _ diff --git a/stdlib/source/lux/control/monad.lux b/stdlib/source/lux/control/monad.lux index 22be3fcd5..0fce26db0 100644 --- a/stdlib/source/lux/control/monad.lux +++ b/stdlib/source/lux/control/monad.lux @@ -58,15 +58,15 @@ z (f2 z)] (wrap (f3 z))))} (case tokens - (#;Cons monad (#;Cons [_ (#;TupleS bindings)] (#;Cons body #;Nil))) - (let [g!map (: AST [_cursor (#;SymbolS ["" " map "])]) - g!join (: AST [_cursor (#;SymbolS ["" " join "])]) - g!apply (: AST [_cursor (#;SymbolS ["" " apply "])]) + (#;Cons monad (#;Cons [_ (#;Tuple bindings)] (#;Cons body #;Nil))) + (let [g!map (: AST [_cursor (#;Symbol ["" " map "])]) + g!join (: AST [_cursor (#;Symbol ["" " join "])]) + g!apply (: AST [_cursor (#;Symbol ["" " apply "])]) body' (fold (: (-> [AST AST] AST AST) (function [binding body'] (let [[var value] binding] (case var - [_ (#;TagS ["" "let"])] + [_ (#;Tag ["" "let"])] (` (let (~ value) (~ body'))) _ diff --git a/stdlib/source/lux/data/coll/list.lux b/stdlib/source/lux/data/coll/list.lux index 2aeb621d3..e4add4dec 100644 --- a/stdlib/source/lux/data/coll/list.lux +++ b/stdlib/source/lux/data/coll/list.lux @@ -334,7 +334,7 @@ ## [Syntax] (def: (symbol$ name) (-> Text AST) - [["" +0 +0] (#;SymbolS "" name)]) + [["" +0 +0] (#;Symbol "" name)]) (macro: #export (zip tokens state) {#;doc (doc "Create list zippers with the specified number of input lists." @@ -342,7 +342,7 @@ (def: #export zip3 (zip 3)) ((zip 3) xs ys zs))} (case tokens - (^ (list [_ (#;IntS num-lists)])) + (^ (list [_ (#;Int num-lists)])) (if (i.> 0 num-lists) (let [(^open) Functor<List> indices (i.range 0 (i.dec num-lists)) @@ -385,7 +385,7 @@ (def: #export zip3-with (zip-with 3)) ((zip-with 2) i.+ xs ys))} (case tokens - (^ (list [_ (#;IntS num-lists)])) + (^ (list [_ (#;Int num-lists)])) (if (i.> 0 num-lists) (let [(^open) Functor<List> indices (i.range 0 (i.dec num-lists)) diff --git a/stdlib/source/lux/data/format/json.lux b/stdlib/source/lux/data/format/json.lux index 41e5bfe5c..41654d93d 100644 --- a/stdlib/source/lux/data/format/json.lux +++ b/stdlib/source/lux/data/format/json.lux @@ -77,23 +77,23 @@ (^template [<ast-tag> <ctor> <json-tag>] [_ (<ast-tag> value)] (wrap (list (` (: JSON (<json-tag> (~ (<ctor> value)))))))) - ([#;BoolS ast;bool #Boolean] - [#;IntS (|>. int-to-real ast;real) #Number] - [#;RealS ast;real #Number] - [#;TextS ast;text #String]) + ([#;Bool ast;bool #Boolean] + [#;Int (|>. int-to-real ast;real) #Number] + [#;Real ast;real #Number] + [#;Text ast;text #String]) - [_ (#;TagS ["" "null"])] + [_ (#;Tag ["" "null"])] (wrap (list (` (: JSON #Null)))) - [_ (#;TupleS members)] + [_ (#;Tuple members)] (wrap (list (` (: JSON (#Array (vector (~@ (List/map wrapper members)))))))) - [_ (#;RecordS pairs)] + [_ (#;Record pairs)] (do Monad<Lux> [pairs' (mapM @ (function [[slot value]] (case slot - [_ (#;TextS key-name)] + [_ (#;Text key-name)] (wrap (` [(~ (ast;text key-name)) (~ (wrapper value))])) _ diff --git a/stdlib/source/lux/data/number.lux b/stdlib/source/lux/data/number.lux index cdc4d6035..0468a9f40 100644 --- a/stdlib/source/lux/data/number.lux +++ b/stdlib/source/lux/data/number.lux @@ -554,22 +554,22 @@ [(macro: #export (<macro> tokens state) {#;doc <doc>} (case tokens - (#;Cons [meta (#;TextS repr)] #;Nil) + (#;Cons [meta (#;Text repr)] #;Nil) (case (:: <nat> decode repr) (#;Right value) - (#;Right [state (list [meta (#;NatS value)])]) + (#;Right [state (list [meta (#;Nat value)])]) (^=> (#;Left _) [(:: <int> decode repr) (#;Right value)]) - (#;Right [state (list [meta (#;IntS value)])]) + (#;Right [state (list [meta (#;Int value)])]) (^=> (#;Left _) [(:: <deg> decode repr) (#;Right value)]) - (#;Right [state (list [meta (#;DegS value)])]) + (#;Right [state (list [meta (#;Deg value)])]) (^=> (#;Left _) [(:: <real> decode repr) (#;Right value)]) - (#;Right [state (list [meta (#;RealS value)])]) + (#;Right [state (list [meta (#;Real value)])]) _ (#;Left <error>)) diff --git a/stdlib/source/lux/host.jvm.lux b/stdlib/source/lux/host.jvm.lux index 0552df165..5efeb05c5 100644 --- a/stdlib/source/lux/host.jvm.lux +++ b/stdlib/source/lux/host.jvm.lux @@ -557,14 +557,14 @@ (^template [<tag>] [meta (<tag> parts)] [meta (<tag> (map (pre-walk-replace f) parts))]) - ([#;FormS] - [#;TupleS]) + ([#;Form] + [#;Tuple]) - [meta (#;RecordS pairs)] - [meta (#;RecordS (map (: (-> [AST AST] [AST AST]) - (function [[key val]] - [(pre-walk-replace f key) (pre-walk-replace f val)])) - pairs))] + [meta (#;Record pairs)] + [meta (#;Record (map (: (-> [AST AST] [AST AST]) + (function [[key val]] + [(pre-walk-replace f key) (pre-walk-replace f val)])) + pairs))] ast' ast')) @@ -2026,7 +2026,7 @@ {#;doc (doc "Loads an element from an array." (array-load 10 my-array))} (case array - [_ (#;SymbolS array-name)] + [_ (#;Symbol array-name)] (do Monad<Lux> [array-type (macro;find-type array-name) array-jvm-type (type->class-name array-type)] @@ -2055,7 +2055,7 @@ {#;doc (doc "Stores an element into an array." (array-store 10 my-object my-array))} (case array - [_ (#;SymbolS array-name)] + [_ (#;Symbol array-name)] (do Monad<Lux> [array-type (macro;find-type array-name) array-jvm-type (type->class-name array-type)] diff --git a/stdlib/source/lux/io.lux b/stdlib/source/lux/io.lux index d538fbfef..00f16afce 100644 --- a/stdlib/source/lux/io.lux +++ b/stdlib/source/lux/io.lux @@ -19,7 +19,7 @@ "Some value...")))} (case tokens (^ (list value)) - (let [blank (: AST [["" +0 +0] (#;SymbolS ["" ""])])] + (let [blank (: AST [["" +0 +0] (#;Symbol ["" ""])])] (#;Right [state (list (` (;_lux_function (~ blank) (~ blank) (~ value))))])) _ diff --git a/stdlib/source/lux/macro.lux b/stdlib/source/lux/macro.lux index 9965a0677..5ac4a524e 100644 --- a/stdlib/source/lux/macro.lux +++ b/stdlib/source/lux/macro.lux @@ -278,7 +278,7 @@ Otherwise, returns the code as-is."} (-> AST (Lux (List AST))) (case syntax - [_ (#;FormS (#;Cons [[_ (#;SymbolS macro-name)] args]))] + [_ (#;Form (#;Cons [[_ (#;Symbol macro-name)] args]))] (do Monad<Lux> [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -298,7 +298,7 @@ Otherwise, returns the code as-is."} (-> AST (Lux (List AST))) (case syntax - [_ (#;FormS (#;Cons [[_ (#;SymbolS macro-name)] args]))] + [_ (#;Form (#;Cons [[_ (#;Symbol macro-name)] args]))] (do Monad<Lux> [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -319,7 +319,7 @@ {#;doc "Expands all macro-calls everywhere recursively, until only primitive/base code remains."} (-> AST (Lux (List AST))) (case syntax - [_ (#;FormS (#;Cons [[_ (#;SymbolS macro-name)] args]))] + [_ (#;Form (#;Cons [[_ (#;Symbol macro-name)] args]))] (do Monad<Lux> [macro-name' (normalize macro-name) ?macro (find-macro macro-name')] @@ -335,13 +335,13 @@ [parts' (mapM Monad<Lux> macro-expand-all (list& (ast;symbol macro-name) args))] (wrap (list (ast;form (:: Monad<List> join parts'))))))) - [_ (#;FormS (#;Cons [harg targs]))] + [_ (#;Form (#;Cons [harg targs]))] (do Monad<Lux> [harg+ (macro-expand-all harg) targs+ (mapM Monad<Lux> macro-expand-all targs)] (wrap (list (ast;form (List/append harg+ (:: Monad<List> join (: (List (List AST)) targs+))))))) - [_ (#;TupleS members)] + [_ (#;Tuple members)] (do Monad<Lux> [members' (mapM Monad<Lux> macro-expand-all members)] (wrap (list (ast;tuple (:: Monad<List> join members'))))) @@ -361,7 +361,7 @@ (def: (get-local-symbol ast) (-> AST (Lux Text)) (case ast - [_ (#;SymbolS [_ name])] + [_ (#;Symbol [_ name])] (:: Monad<Lux> wrap name) _ @@ -378,7 +378,7 @@ (~ g!body))))) )))} (case tokens - (^ (list [_ (#;TupleS symbols)] body)) + (^ (list [_ (#;Tuple symbols)] body)) (do Monad<Lux> [symbol-names (mapM @ get-local-symbol symbols) #let [symbol-defs (List/join (List/map (: (-> Text (List AST)) @@ -628,7 +628,7 @@ (-> Int Int Int) (i.+ bar baz))))} (case tokens - (^ (list [_ (#;TagS ["" "omit"])] + (^ (list [_ (#;Tag ["" "omit"])] token)) (do Monad<Lux> [output (<func> token) diff --git a/stdlib/source/lux/macro/ast.lux b/stdlib/source/lux/macro/ast.lux index 4fd9c8b2c..ac65155e4 100644 --- a/stdlib/source/lux/macro/ast.lux +++ b/stdlib/source/lux/macro/ast.lux @@ -11,17 +11,17 @@ ## [Types] ## (type: (AST' w) -## (#;BoolS Bool) -## (#;NatS Nat) -## (#;IntS Int) -## (#;RealS Real) -## (#;CharS Char) -## (#;TextS Text) -## (#;SymbolS Text Text) -## (#;TagS Text Text) -## (#;FormS (List (w (AST' w)))) -## (#;TupleS (List (w (AST' w)))) -## (#;RecordS (List [(w (AST' w)) (w (AST' w))]))) +## (#;Bool Bool) +## (#;Nat Nat) +## (#;Int Int) +## (#;Real Real) +## (#;Char Char) +## (#;Text Text) +## (#;Symbol Text Text) +## (#;Tag Text Text) +## (#;Form (List (w (AST' w)))) +## (#;Tuple (List (w (AST' w)))) +## (#;Record (List [(w (AST' w)) (w (AST' w))]))) ## (type: AST ## (Meta Cursor (AST' (Meta Cursor)))) @@ -35,18 +35,18 @@ (-> <type> AST) [_cursor (<tag> x)])] - [bool Bool #;BoolS] - [nat Nat #;NatS] - [int Int #;IntS] - [deg Deg #;DegS] - [real Real #;RealS] - [char Char #;CharS] - [text Text #;TextS] - [symbol Ident #;SymbolS] - [tag Ident #;TagS] - [form (List AST) #;FormS] - [tuple (List AST) #;TupleS] - [record (List [AST AST]) #;RecordS] + [bool Bool #;Bool] + [nat Nat #;Nat] + [int Int #;Int] + [deg Deg #;Deg] + [real Real #;Real] + [char Char #;Char] + [text Text #;Text] + [symbol Ident #;Symbol] + [tag Ident #;Tag] + [form (List AST) #;Form] + [tuple (List AST) #;Tuple] + [record (List [AST AST]) #;Record] ) (do-template [<name> <tag> <doc>] @@ -55,8 +55,8 @@ (-> Text AST) [_cursor (<tag> ["" name])])] - [local-symbol #;SymbolS "Produces a local symbol (a symbol with no module prefix)."] - [local-tag #;TagS "Produces a local tag (a tag with no module prefix)."]) + [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)."]) ## [Structures] (struct: #export _ (Eq AST) @@ -65,15 +65,15 @@ (^template [<tag> <eq>] [[_ (<tag> x')] [_ (<tag> y')]] (:: <eq> = x' y')) - ([#;BoolS Eq<Bool>] - [#;NatS Eq<Nat>] - [#;IntS Eq<Int>] - [#;DegS Eq<Deg>] - [#;RealS Eq<Real>] - [#;CharS char;Eq<Char>] - [#;TextS Eq<Text>] - [#;SymbolS Eq<Ident>] - [#;TagS Eq<Ident>]) + ([#;Bool Eq<Bool>] + [#;Nat Eq<Nat>] + [#;Int Eq<Int>] + [#;Deg Eq<Deg>] + [#;Real Eq<Real>] + [#;Char char;Eq<Char>] + [#;Text Eq<Text>] + [#;Symbol Eq<Ident>] + [#;Tag Eq<Ident>]) (^template [<tag>] [[_ (<tag> xs')] [_ (<tag> ys')]] @@ -82,10 +82,10 @@ (and old (= x' y'))) true (zip2 xs' ys')))) - ([#;FormS] - [#;TupleS]) + ([#;Form] + [#;Tuple]) - [[_ (#;RecordS xs')] [_ (#;RecordS ys')]] + [[_ (#;Record xs')] [_ (#;Record ys')]] (and (:: Eq<Nat> = (size xs') (size ys')) (fold (function [[[xl' xr'] [yl' yr']] old] (and old (= xl' yl') (= xr' yr'))) @@ -102,25 +102,25 @@ (^template [<tag> <struct>] [_ (<tag> value)] (:: <struct> encode value)) - ([#;BoolS Codec<Text,Bool>] - [#;NatS Codec<Text,Nat>] - [#;IntS Codec<Text,Int>] - [#;DegS Codec<Text,Deg>] - [#;RealS Codec<Text,Real>] - [#;CharS char;Codec<Text,Char>] - [#;TextS text;Codec<Text,Text>] - [#;SymbolS Codec<Text,Ident>]) - - [_ (#;TagS ident)] + ([#;Bool Codec<Text,Bool>] + [#;Nat Codec<Text,Nat>] + [#;Int Codec<Text,Int>] + [#;Deg Codec<Text,Deg>] + [#;Real Codec<Text,Real>] + [#;Char char;Codec<Text,Char>] + [#;Text text;Codec<Text,Text>] + [#;Symbol Codec<Text,Ident>]) + + [_ (#;Tag ident)] (Text/append "#" (:: Codec<Text,Ident> encode ident)) (^template [<tag> <open> <close>] [_ (<tag> members)] ($_ Text/append <open> (|> members (map to-text) (interpose " ") (text;join-with "")) <close>)) - ([#;FormS "(" ")"] - [#;TupleS "[" "]"]) + ([#;Form "(" ")"] + [#;Tuple "[" "]"]) - [_ (#;RecordS pairs)] + [_ (#;Record pairs)] ($_ Text/append "{" (|> pairs (map (function [[left right]] ($_ Text/append (to-text left) " " (to-text right)))) (interpose " ") (text;join-with "")) "}") )) @@ -133,14 +133,14 @@ (^template [<tag>] [cursor (<tag> parts)] [cursor (<tag> (map (replace original substitute) parts))]) - ([#;FormS] - [#;TupleS]) - - [cursor (#;RecordS parts)] - [cursor (#;RecordS (map (function [[left right]] - [(replace original substitute left) - (replace original substitute right)]) - parts))] + ([#;Form] + [#;Tuple]) + + [cursor (#;Record parts)] + [cursor (#;Record (map (function [[left right]] + [(replace original substitute left) + (replace original substitute right)]) + parts))] _ ast))) diff --git a/stdlib/source/lux/macro/syntax.lux b/stdlib/source/lux/macro/syntax.lux index 652130b97..e2cbde491 100644 --- a/stdlib/source/lux/macro/syntax.lux +++ b/stdlib/source/lux/macro/syntax.lux @@ -97,15 +97,15 @@ _ (#;Left ($_ Text/append "Cannot parse " <desc> (remaining-inputs tokens))))))] - [ bool Bool #;BoolS bool;Eq<Bool> "bool"] - [ nat Nat #;NatS number;Eq<Nat> "nat"] - [ int Int #;IntS number;Eq<Int> "int"] - [ deg Deg #;DegS number;Eq<Deg> "deg"] - [ real Real #;RealS number;Eq<Real> "real"] - [ char Char #;CharS char;Eq<Char> "char"] - [ text Text #;TextS text;Eq<Text> "text"] - [symbol Ident #;SymbolS ident;Eq<Ident> "symbol"] - [ tag Ident #;TagS ident;Eq<Ident> "tag"] + [ bool Bool #;Bool bool;Eq<Bool> "bool"] + [ nat Nat #;Nat number;Eq<Nat> "nat"] + [ int Int #;Int number;Eq<Int> "int"] + [ deg Deg #;Deg number;Eq<Deg> "deg"] + [ real Real #;Real number;Eq<Real> "real"] + [ char Char #;Char char;Eq<Char> "char"] + [ text Text #;Text text;Eq<Text> "text"] + [symbol Ident #;Symbol ident;Eq<Ident> "symbol"] + [ tag Ident #;Tag ident;Eq<Ident> "tag"] ) (def: #export (this? ast) @@ -169,8 +169,8 @@ _ (#;Left ($_ Text/append "Cannot parse local " <desc> (remaining-inputs tokens))))))] - [local-symbol #;SymbolS "symbol"] - [ local-tag #;TagS "tag"] + [local-symbol #;Symbol "symbol"] + [ local-tag #;Tag "tag"] ) (do-template [<name> <tag> <desc>] @@ -188,8 +188,8 @@ _ (#;Left ($_ Text/append "Cannot parse " <desc> (remaining-inputs tokens))))))] - [ form #;FormS "form"] - [tuple #;TupleS "tuple"] + [ form #;Form "form"] + [tuple #;Tuple "tuple"] ) (def: #export (record p) @@ -198,7 +198,7 @@ (-> (Syntax a) (Syntax a))) (function [tokens] (case tokens - (#;Cons [[_ (#;RecordS pairs)] tokens']) + (#;Cons [[_ (#;Record pairs)] tokens']) (case (p (join-pairs pairs)) (#;Right [#;Nil x]) (#;Right [tokens' x]) _ (#;Left ($_ Text/append "Syntax was expected to fully consume record" (remaining-inputs tokens)))) @@ -431,21 +431,21 @@ (with-brackets (spaced (map (method-def$ id) methods))))))] (wrap (list (` (;_lux_proc ["jvm" (~ (ast;text def-code))] [])))))))} (let [[exported? tokens] (case tokens - (^ (list& [_ (#;TagS ["" "hidden"])] tokens')) + (^ (list& [_ (#;Tag ["" "hidden"])] tokens')) [(#;Some #;Left) tokens'] - (^ (list& [_ (#;TagS ["" "export"])] tokens')) + (^ (list& [_ (#;Tag ["" "export"])] tokens')) [(#;Some #;Right) tokens'] _ [#;None tokens]) ?parts (: (Maybe [Text (List AST) AST AST]) (case tokens - (^ (list [_ (#;FormS (list& [_ (#;SymbolS ["" name])] args))] + (^ (list [_ (#;Form (list& [_ (#;Symbol ["" name])] args))] body)) (#;Some name args (` {}) body) - (^ (list [_ (#;FormS (list& [_ (#;SymbolS ["" name])] args))] + (^ (list [_ (#;Form (list& [_ (#;Symbol ["" name])] args))] meta-data body)) (#;Some name args meta-data body) @@ -460,10 +460,10 @@ (: (-> AST (Lux [AST AST])) (function [arg] (case arg - (^ [_ (#;TupleS (list var parser))]) + (^ [_ (#;Tuple (list var parser))]) (wrap [var parser]) - [_ (#;SymbolS var-name)] + [_ (#;Symbol var-name)] (wrap [(ast;symbol var-name) (` any)]) _ diff --git a/stdlib/source/lux/type/auto.lux b/stdlib/source/lux/type/auto.lux index bb1ecc1c6..6a2991fa5 100644 --- a/stdlib/source/lux/type/auto.lux +++ b/stdlib/source/lux/type/auto.lux @@ -285,7 +285,7 @@ (def: (var? input) (-> AST Bool) (case input - [_ (#;SymbolS _)] + [_ (#;Symbol _)] true _ diff --git a/stdlib/test/test/lux/macro/syntax.lux b/stdlib/test/test/lux/macro/syntax.lux index 19607f16e..f523f227c 100644 --- a/stdlib/test/test/lux/macro/syntax.lux +++ b/stdlib/test/test/lux/macro/syntax.lux @@ -139,7 +139,7 @@ (test: "Combinators [Part 1]" ($_ seq (assert "Can parse any AST." - (match [_ (#;BoolS true)] + (match [_ (#;Bool true)] (s;run (list (ast;bool true) (ast;int 123)) s;any))) |