diff options
author | Bad Diode <bd@badd10de.dev> | 2021-10-18 12:31:20 +0200 |
---|---|---|
committer | Bad Diode <bd@badd10de.dev> | 2021-10-18 12:31:20 +0200 |
commit | 043a96a6b7cf55f7ef58fb5ebf8ad87b7d50b571 (patch) | |
tree | 14861de314cfa5587103bd3cf21a761dd0e8248e /src/bootstrap/parser.h | |
parent | 6f34133b0661849bccf891ea0aa4d04f45ca9a9a (diff) | |
download | bdl-043a96a6b7cf55f7ef58fb5ebf8ad87b7d50b571.tar.gz bdl-043a96a6b7cf55f7ef58fb5ebf8ad87b7d50b571.zip |
Add header files for all modules
Diffstat (limited to 'src/bootstrap/parser.h')
-rw-r--r-- | src/bootstrap/parser.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/bootstrap/parser.h b/src/bootstrap/parser.h new file mode 100644 index 0000000..3bd17ef --- /dev/null +++ b/src/bootstrap/parser.h | |||
@@ -0,0 +1,22 @@ | |||
1 | #ifndef BDL_PARSER_H | ||
2 | #define BDL_PARSER_H | ||
3 | |||
4 | typedef struct Visitor { | ||
5 | Tokens tokens; | ||
6 | size_t current; | ||
7 | } Visitor; | ||
8 | |||
9 | // Mimics the functionality in the Scanner functions, but for entire tokens. | ||
10 | Token next_token(Visitor *visitor); | ||
11 | Token peek_token(const Visitor *visitor); | ||
12 | bool has_next_token(const Visitor *visitor); | ||
13 | |||
14 | // Parse a token into a fixnum object. | ||
15 | Object * parse_fixnum(Token tok); | ||
16 | |||
17 | // Recursive descent parser. If an object is not a list the parsing is handled | ||
18 | // by the parse_tree function. | ||
19 | Object * parse_list(Visitor *vs); | ||
20 | Object * parse_tree(Visitor *vs); | ||
21 | |||
22 | #endif // BDL_PARSER_H | ||