diff options
author | Eduardo Julian | 2017-05-07 15:26:09 -0400 |
---|---|---|
committer | Eduardo Julian | 2017-05-07 15:26:09 -0400 |
commit | 08eb05f23914194c3adcc141664d4c2d7d88978c (patch) | |
tree | 73b61370c672f8b1a6bb9f7af429ef6a2617e9aa /new-luxc/source/luxc/parser.lux | |
parent | db697bb636e2341d26bb188cc1b9981a1ab505d7 (diff) |
- Renamed "AST" to "Code".
Diffstat (limited to 'new-luxc/source/luxc/parser.lux')
-rw-r--r-- | new-luxc/source/luxc/parser.lux | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/new-luxc/source/luxc/parser.lux b/new-luxc/source/luxc/parser.lux index 0115d1924..c9ba89b75 100644 --- a/new-luxc/source/luxc/parser.lux +++ b/new-luxc/source/luxc/parser.lux @@ -1,7 +1,7 @@ ## This is the LuxC's parser. ## It takes the source code of a Lux file in raw text form and ## extracts the syntactic structure of the code from it. -## It only produces Lux AST nodes, and thus removes any white-space +## It only produces Lux Code nodes, and thus removes any white-space ## and comments while processing its inputs. ## Another important aspect of the parser is that it keeps track of @@ -21,7 +21,7 @@ ## They are supposed to produce some parsed output, alongside an ## updated cursor pointing to the end position, after the parser was run. -## Lux AST nodes/tokens are annotated with cursor meta-data +## Lux Code nodes/tokens are annotated with cursor meta-data ## (file-name, line, column) to keep track of their provenance and ## location, which is helpful for documentation and debugging. @@ -139,7 +139,7 @@ (l;either (single-line-comment^ where) (multi-line-comment^ where))) -## To simplify parsing, I remove any left-padding that an AST token +## To simplify parsing, I remove any left-padding that an Code token ## may have prior to parsing the token itself. ## Left-padding is assumed to be either white-space or a comment. ## The cursor gets updated, but the padding gets ignored. @@ -208,7 +208,7 @@ ## standard library to actually produce the values from the literals. (do-template [<name> <tag> <lexer> <codec>] [(def: #export (<name> where) - (-> Cursor (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) (do Monad<Lexer> [chunk <lexer>] (case (:: <codec> decode chunk) @@ -249,7 +249,7 @@ ## This parser doesn't delegate the work of producing the value to a ## codec, since the raw-char^ parser already takes care of that magic. (def: #export (parse-char where) - (-> Cursor (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) (do Monad<Lexer> [[chunk value] (l;enclosed ["#\"" "\""] raw-char^)] @@ -259,7 +259,7 @@ ## This parser looks so complex because text in Lux can be multi-line ## and there are rules regarding how this is handled. (def: #export (parse-text where) - (-> Cursor (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) (do Monad<Lexer> [## Lux text "is delimited by double-quotes", as usual in most ## programming languages. @@ -346,15 +346,15 @@ ## Form and tuple syntax is mostly the same, differing only in the ## delimiters involved. -## They may have an arbitrary number of arbitrary AST nodes as elements. +## They may have an arbitrary number of arbitrary Code nodes as elements. (do-template [<name> <tag> <open> <close>] [(def: (<name> where parse-ast) (-> Cursor - (-> Cursor (Lexer [Cursor AST])) - (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) + (Lexer [Cursor Code])) (do Monad<Lexer> [_ (l;text <open>) - [where' elems] (loop [elems (: (V;Vector AST) + [where' elems] (loop [elems (: (V;Vector Code) V;empty) where where] (l;either (do @ @@ -384,16 +384,16 @@ ## Semantically, though, records and tuples are just 2 different ## representations for the same thing (a tuple). ## In normal Lux syntax, the key position in the pair will be a tag -## AST node, however, record AST nodes allow any AST node to occupy -## this position, since it may be useful when processing AST syntax in +## Code node, however, record Code nodes allow any Code node to occupy +## this position, since it may be useful when processing Code syntax in ## macros. (def: (parse-record where parse-ast) (-> Cursor - (-> Cursor (Lexer [Cursor AST])) - (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) + (Lexer [Cursor Code])) (do Monad<Lexer> [_ (l;text "{") - [where' elems] (loop [elems (: (V;Vector [AST AST]) + [where' elems] (loop [elems (: (V;Vector [Code Code]) V;empty) where where] (l;either (do @ @@ -428,7 +428,7 @@ ## possible). ## In particular, no white-space can be used, and neither can other ## characters which are already used by Lux as delimiters for other -## AST nodes (thereby reducing ambiguity while parsing). +## Code nodes (thereby reducing ambiguity while parsing). ## Additionally, the first character in an identifier's part cannot be ## a digit, to avoid confusion with regards to numbers. (def: ident-part^ @@ -498,7 +498,7 @@ ## construction and de-structuring (during pattern-matching). (do-template [<name> <tag> <lexer> <extra>] [(def: #export (<name> where) - (-> Cursor (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) (do Monad<Lexer> [[value length] <lexer>] (wrap [(update@ #;column (|>. ($_ n.+ <extra> length)) where) @@ -509,7 +509,7 @@ ) (def: (parse-ast where) - (-> Cursor (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) (do Monad<Lexer> [where (left-padding^ where)] ($_ l;either @@ -528,7 +528,7 @@ ))) (def: #export (parse [where code]) - (-> [Cursor Text] (Error [[Cursor Text] AST])) + (-> [Cursor Text] (Error [[Cursor Text] Code])) (case (l;run' code (parse-ast where)) (#E;Error error) (#E;Error error) |