-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.h
61 lines (48 loc) · 1022 Bytes
/
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
#ifndef GLOBAL_H
#include "global.h"
#endif
#ifndef LEXAN_H
#include "lexan.h"
#endif
#ifndef SYMBOL_H
#include "symbol.h"
#endif
#ifndef PARSER_H
#define PARSER_H
#endif
struct parser_t {
parser_t( lexan_t& lexan, ostream& fsym, ostream& trace ) :
lexan( lexan ),
fsym( fsym ),
_trace( trace ) {
this->next();
}
lexan_t& lexan;
token_t lookahead;
int traceLevel;
ostream& fsym;
ostream& _trace;
void next() {
lookahead = lexan.nextsymbol();
}
void trace( string info ) {
for ( int i = 0; i < traceLevel; i++ ) {
_trace << '\t';
}
traceLevel++;
_trace << "Zeile[" << lexan.lineno << "]: " << info << endl;
}
void traceend() {
traceLevel--;
}
void constdecl();
void vardecl();
void procdecl();
void factor();
void term();
void exp();
void condition();
void statement();
void program();
void block( symtable* neusym );
};