Purple
0.1
Standard Language Specification
|
Logic for parsing statements into an AST. More...
Functions | |
void | match_token (TokenType type) |
Ensure current token is of a given type, and scan the next token if so. More... | |
TokenType | match_tokens (TokenType types[], int n_types) |
int | match_type (Number *out) |
Matches a valid type in the input stream. More... | |
TokenType | check_for_type (void) |
Ensure current token is a type token, and scan the next token if so. More... | |
static ASTNode * | print_statement (void) |
Parse a print statement into an AST. More... | |
static ASTNode * | assignment_statement (void) |
Parse an assignment statement into an AST. More... | |
static ASTNode * | if_statement (void) |
Parse an if statement into an AST. More... | |
static ASTNode * | while_statement (void) |
Parse a while statement into an AST. More... | |
static ASTNode * | for_statement (void) |
Parse a for statement into an AST. More... | |
static ASTNode * | return_statement (void) |
ASTNode * | parse_statements (void) |
Parse a set of statements into ASTs and generate them into an AST. More... | |
Logic for parsing statements into an AST.
|
static |
Parse an assignment statement into an AST.
TokenType check_for_type | ( | void | ) |
Ensure current token is a type token, and scan the next token if so.
|
static |
Parse a for statement into an AST.
|
static |
Parse an if statement into an AST.
void match_token | ( | TokenType | type | ) |
Ensure current token is of a given type, and scan the next token if so.
type | TokenType to ensure |
int match_type | ( | Number * | out | ) |
Matches a valid type in the input stream.
out | Pointer to Number struct to fill with parsed data |
ASTNode * parse_statements | ( | void | ) |
Parse a set of statements into ASTs and generate them into an AST.
|
static |
Parse a print statement into an AST.
|
static |
|
static |
Parse a while statement into an AST.