-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.h
52 lines (39 loc) · 1.5 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
// ****************************************************************************
// ****************************************************************************
// Parser.h
// ****************************************************************************
//
// ****************************************************************************
// ****************************************************************************
// ****************************************************************************
// Defines
// ****************************************************************************
#ifndef H_PARSER
#define H_PARSER
// ****************************************************************************
// Parser Class
// ****************************************************************************
class Parser {
public:
static void init(const comString& grammarFile);
static void run();
static void typeCheck();
static void buildGrammar(const comString& filename);
static void builtinGrammar();
static bool parse(TokListIter& tIter,
ParseTree* tree,
UINT& tokensParsed);
static void generate();
static void printTree();
private:
static ParseTree* generate(ParseTree* tree,
FILE* file,
Translator::Type tType);
static Terminal* makeTerminal(const comString& spelling);
static bool termMatch(Terminal* term,
const comString& spelling);
static NonTerm* m_entrySymbol;
static ParseTree* m_tree;
friend class Translator;
};
#endif