SyntaxParser/LR1Generator.cpp

58 lines
1.1 KiB
C++
Raw Normal View History

2021-04-30 12:55:56 +00:00
#include <iostream>
#include <ctime>
#include <SymbolTable.h>
#include <GrammarResourcePool.h>
#include <AnalyseTableGenerator.h>
using std::vector;
using std::wstring;
using std::wcout;
using std::endl;
#include <LR1Generator.h>
#include <SyntaxParser.h>
int main() {
clock_t start,end;//<2F><><EFBFBD><EFBFBD>clock_t<5F><74><EFBFBD><EFBFBD>
start = clock(); //<2F><>ʼʱ<CABC><CAB1>
const GrammarResourcePool *pool;
const AnalyseTableGenerator *atg;
LR1Generator generator;
generator.getProductions();
generator.run();
generator.output(pool, atg);
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
end = clock(); //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
double times = double(end-start)/CLOCKS_PER_SEC;
wcout<<"LR1Generator Run time = "<< times <<"s MicroSeconds" << " = " << times * 1000 <<"ms" << endl;
start = clock(); //<2F><>ʼʱ<CABC><CAB1>
SyntaxParser syntaxParser(pool, atg);
syntaxParser.getToken();
syntaxParser.parse();
//<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
end = clock(); //<2F><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
times = double(end-start)/CLOCKS_PER_SEC;
wcout<<"SyntaxParser Run time = "<<times<<"s MicroSeconds " << " = " << times * 1000 <<"ms" << endl;
return 0;
}