ExC v0.4.0 Parser View Source
Parses the Output Token List (OTL) from Lexer.tokenize/1
into an Output
Abstract Syntax Tree (OAST).
Link to this section Summary
Functions
Returns a tuple containing a status token, the Output Abstract Syntax Tree (OAST),
Link to this section Functions
Returns a tuple containing a status token, the Output Abstract Syntax Tree (OAST),
a token list and a possible error cause.
Specs
```otl``` is the Output Token List which is a list of the tokens found in the
source code string. This list is generated by the [`Lexer`](Lexer.html) in [`Lexer.tokenize/1`](Lexer.html#tokenize/1).
```gast``` is a General Abstract Syntax Tree which is list of [`Structs.Node`](Structs.Node.html)
that contains the source language grammar production rules.
Returns the following elements:
+ ```status_atom``` : indicates if the parsing could be completed successfully.
If not, then the following error tokens are returned:
+ ```:token_missing_error``` : thrown when the source code is missing
something or the order of the tokens is not correct. For example:
```
int main() {
2;
}
```
where the token ```return```is missing.
+ ```:token_not_absorbed``` : thrown when the structure is correct but it
has an extra token. For example:
```
int main() {
return 2;
} main
```
where the token ```main```is unnecessary.
output_ast
: abstract syntax tree representing the source code.token_list
: token list found in the source code.error_cause
: description of the error cause.