diff options
author | Preston Pan <preston@nullring.xyz> | 2023-01-02 22:31:49 -0800 |
---|---|---|
committer | Preston Pan <preston@nullring.xyz> | 2023-01-02 22:31:49 -0800 |
commit | 64feef1b9ea72adf7ba32998e9dca7d507607498 (patch) | |
tree | a409e61877bb51aa6fb2477175dabbf3dbccf298 /src/include/parser.h |
a lot of stuff.
Diffstat (limited to 'src/include/parser.h')
-rw-r--r-- | src/include/parser.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/include/parser.h b/src/include/parser.h new file mode 100644 index 0000000..97a7fd9 --- /dev/null +++ b/src/include/parser.h @@ -0,0 +1,49 @@ +#ifndef PARSER_H +#define PARSER_H +#include "./ast.h" +#include "./hash_table.h" +#include "./lexer.h" +#include "./token.h" +#include <stdbool.h> +#include <stdio.h> + +typedef struct { + token_t **tokens; + hash_table_t *symbol_table; + int i; + int size; + bool finished; +} parser_t; + +parser_t *init_parser(lexer_t *lexer); + +void parser_error(parser_t *parser); + +void parser_move(parser_t *parser); + +void parser_eat(parser_t *parser, token_t *token); + +ast_t *parse_string(parser_t *parser); + +ast_t *parse_int(parser_t *parser); + +ast_t *parse_float(parser_t *parser); + +ast_t *parse_bool(parser_t *parser); + +ast_t *parse_list(parser_t *parser); + +ast_t *parse_quote(parser_t *parser); + +ast_t *parse_symbol(parser_t *parser); + +ast_t *parse_function(parser_t *parser); + +ast_t *parse_list(parser_t *parser); + +ast_t *parse_bind(parser_t *parser); + +ast_t *parse_expr(parser_t *parser); + +ast_t *read_in(char *s); +#endif |