-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParser.h
More file actions
42 lines (31 loc) · 741 Bytes
/
Copy pathParser.h
File metadata and controls
42 lines (31 loc) · 741 Bytes
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
#ifndef PARSER_H
#define PARSER_H
#include <vector>
#include <sstream>
#include "Node.h"
#include "Program.h"
#include "Lexer.h"
class Parser
{
public:
Parser(std::wstringstream& str);
Program parse();
Token skipEmptyLines();
Node *begin();
std::vector<Node*> declarations();
Node *declaration();
std::vector<Node*> operations();
Node *operation();
Node *variable();
Node *expression();
Node *end();
private:
Token getNextToken();
int getPriority(Token::Type operation);
void check(Token token, std::initializer_list<Token::Type> types);
Token prevToken, curToken;
bool stepBack = false;
Lexer lexer;
std::vector<std::wstring> varList;
};
#endif // PARSER_H