-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparser.hpp
More file actions
67 lines (55 loc) · 1.32 KB
/
parser.hpp
File metadata and controls
67 lines (55 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef PARSER_HPP
#define PARSER_HPP
#include <deque>
#include <memory>
#include <list>
#include "lexer.hpp"
#include "context.hpp"
#include "token.hpp"
#include "expr.hpp"
#include "type.hpp"
#include "translator.hpp"
#include "stmt.hpp"
#include "decl.hpp"
class parser
{
lexer& m_lexer;
context& m_cxt;
std::list<scope>& m_stack;
std::deque<token_ptr> tokens;
translator sema;
value_map& m_values;
public:
parser( lexer&, context&, std::list<scope>&, value_map& );
token_kind lookahead();
token_ptr consume();
token_ptr match( token_kind tk );
token_ptr match_if( token_kind tk );
expr* expression();
expr* assignment_expression();
expr* additive_expression();
expr* multiplicative_expression();
expr* conditional_expression();
expr* logical_or_expression();
expr* logical_and_expression();
expr* equality_expression();
expr* ordering_expression();
expr* unary_expression();
expr* primary_expression();
expr* id_expression();
stmt* statement();
stmt* print_statement();
stmt* while_statement();
stmt* if_statement();
stmt* block_statement();
stmt* declaration_statement();
stmt* expression_statement();
decl* declaration();
decl* variable_declaration();
decl* function_declaration();
decl* parameter_declaration();
const type* type_specifier();
symbol* identifier();
decl* program();
};
#endif