-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
49 lines (43 loc) · 1.21 KB
/
Copy pathmain.cpp
File metadata and controls
49 lines (43 loc) · 1.21 KB
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
#include <iostream>
#include <cstring>
#include <cstdlib>
#include "Compiler.h"
#include "Grammer.h"
int main( int argc , char ** argv )
{
Compiler * comp;
std::string again;
do
{
comp = new Compiler();
if( ! comp )
{
std::cout<<"Memory Allocation Error!"<<std::endl;
return EXIT_FAILURE;
}
comp->help();
comp->getInput();
std::cout<<"======================================"<<std::endl;
comp->waiting( PARSING );
if( comp->isGrammerLL1() )
{
std::cout<<"Grammer is LL(1)"<<std::endl<<std::endl;
}
else
{
std::cout<<"Grammer is Not LL(1)"<<std::endl<<std::endl;
comp->outputWhyNotLL1();
comp->waiting( LL1_CALCULATING );
comp->makeGrammerLL1();
comp->outputLL1();
}
comp->outputFirsts();
comp->outputFollows();
comp->outputParsingTable();
delete comp;
std::cout<<"Want to try another Grammer?(y/n) ";
std::getline( std::cin , again);
}
while( again == "y" || again == "Y" );
return EXIT_SUCCESS;
}