本文整理汇总了C++中Lexer::getInputStruct方法的典型用法代码示例。如果您正苦于以下问题:C++ Lexer::getInputStruct方法的具体用法?C++ Lexer::getInputStruct怎么用?C++ Lexer::getInputStruct使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Lexer
的用法示例。
在下文中一共展示了Lexer::getInputStruct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
void main(int argc, char* argv[])
{
Lexer* lexer = new Lexer(argc, argv);
Parser* parser = new Parser(lexer);
char* mytemp;
SymbolTable* symtable;
char* output_target = DEFAULT_OUTPUT_TARGET;
Machine* platform;
if(lexer->getInputStruct())
{
int success = parser->parse();
int sem_success;
if(success)
{
if(PARSER_MESSAGE)
cout<<"Parsing: success"<<endl;
symtable = new SymbolTable();
RegisterBank* regbank = new RegisterBank(DEFAULT_REGISTERS, NUMBER_OF_DEFAULT_REGISTERS, LOCAL);
regbank->setGlobalPointer(new Register(GLOBAL_POINTER, GLOBAL,GLOBAL_POINTER_ADDR));
regbank->setStackPointer(new Register(STACK_POINTER, STACK,STACK_POINTER_ADDR));
regbank->setFramePointer(new Register(FRAME_POINTER, FRAME,FRAME_POINTER_ADDR));
RegisterBank* outputregs = new RegisterBank(OUTPUT_REGISTERS, NUMBER_OF_OUTPUT_REGISTERS, OUTPUT);
RegisterBank* inputregs = new RegisterBank(INPUT_REGISTERS, NUMBER_OF_INPUT_REGISTERS, INPUT);
platform = new Sparc(regbank,outputregs,inputregs);
Machine::setCurrentMachine(platform);
codegen = new CodeGenerator(platform, output_target);
platform->setOutput(codegen->getOutputStream());
codegen->beginCodeGen();
semchecker = new SemanticChecker(symtable, ASTree, codegen);
sem_success = semchecker->check();
codegen->endCodeGen();
}
else if(PARSER_MESSAGE)
cout<<"Parsing: failure"<<endl;
if(sem_success && SEMANTIC_MESSAGE)
cout<<"Semantic success."<<endl;
else
cout<<"Semantic failure."<<endl;
}
delete lexer;
delete parser;
}