Gymbo

Classes | Namespaces | Enumerations | Functions | Variables
parser.h File Reference

Implementation of parser. More...

`#include <vector>`
`#include "tokenizer.h"`
Include dependency graph for parser.h:
This graph shows which files directly or indirectly include this file:

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...

## Detailed Description

Implementation of parser.

Author
  Hideaki Takahashi

## Variable Documentation

## ◆ LETTER_AND

char LETTER_AND[] = "&&"

Array representing the logical AND operator "&&".

## ◆ LETTER_DIV

char LETTER_DIV[] = "/"

Array representing the division operator "/".

## ◆ LETTER_ELSE

char LETTER_ELSE[] = "else"

Array representing the keyword "else".

## ◆ LETTER_EQ

char LETTER_EQ[] = "=="

Array representing the equality operator "==".

## ◆ LETTER_GEQ

char LETTER_GEQ[] = ">="

Array representing the greater than or equal to operator ">=".

## ◆ LETTER_GQ

char LETTER_GQ[] = ">"

Array representing the greater than operator ">".

## ◆ LETTER_LB

char LETTER_LB[] = "{"

Array representing the left brace "{".

## ◆ LETTER_LEQ

char LETTER_LEQ[] = "<="

Array representing the less than or equal to operator "<=".

## ◆ LETTER_LP

char LETTER_LP[] = "("

Array representing the left parenthesis "(".

## ◆ LETTER_LQ

char LETTER_LQ[] = "<"

Array representing the less than operator "<".

## ◆ LETTER_MINUS

char LETTER_MINUS[] = "-"

Array representing the subtraction operator "-".

## ◆ LETTER_MUL

char LETTER_MUL[] = "*"

Array representing the multiplication operator "*".

## ◆ LETTER_NEQ

char LETTER_NEQ[] = "!="

Array representing the inequality operator "!=".

## ◆ LETTER_NOT

char LETTER_NOT[] = "!"

Array representing the logical NOT operator "!".

## ◆ LETTER_OR

char LETTER_OR[] = "||"

Array representing the logical OR operator "||".

## ◆ LETTER_PLUS

char LETTER_PLUS[] = "+"

Array representing the addition operator "+".

## ◆ LETTER_RB

char LETTER_RB[] = "}"

Array representing the right brace "}".

## ◆ LETTER_RP

char LETTER_RP[] = ")"

Array representing the right parenthesis ")".

## ◆ LETTER_SC

char LETTER_SC[] = ";"

Array representing the semicolon ";".