-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathParser.h
79 lines (47 loc) · 1.36 KB
/
Parser.h
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
68
69
70
71
72
73
74
75
76
77
78
79
//
// Created by Naschinsui on 07.05.2017.
//
#ifndef COMPILER_CONSTRUCTION_PARSER_H
#define COMPILER_CONSTRUCTION_PARSER_H
#include "Lexer.h"
#include "Token.h"
#include "lib/Tree.h"
#include "string"
#include "lib/AST_Node.h"
#include "iostream"
class Parser {
private:
Token curToken;
Lexer *lex;
Tree astTree;
bool err;
void printError(Token tok);
void printError(std::string err);
void advTok();
void sourceFile();
void packageClause(AST_Node *parent);
void importClause(AST_Node *parent);
void importListEntry(AST_Node *parent);
void topLevelDeclaration(AST_Node *parent);
void varDeclaration(AST_Node *parent);
void funcDeclaration(AST_Node *parent);
void parameters(AST_Node *parent);
void returnValues(AST_Node *parent);
void StatementList(AST_Node *parent);
void expression(AST_Node *parent);
void functionCall(AST_Node *parent);
void parameterList(AST_Node *parent);
void type(AST_Node *parent);
void mathExpression(AST_Node *parent);
void mathExpression_der(AST_Node *parent);
void term(AST_Node *parent);
void term_der(AST_Node *parent);
void factor(AST_Node *parent);
public:
Tree getAstTree() const;
public:
Parser(Lexer *lex);
void printAST(std::vector<std::string> *);
void start();
};
#endif //COMPILER_CONSTRUCTION_PARSER_H