diff options
Diffstat (limited to '')
-rw-r--r-- | new-luxc/source/luxc/analyser.lux | 38 | ||||
-rw-r--r-- | new-luxc/source/luxc/compiler.lux | 14 | ||||
-rw-r--r-- | new-luxc/source/luxc/parser.lux | 24 | ||||
-rw-r--r-- | new-luxc/test/test/luxc/parser.lux | 24 |
4 files changed, 50 insertions, 50 deletions
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^)))))) |