forked from rochus-keller/Micron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMilParser.h
82 lines (78 loc) · 2.03 KB
/
MilParser.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
#ifndef __MIL_PARSER__
#define __MIL_PARSER__
// This file was automatically generated by EbnfStudio; don't modify it!
#include <Micron/MilSynTree.h>
namespace Mil {
class Scanner {
public:
virtual Token next() = 0;
virtual Token peek(int offset) = 0;
};
class Parser {
public:
Parser(Scanner* s):scanner(s) {}
void RunParser();
SynTree root;
struct Error {
QString msg;
int row, col;
QString path;
Error( const QString& m, int r, int c, const QString& p):msg(m),row(r),col(c),path(p){}
};
QList<Error> errors;
protected:
void Mil(SynTree*);
void integer(SynTree*);
void qualident(SynTree*);
void trident(SynTree*);
void identdef(SynTree*);
void TypeDeclaration(SynTree*);
void type(SynTree*);
void NamedType(SynTree*);
void ArrayType(SynTree*);
void length(SynTree*);
void StructUnionType(SynTree*);
void FieldList(SynTree*);
void IdentList(SynTree*);
void PointerType(SynTree*);
void ProcedureType(SynTree*);
void VariableDeclaration(SynTree*);
void ProcedureDeclaration(SynTree*);
void ProcedureBody(SynTree*);
void LocalDeclaration(SynTree*);
void FormalParameters(SynTree*);
void ReturnType(SynTree*);
void FPSection(SynTree*);
void module(SynTree*);
void ImportList(SynTree*);
void import(SynTree*);
void ImportPath(SynTree*);
void DeclarationSequence(SynTree*);
void Expression(SynTree*);
void ExpInstr(SynTree*);
void StatementSequence(SynTree*);
void Statement(SynTree*);
void IfThenElse(SynTree*);
void Loop(SynTree*);
void Switch(SynTree*);
void RepeatUntil(SynTree*);
void WhileDo(SynTree*);
void MetaActuals(SynTree*);
void MetaParams(SynTree*);
void MetaSection(SynTree*);
void ConstExpression(SynTree*);
void constructor(SynTree*);
void component_list(SynTree*);
void component(SynTree*);
protected:
Token cur;
Token la;
Scanner* scanner;
void next();
Token peek(int off);
void invalid(const char* what);
bool expect(int tt, bool pkw, const char* where);
void addTerminal(SynTree* st);
};
}
#endif // include