From 08eb05f23914194c3adcc141664d4c2d7d88978c Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sun, 7 May 2017 15:26:09 -0400 Subject: - Renamed "AST" to "Code". --- new-luxc/source/luxc/parser.lux | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) (limited to 'new-luxc/source/luxc/parser.lux') 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 [ ] [(def: #export ( where) - (-> Cursor (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) (do Monad [chunk ] (case (:: 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 [[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 [## 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 [ ] [(def: ( where parse-ast) (-> Cursor - (-> Cursor (Lexer [Cursor AST])) - (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) + (Lexer [Cursor Code])) (do Monad [_ (l;text ) - [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 [_ (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 [ ] [(def: #export ( where) - (-> Cursor (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) (do Monad [[value length] ] (wrap [(update@ #;column (|>. ($_ n.+ length)) where) @@ -509,7 +509,7 @@ ) (def: (parse-ast where) - (-> Cursor (Lexer [Cursor AST])) + (-> Cursor (Lexer [Cursor Code])) (do Monad [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) -- cgit v1.2.3