|
Gymbo
|
Implementation of parser. More...


Go to the source code of this file.
Classes | |
| struct | gymbo::Node |
| Structure representing a node in the Abstract Syntax Tree (AST). More... | |
Namespaces | |
| gymbo | |
Enumerations | |
| enum | gymbo::NodeKind { gymbo::ND_ADD , gymbo::ND_SUB , gymbo::ND_MUL , gymbo::ND_DIV , gymbo::ND_AND , gymbo::ND_OR , gymbo::ND_NOT , gymbo::ND_EQ , gymbo::ND_NE , gymbo::ND_LT , gymbo::ND_LE , gymbo::ND_ASSIGN , gymbo::ND_LVAR , gymbo::ND_NUM , gymbo::ND_RETURN , gymbo::ND_IF , gymbo::ND_FOR , gymbo::ND_BLOCK } |
| Enumeration representing different node kinds in the Abstract Syntax Tree (AST). More... | |
Functions | |
| Node * | gymbo::assign (Token *&token, char *user_input) |
| Parses an assignment statement from a C-like language program. More... | |
| Node * | gymbo::expr (Token *&token, char *user_input) |
| Parses an expression from a C-like language program. More... | |
| Node * | gymbo::equality (Token *&token, char *user_input) |
| Parses an equality expression from a C-like language program. More... | |
| Node * | gymbo::relational (Token *&token, char *user_input) |
| Parses a relational expression from a C-like language program. More... | |
| Node * | gymbo::logical (Token *&token, char *user_input) |
| Parses a logical expression from a C-like language program. More... | |
| Node * | gymbo::add (Token *&token, char *user_input) |
| Parse and construct an AST node representing addition or subtraction. More... | |
| Node * | gymbo::mul (Token *&token, char *user_input) |
| Parse and construct an AST node representing multiplication or division. More... | |
| Node * | gymbo::unary (Token *&token, char *user_input) |
| Parse and construct an AST node representing unary operations. More... | |
| Node * | gymbo::primary (Token *&token, char *user_input) |
| Parse and construct an AST node representing primary expressions. More... | |
| Node * | gymbo::stmt (Token *&token, char *user_input) |
| Parse and construct an AST node representing a statement. More... | |
| Node * | gymbo::new_node (NodeKind kind) |
| Create a new AST node with the given kind. More... | |
| Node * | gymbo::new_binary (NodeKind kind, Node *lhs, Node *rhs) |
| Create a new binary AST node with the given kind, left-hand side, and right-hand side. More... | |
| Node * | gymbo::new_num (float val) |
| Create a new AST node representing a numeric value with the given value. More... | |
| void | gymbo::generate_ast (Token *&token, char *user_input, std::vector< Node * > &code) |
| Parses a C-like language program into an AST. More... | |
Variables | |
| char | LETTER_EQ [] = "==" |
| Array representing the equality operator "==". More... | |
| char | LETTER_NEQ [] = "!=" |
| Array representing the inequality operator "!=". More... | |
| char | LETTER_LQ [] = "<" |
| Array representing the less than operator "<". More... | |
| char | LETTER_LEQ [] = "<=" |
| Array representing the less than or equal to operator "<=". More... | |
| char | LETTER_GQ [] = ">" |
| Array representing the greater than operator ">". More... | |
| char | LETTER_GEQ [] = ">=" |
| Array representing the greater than or equal to operator ">=". More... | |
| char | LETTER_PLUS [] = "+" |
| Array representing the addition operator "+". More... | |
| char | LETTER_MINUS [] = "-" |
| Array representing the subtraction operator "-". More... | |
| char | LETTER_MUL [] = "*" |
| Array representing the multiplication operator "*". More... | |
| char | LETTER_DIV [] = "/" |
| Array representing the division operator "/". More... | |
| char | LETTER_AND [] = "&&" |
| Array representing the logical AND operator "&&". More... | |
| char | LETTER_OR [] = "||" |
| Array representing the logical OR operator "||". More... | |
| char | LETTER_NOT [] = "!" |
| Array representing the logical NOT operator "!". More... | |
| char | LETTER_LP [] = "(" |
| Array representing the left parenthesis "(". More... | |
| char | LETTER_RP [] = ")" |
| Array representing the right parenthesis ")". More... | |
| char | LETTER_SC [] = ";" |
| Array representing the semicolon ";". More... | |
| char | LETTER_ELSE [] = "else" |
| Array representing the keyword "else". More... | |
| char | LETTER_LB [] = "{" |
| Array representing the left brace "{". More... | |
| char | LETTER_RB [] = "}" |
| Array representing the right brace "}". More... | |
Implementation of parser.
| char LETTER_AND[] = "&&" |
Array representing the logical AND operator "&&".
| char LETTER_DIV[] = "/" |
Array representing the division operator "/".
| char LETTER_ELSE[] = "else" |
Array representing the keyword "else".
| char LETTER_EQ[] = "==" |
Array representing the equality operator "==".
| char LETTER_GEQ[] = ">=" |
Array representing the greater than or equal to operator ">=".
| char LETTER_GQ[] = ">" |
Array representing the greater than operator ">".
| char LETTER_LB[] = "{" |
Array representing the left brace "{".
| char LETTER_LEQ[] = "<=" |
Array representing the less than or equal to operator "<=".
| char LETTER_LP[] = "(" |
Array representing the left parenthesis "(".
| char LETTER_LQ[] = "<" |
Array representing the less than operator "<".
| char LETTER_MINUS[] = "-" |
Array representing the subtraction operator "-".
| char LETTER_MUL[] = "*" |
Array representing the multiplication operator "*".
| char LETTER_NEQ[] = "!=" |
Array representing the inequality operator "!=".
| char LETTER_NOT[] = "!" |
Array representing the logical NOT operator "!".
| char LETTER_OR[] = "||" |
Array representing the logical OR operator "||".
| char LETTER_PLUS[] = "+" |
Array representing the addition operator "+".
| char LETTER_RB[] = "}" |
Array representing the right brace "}".
| char LETTER_RP[] = ")" |
Array representing the right parenthesis ")".
| char LETTER_SC[] = ";" |
Array representing the semicolon ";".