-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.h
93 lines (59 loc) · 1.54 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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
//
// Created by Adam Zvada on 17.06.17.
//
#ifndef TESTLLVM_PARSER_H
#define TESTLLVM_PARSER_H
#include <iostream>
#include "lexan.h"
#include "ast.h"
#include "tabsym.h"
#define DEBUG_MODE 1
using namespace std;
class ParserException {
public:
ParserException(string what) {
cout << what << endl;
exit(1);
}
};
class Parser {
public:
Parser(string filename, llvm::LLVMContext & context, llvm::Module * module, llvm::IRBuilder<> & builder, BasicBlock * breakTarget);
void Compare(LexSymbolType symboleType);
void CompareIndent(string & ident);
void CompareNumb(int & num);
void ReadToken();
void PrintSymb(LexicalSymbol lexSymbol);
Prog * Program();
void Decleration();
void DeclerationVar();
void DeclerationVarNext();
void DeclerationConst();
void DeclerationConstNext();
void DeclerationFunc();
StatmList * ProgramBlock();
Statm * Statement();
StatmList * StatementNext();
Statm * AssigmentStat();
Statm * WriteStat();
Statm * ReadStat();
Statm * IfStat();
Statm * ForStat();
Statm * WhileStat();
Statm * SwitchStat();
Statm * BreakStat();
Expr * Condition();
Statm * Else();
LexSymbolType Operator();
Expr * Expression();
Expr * ExpressionNext(Expr * inheretedExp);
Expr * Term();
Expr * TermNext(Expr * inheretedExp);
Expr * VarOrConst(string & id);
Expr * Factor();
Numb * NumbArr();
private:
LexicalSymbol _symbole;
SymboleTable * _symTable;
};
#endif //TESTLLVM_PARSER_H