forked from rperlste/UniversalCompiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUniversalCompiler.h
65 lines (52 loc) · 1.76 KB
/
UniversalCompiler.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
#ifndef _universalCompiler
#define _universalCompiler
#include <cstdlib>
#include <iostream>
#include <fstream>
#include <string>
#include "Scanner.h"
#include "Token.h"
#include "Parser.h"
#include "GrammarAnalyzer.h"
#include "Predict.h"
#include "ParseTable.h"
#include "Parser.h"
#include "Compiler.h"
class UniversalCompiler {
public:
UniversalCompiler( const char* grammarFilePtr,
const char* programFilePtr,
const char* compiledFilePtr );
void greeting();
void initialize();
bool setGrammarFile( const std::string& grammarFileName );
bool setProgramFile( const std::string& programFileName );
bool setCompiledFile( const std::string& compiledFileName );
// Runs the menu, giving access to the various
// componenets of the UC.
// Returns false if the user chose to exit the menu.
bool menu();
~UniversalCompiler();
private:
// Files
std::fstream grammarFile;
std::fstream programFile;
std::fstream compiledFile;
// Compile-time Objects
GrammarAnalyzer* grammarAnalyzer;
Predict* predictSetAnalyzer;
ParseTable* parseTableGenerator;
Scanner* scanner;
ParserDriver* parser;
LL1Compiler* compiler;
// Main menu options
bool runFileManager();
void runGrammarAnalyzer( bool );
void runPredictSetAnalyzer( bool );
void runParseTableGenerator( bool );
void runScanner();
void runParser( bool );
void runCompiler( bool );
void printFileToCout( std::fstream& file );
};
#endif