aboutsummaryrefslogtreecommitdiffstats
path: root/src/bootstrap/parser.h
blob: 3834c75db919b017ce40648ae49c327ed1f20f95 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#ifndef BDL_PARSER_H
#define BDL_PARSER_H

typedef struct Visitor {
    Token *tokens;
    size_t current;
} Visitor;

// Mimics the functionality in the Scanner functions, but for entire tokens.
Token next_token(Visitor *visitor);
Token peek_token(const Visitor *visitor);
bool has_next_token(const Visitor *visitor);

// Parse a token into a fixnum object.
Object * parse_fixnum(Token tok);

// Recursive descent parser. If an object is not a list the parsing is handled
// by the parse_tree function.
Object * parse_list(Visitor *vs);
Object * parse_tree(Visitor *vs);

#endif // BDL_PARSER_H