本文整理汇总了C++中parsetree_t::drawepsilon方法的典型用法代码示例。如果您正苦于以下问题:C++ parsetree_t::drawepsilon方法的具体用法?C++ parsetree_t::drawepsilon怎么用?C++ parsetree_t::drawepsilon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类parsetree_t
的用法示例。
在下文中一共展示了parsetree_t::drawepsilon方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Statement
void parser_t::Statement(){
parsetree.push(NT_Statement);
switch(scanner.next_token())
{
case T_eof:
parsetree.drawepsilon();
break;
case T_m:
cerr<<"m";
Assignment();
break;
case T_label:
cerr<<"L";
Label();
break;
case T_goto:
cerr<<"goto";
Jump();
break;
case T_print:
cerr<<"printf()";
Print();
break;
default:
syntax_error(NT_Statement);
break;
}
parsetree.pop();
}
示例2: jumpImouto
void parser_t::jumpImouto()
{
parsetree.push(NT_JumpImouto);
switch(scanner.next_token())
{
case T_if:
eat_token(T_if);
outSave += "if(";
outSave += expression();
outSave += ")";
break;
case T_eof:
parsetree.drawepsilon();
break;
case T_label:
case T_goto:
case T_m:
case T_print:
break;
default:
syntax_error(NT_JumpImouto);
break;
}
parsetree.pop();
}
示例3: Start
//Here is an example
void parser_t::Start()
{
//push this non-terminal onto the parse tree.
//the parsetree class is just for drawing the finished
//parse tree, and should in should have no effect the actual
//parsing of the data
parsetree.push(NT_Start);
switch( scanner.next_token() )
{
case T_plus:
eat_token(T_plus);
Start();
break;
case T_eof:
parsetree.drawepsilon();
break;
default:
syntax_error(NT_Start);
break;
}
//now that we are done with List, we can pop it from the data
//stucture that is tracking it for drawing the parse tree
parsetree.pop();
}
示例4: Start
//Here is an example
void parser_t::Start()
{
//push this non-terminal onto the parse tree.
//the parsetree class is just for drawing the finished
//parse tree, and should in should have no effect the actual
//parsing of the data
parsetree.push(NT_Start);
fprintf(stderr, "int main()\n");
fprintf(stderr, "{\n");
fprintf(stderr, "\tint m[101];\n");
fprintf(stderr, "\n");
switch( scanner.next_token() )
{
case T_label:
case T_goto:
case T_m:
case T_print:
Statements();
break;
case T_eof:
parsetree.drawepsilon();
break;
default:
syntax_error(NT_Start);
break;
}
//now that we are done with List, we can pop it from the data
//stucture that is tracking it for drawing the parse tree
parsetree.pop();
fprintf(stderr, "}\n");
}
示例5: LabelStatements
void parser_t::LabelStatements()
{
parsetree.push(NT_LabelStatements);
switch(scanner.next_token())
{
case T_m:
case T_print:
LabelStatement();
LabelStatements();
break;
case T_goto:
case T_label:
case T_eof:
parsetree.drawepsilon();
break;
default:
syntax_error(NT_LabelStatement);
break;
}
parsetree.pop();
}
示例6: Statements
void parser_t::Statements()
{
parsetree.push(NT_Statements);
if(scanner.next_token() != T_eof){
Statement();
Statements();
}
else
parsetree.drawepsilon();
parsetree.pop();
}
示例7: switch
void parser_t::Expression1(){
parsetree.push(NT_Expression1);
//WRITEME: you will need to put the rest of the procedures here
switch(scanner.next_token()){
case T_eof:
parsetree.drawepsilon();
//eat_token(T_eof);
break;
case T_plus:
//cerr<<"+";
eat_token(T_plus);
T();
Expression1();
break;
case T_minus:
//cerr<<"-";
eat_token(T_minus);
T();
Expression1();
break;
case T_label:
parsetree.drawepsilon();
break;
case T_goto:
parsetree.drawepsilon();
break;
case T_if:
parsetree.drawepsilon();
break;
case T_m:
parsetree.drawepsilon();
break;
case T_print:
parsetree.drawepsilon();
break;
case T_closesquare:
parsetree.drawepsilon();
break;
case T_closeparen:
parsetree.drawepsilon();
break;
default:
syntax_error(NT_Expression1);
break;
}
parsetree.pop();
}
示例8: furuImouto
void parser_t::furuImouto(string& expString)
{
parsetree.push(NT_MultDivImouto);
switch(scanner.next_token())
{
case T_times:
eat_token(T_times);
expString += "*";
exp(expString);
furuImouto(expString);
break;
case T_divide:
eat_token(T_divide);
expString += "/";
exp(expString);
furuImouto(expString);
break;
case T_eof:
parsetree.drawepsilon();
break;
case T_plus:
case T_minus:
case T_closeparen:
case T_closesquare:
case T_label:
case T_goto:
case T_m:
case T_print:
parsetree.drawepsilon();
break;
default:
syntax_error(NT_MultDivImouto);
break;
}
parsetree.pop();
}
示例9: Statements
//WRITEME: you will need to put the rest of the procedures here
void parser_t::Statements()
{
token_type watch = scanner.next_token();
parsetree.push(NT_Statements);
if((watch == T_label) || (watch == T_goto) || (watch == T_m)||(watch == T_print)){
Statement();
Statements();
}else if(watch == T_eof){
parsetree.drawepsilon();
}else{
syntax_error(NT_Statements);
}
parsetree.pop();
}
示例10: StatementsPrime
void parser_t::StatementsPrime()
{
parsetree.push(NT_StatementsPrime);
switch(scanner.next_token())
{
case T_eof:
parsetree.drawepsilon();
break;
default:
Statement();
StatementsPrime();
}
parsetree.pop();
}
示例11: ExpressionP
void parser_t::ExpressionP()
{
//push this non-terminal onto the parse tree.
//the parsetree class is just for drawing the finished
//parse tree, and should in should have no effect the actual
//parsing of the data
parsetree.push(NT_ExpressionPrime);
switch( scanner.next_token() )
{
case T_label:
parsetree.drawepsilon();
break;
case T_goto:
parsetree.drawepsilon();
break;
case T_print:
parsetree.drawepsilon();
break;
case T_m:
parsetree.drawepsilon();
break;
case T_closeparen:
parsetree.drawepsilon();
break;
case T_closesquare:
parsetree.drawepsilon();
break;
case T_plus:
eat_token(T_plus);
cerr << "+";
Term();
ExpressionP();
break;
case T_minus:
eat_token(T_minus);
cerr << "-";
Term();
ExpressionP();
break;
case T_eof:
parsetree.drawepsilon();
break;
default:
syntax_error(NT_ExpressionPrime);
break;
}
//now that we are done with List, we can pop it from the data
//stucture that is tracking it for drawing the parse tree
parsetree.pop();
}
示例12: JumpIf
void parser_t::JumpIf(){
parsetree.push(NT_JumpIf);
if(scanner.next_token() == T_if){
code_printf("if(");
eat_token(T_if);
Expression();
code_printf(")\n\t\t");
}
else
parsetree.drawepsilon();
parsetree.pop();
}
示例13: Power
void parser_t::Power(){
parsetree.push(NT_Power);
switch(scanner.next_token()){
case T_power:
code_printf(", ");
eat_token(T_power);
Factor();
code_printf(")");
break;
default:
code_printf(", 1)");
parsetree.drawepsilon();
}
parsetree.pop();
}
示例14: Statement
void parser_t::Statement()
{
//push this non-terminal onto the parse tree.
//the parsetree class is just for drawing the finished
//parse tree, and should in should have no effect the actual
//parsing of the data
parsetree.push(NT_Statement);
switch( scanner.next_token() )
{
case T_m:
eat_token(T_m);
Assignment();
break;
case T_label:
Label();
//eat_token(T_label);
scanner.next_token();
break;
case T_goto:
//eat_token(T_goto);
Jump();
scanner.next_token();
break;
//COME BACK TO FIX WHAT PRINT prints out ~!~!~!~!~!~!~!~!~!~!~!~!~!~~!!~~!!~!
case T_print:
//eat_token(T_print);
Print();
scanner.next_token();
break;
case T_eof:
parsetree.drawepsilon();
break;
default:
syntax_error(NT_Statement);
break;
}
//now that we are done with List, we can pop it from the data
//stucture that is tracking it for drawing the parse tree
//scanner.next_token();
parsetree.pop();
}
示例15: RTerm
void parser_t::RTerm(){
parsetree.push(NT_RTerm);
switch(scanner.next_token()){
case T_times:
code_printf(" * ");
eat_token(T_times);
Term();
break;
case T_divide:
code_printf(" / ");
eat_token(T_divide);
Term();
break;
default:
parsetree.drawepsilon();
}
parsetree.pop();
}