/*164:*/
//line 47 "/usr/local/yacco2/compiler/o2/includes.w"

#include "o2.h"
/*14:*/
//line 33 "/usr/local/yacco2/compiler/o2/prog.w"


YACCO2_define_trace_variables();

int RECURSION_INDEX__(0);
yacco2::CHAR T_SW('n');
yacco2::CHAR ERR_SW('n');
yacco2::CHAR PRT_SW('n');

yacco2::TOKEN_GAGGLE JUNK_tokens;
yacco2::TOKEN_GAGGLE P3_tokens;
yacco2::TOKEN_GAGGLE Error_queue;
char Big_buf[BIG_BUFFER_32K];
T_sym_tbl_report_card report_card;
std::string o2_file_to_compile;
std::string o2_fq_fn_noext;
STBL_T_ITEMS_type STBL_T_ITEMS;
STATES_type LR1_STATES;
LR1_STATES_type LR1_COMMON_STATES;
bool LR1_HEALTH(LR1_COMPATIBLE);
int NO_LR1_STATES(0);
STATES_SET_type VISITED_MERGE_STATES_IN_LA_CALC;
CYCLIC_USE_TBL_type CYCLIC_USE_TABLE;


int main(int argc,char*argv[])
{
cout<<yacco2::Lr1_VERSION<<std::endl;

/*17:*/
//line 98 "/usr/local/yacco2/compiler/o2/prog.w"

/*18:*/
//line 113 "/usr/local/yacco2/compiler/o2/prog.w"

LOAD_YACCO2_KEYWORDS_INTO_STBL();

/*:18*/
//line 99 "/usr/local/yacco2/compiler/o2/prog.w"


/*:17*/
//line 62 "/usr/local/yacco2/compiler/o2/prog.w"

/*19:*/
//line 124 "/usr/local/yacco2/compiler/o2/prog.w"

/*20:*/
//line 135 "/usr/local/yacco2/compiler/o2/prog.w"

GET_CMD_LINE(argc,argv,Yacco2_holding_file,Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 137 "/usr/local/yacco2/compiler/o2/prog.w"



/*:20*/
//line 125 "/usr/local/yacco2/compiler/o2/prog.w"

/*22:*/
//line 153 "/usr/local/yacco2/compiler/o2/prog.w"

YACCO2_PARSE_CMD_LINE
(T_SW,ERR_SW,PRT_SW,o2_file_to_compile,Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 156 "/usr/local/yacco2/compiler/o2/prog.w"

/*25:*/
//line 196 "/usr/local/yacco2/compiler/o2/prog.w"

lrclog<<"Parse options selected:"<<std::endl;
lrclog<<"  Gen T: "<<T_SW;
lrclog<<"  Gen Err: "<<ERR_SW;
lrclog<<"  Gen RC: "<<PRT_SW;

/*:25*/
//line 157 "/usr/local/yacco2/compiler/o2/prog.w"

/*23:*/
//line 166 "/usr/local/yacco2/compiler/o2/prog.w"

std::string::size_type pp= o2_file_to_compile.rfind('.');
if(pp==std::string::npos){
o2_fq_fn_noext+= o2_file_to_compile;
}else{
o2_fq_fn_noext+= o2_file_to_compile.substr(0,pp);
}

/*:23*/
//line 158 "/usr/local/yacco2/compiler/o2/prog.w"

/*24:*/
//line 184 "/usr/local/yacco2/compiler/o2/prog.w"

std::string normal_tracing(o2_fq_fn_noext.c_str());
normal_tracing+= "_tracings.log";
std::string error_logging(o2_fq_fn_noext.c_str());
error_logging+= "_errors.log";
yacco2::lrclog.close();
yacco2::lrerrors.close();
yacco2::lrclog.open(normal_tracing.c_str());
yacco2::lrerrors.open(error_logging.c_str());


/*:24*/
//line 159 "/usr/local/yacco2/compiler/o2/prog.w"


/*:22*/
//line 126 "/usr/local/yacco2/compiler/o2/prog.w"

/*26:*/
//line 227 "/usr/local/yacco2/compiler/o2/prog.w"



using namespace NS_pass3;
tok_can<std::ifstream> cmd_line(o2_file_to_compile.c_str());
Cpass3 p3_fsm;
Parser pass3(p3_fsm,&cmd_line,&P3_tokens,0,&Error_queue,&JUNK_tokens,0);
pass3.parse();
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 235 "/usr/local/yacco2/compiler/o2/prog.w"

/*27:*/
//line 240 "/usr/local/yacco2/compiler/o2/prog.w"

yacco2::TOKEN_GAGGLE_ITER i= P3_tokens.begin();
yacco2::TOKEN_GAGGLE_ITER ie= P3_tokens.end();
lrclog<<"Dump of P3 tokons"<<endl;
for(int yyy= 1;i!=ie;++i){
CAbs_lr1_sym*sym= *i;
if(sym==yacco2::PTR_LR1_eog__)continue;
lrclog<<yyy<<":: "<<sym->id__
<<" file no: "<<sym->tok_co_ords__.external_file_id__
<<" line no: "<<sym->tok_co_ords__.line_no__
<<" pos: "<<sym->tok_co_ords__.pos_in_line__
<<endl;
++yyy;
}

/*:27*/
//line 236 "/usr/local/yacco2/compiler/o2/prog.w"



/*:26*/
//line 127 "/usr/local/yacco2/compiler/o2/prog.w"


/*:19*/
//line 63 "/usr/local/yacco2/compiler/o2/prog.w"

lrclog<<yacco2::Lr1_VERSION<<std::endl;

/*34:*/
//line 433 "/usr/local/yacco2/compiler/o2/prog.w"

set<int> phase_order_filter;
phase_order_filter.insert(T_Enum::T_T_fsm_phrase_);
phase_order_filter.insert(T_Enum::T_T_enum_phrase_);
phase_order_filter.insert(T_Enum::T_T_lr1_k_phrase_);
phase_order_filter.insert(T_Enum::T_T_rc_phrase_);
phase_order_filter.insert(T_Enum::T_T_error_symbols_phrase_);
phase_order_filter.insert(T_Enum::T_T_terminals_phrase_);
phase_order_filter.insert(T_Enum::T_T_rules_phrase_);

tok_can_ast_functor orderly_walk;
ast_prefix_wbreadth_only
evaluate_phase_order(*GRAMMAR_TREE,&orderly_walk,&phase_order_filter,ACCEPT_FILTER);
tok_can<AST*> phrases_can(evaluate_phase_order);

using namespace NS_eval_phrases;
Ceval_phrases eval_fsm;
Parser eval_phrases(eval_fsm,&phrases_can,0,0,&Error_queue,0,0);
eval_phrases.parse();
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 452 "/usr/local/yacco2/compiler/o2/prog.w"


/*:34*/
//line 66 "/usr/local/yacco2/compiler/o2/prog.w"

/*29:*/
//line 307 "/usr/local/yacco2/compiler/o2/prog.w"

using namespace NS_epsilon_rules;
set<AST*> yes_pile;
set<AST*> no_pile;
list< pair<AST*,AST*> > maybe_list;
T_rules_phrase*rules_ph= O2_RULES_PHASE;
AST*rules_tree= rules_ph->phrase_tree();

set<int> filter;
filter.insert(T_Enum::T_T_subrule_def_);
filter.insert(T_Enum::T_rule_def_);

tok_can_ast_functor just_walk_functr;
ast_prefix rule_walk(*rules_tree,&just_walk_functr,&filter,ACCEPT_FILTER);
tok_can<AST*> rules_can(rule_walk);
Cepsilon_rules epsilon_fsm;
Parser epsilon_rules(epsilon_fsm,&rules_can,0,0,&Error_queue);
epsilon_rules.parse();
/*30:*/
//line 329 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
Error_queue.clear();
return 1;
}

/*:30*/
//line 325 "/usr/local/yacco2/compiler/o2/prog.w"



/*:29*/
//line 67 "/usr/local/yacco2/compiler/o2/prog.w"

/*28:*/
//line 267 "/usr/local/yacco2/compiler/o2/prog.w"

set<int> enumerate_filter;
enumerate_filter.insert(T_Enum::T_rule_def_);
enumerate_filter.insert(T_Enum::T_T_subrule_def_);
enumerate_filter.insert(T_Enum::T_refered_T_);
enumerate_filter.insert(T_Enum::T_T_eosubrule_);
enumerate_filter.insert(T_Enum::T_refered_rule_);
enumerate_filter.insert(T_Enum::T_T_called_thread_eosubrule_);
enumerate_filter.insert(T_Enum::T_T_null_call_thread_eosubrule_);
using namespace NS_enumerate_grammar;

tok_can_ast_functor walk_the_plank_mate;
ast_prefix enumerate_grammar_walk
(*rules_tree,&walk_the_plank_mate,&enumerate_filter,ACCEPT_FILTER);
tok_can<AST*> enumerate_grammar_can(enumerate_grammar_walk);
Cenumerate_grammar enumerate_grammar_fsm;
Parser enumerate_grammar(enumerate_grammar_fsm,&enumerate_grammar_can,0,0,&Error_queue);
enumerate_grammar.parse();

/*:28*/
//line 68 "/usr/local/yacco2/compiler/o2/prog.w"

/*35:*/
//line 497 "/usr/local/yacco2/compiler/o2/prog.w"

if(O2_PP_PHASE!=0){
/*36:*/
//line 503 "/usr/local/yacco2/compiler/o2/prog.w"

T_parallel_parser_phrase*pp_ph= O2_PP_PHASE;

if(pp_ph->la_bndry()==0){
CAbs_lr1_sym*sym= new Err_pp_la_boundary_attribute_not_fnd;
sym->set_rc(*pp_ph);
Error_queue.push_back(*sym);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 510 "/usr/local/yacco2/compiler/o2/prog.w"

}
T_parallel_la_boundary*la_bndry= pp_ph->la_bndry();
yacco2::TOKEN_GAGGLE*la_srce_tok_can= la_bndry->la_supplier();
yacco2::TOKEN_GAGGLE la_tok_can_lex;
yacco2::TOKEN_GAGGLE la_expr_tok_can;
using namespace NS_la_expr_lexical;
Cla_expr_lexical la_expr_lex_fsm;
Parser la_expr_lex_parse(la_expr_lex_fsm,la_srce_tok_can
,&la_tok_can_lex,0,&Error_queue,&JUNK_tokens,0);
la_expr_lex_parse.parse();
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 521 "/usr/local/yacco2/compiler/o2/prog.w"

using namespace NS_la_expr;
Cla_expr la_expr_fsm;
Parser la_expr_parse(la_expr_fsm,&la_tok_can_lex,&la_expr_tok_can
,0,&Error_queue,&JUNK_tokens,0);
la_expr_parse.parse();
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 527 "/usr/local/yacco2/compiler/o2/prog.w"


/*:36*/
//line 499 "/usr/local/yacco2/compiler/o2/prog.w"

}

/*:35*/
//line 69 "/usr/local/yacco2/compiler/o2/prog.w"

/*31:*/
//line 348 "/usr/local/yacco2/compiler/o2/prog.w"

set<int> sr_filter;
sr_filter.insert(T_Enum::T_T_subrule_def_);
ast_prefix sr_walk(*rules_tree,&just_walk_functr,&sr_filter,ACCEPT_FILTER);
tok_can<AST*> sr_can(sr_walk);
for(int xx(0);sr_can[xx]!=yacco2::PTR_LR1_eog__;++xx);
O2_T_ENUM_PHASE->total_no_subrules(sr_can.size());
if(O2_T_ENUM_PHASE->total_no_subrules()> Max_no_subrules){
lrclog<<"Grammar's number of subrules: "
<<O2_T_ENUM_PHASE->total_no_subrules()
<<" exceeds the allocated space for table elem_space: "
<<Max_no_subrules<<endl;
lrclog<<"This is a big grammar so please correct the grammar."<<std::endl;
clog<<"Grammar's number of subrules: "
<<O2_T_ENUM_PHASE->total_no_subrules()
<<" exceeds the allocated space for table elem_space: "
<<Max_no_subrules<<endl;
clog<<"This is a big grammar so please correct the grammar."<<std::endl;
return 1;
}

/*:31*/
//line 70 "/usr/local/yacco2/compiler/o2/prog.w"

/*32:*/
//line 376 "/usr/local/yacco2/compiler/o2/prog.w"

set<int> fs_filter;
fs_filter.insert(T_Enum::T_rule_def_);
ast_prefix fs_rule_walk(*rules_tree,&just_walk_functr,&fs_filter,ACCEPT_FILTER);
tok_can<AST*> fs_rules_can(fs_rule_walk);
for(int xx(0);fs_rules_can[xx]!=yacco2::PTR_LR1_eog__;++xx){
rule_def* rd = (rule_def*)fs_rules_can[xx];
GEN_FS_OF_RULE(rd);
}

/*:32*/
//line 71 "/usr/local/yacco2/compiler/o2/prog.w"

/*33:*/
//line 399 "/usr/local/yacco2/compiler/o2/prog.w"

rule_def*start_rule_def= (rule_def*)fs_rules_can.operator[](0);
GEN_CALLED_THREADS_FS_OF_RULE(start_rule_def);

/*:33*/
//line 72 "/usr/local/yacco2/compiler/o2/prog.w"

/*39:*/
//line 582 "/usr/local/yacco2/compiler/o2/prog.w"

AST*start_rule_def_t= AST::get_1st_son(*rules_tree);
state*gening_state= new state(start_rule_def_t);
gen_context gening_context(0,-1);
STATES_ITER_type si= LR1_STATES.begin();
STATES_ITER_type sie= LR1_STATES.end();


for(;si!=sie;++si){
gening_state= *si;
gening_context.for_closure_state_= gening_state;
gening_context.gen_vector_= -1;
lrclog<<"lr state driver considered state: "
<<gening_context.for_closure_state_->state_no_
<<" for vector: "
<<gening_context.gen_vector_
<<endl;

LR1_HEALTH= gening_state->gen_transitive_states_for_closure_context(gening_context,*gening_state,*gening_state);
if(LR1_HEALTH==NOT_LR1_COMPATIBLE){
/*40:*/
//line 611 "/usr/local/yacco2/compiler/o2/prog.w"

if(LR1_HEALTH==NOT_LR1_COMPATIBLE){
yacco2::lrclog<<"===>Please check Grammar dump file: "
<<normal_tracing.c_str()<<" for Not LR1 details"<<endl;
std::cout<<"===>Please check Grammar dump file: "
<<normal_tracing.c_str()<<" for Not LR1 details"<<endl;
yacco2::lrclog<<"Not LR1 --- check state conflict list of state: "
<<gening_state->state_no_<<" for details"<<endl;
/*135:*/
//line 2187 "/usr/local/yacco2/compiler/o2/o2_defs.w"

const char*literal_name;
yacco2::lrclog<<std::endl;
yacco2::lrclog<<"State dump"<<std::endl;
si= LR1_STATES.begin();
sie= LR1_STATES.end();
for(;si!=sie;++si){
state*cur_state= *si;
Print_dump_state(cur_state);
}

/*:135*/
//line 619 "/usr/local/yacco2/compiler/o2/prog.w"

/*134:*/
//line 2159 "/usr/local/yacco2/compiler/o2/o2_defs.w"

LR1_STATES_ITER_type ci= LR1_COMMON_STATES.begin();
LR1_STATES_ITER_type cie= LR1_COMMON_STATES.end();
yacco2::lrclog<<"Common States dump"<<std::endl;
int cstate_no(0);
for(;ci!=cie;++ci){
++cstate_no;
STATES_ITER_type si= ci->second.begin();
STATES_ITER_type sie= ci->second.end();
bool pre= false;
for(;si!=sie;++si){
state*cstate= *si;
if(pre==false){
pre= true;
yacco2::lrclog<<cstate_no<<"::Common State: "<<cstate->vectored_into_by_elem_;
if(cstate->vectored_into_by_elem_sym_==0){
yacco2::lrclog<<" Entry Symbol: No symbol"<<std::endl;
}else{
yacco2::lrclog<<" Entry Symbol: "<<cstate->entry_symbol_literal()<<std::endl;
}
}
yacco2::lrclog<<"\tstate no: "<<cstate->state_no_<<std::endl;
}
yacco2::lrclog<<std::endl;
}


/*:134*/
//line 620 "/usr/local/yacco2/compiler/o2/prog.w"

return 1;
}

/*:40*/
//line 602 "/usr/local/yacco2/compiler/o2/prog.w"

}
}

/*41:*/
//line 634 "/usr/local/yacco2/compiler/o2/prog.w"

COMMONIZE_LA_SETS();


/*:41*/
//line 606 "/usr/local/yacco2/compiler/o2/prog.w"




/*:39*/
//line 73 "/usr/local/yacco2/compiler/o2/prog.w"

/*40:*/
//line 611 "/usr/local/yacco2/compiler/o2/prog.w"

if(LR1_HEALTH==NOT_LR1_COMPATIBLE){
yacco2::lrclog<<"===>Please check Grammar dump file: "
<<normal_tracing.c_str()<<" for Not LR1 details"<<endl;
std::cout<<"===>Please check Grammar dump file: "
<<normal_tracing.c_str()<<" for Not LR1 details"<<endl;
yacco2::lrclog<<"Not LR1 --- check state conflict list of state: "
<<gening_state->state_no_<<" for details"<<endl;
/*135:*/
//line 2187 "/usr/local/yacco2/compiler/o2/o2_defs.w"

const char*literal_name;
yacco2::lrclog<<std::endl;
yacco2::lrclog<<"State dump"<<std::endl;
si= LR1_STATES.begin();
sie= LR1_STATES.end();
for(;si!=sie;++si){
state*cur_state= *si;
Print_dump_state(cur_state);
}

/*:135*/
//line 619 "/usr/local/yacco2/compiler/o2/prog.w"

/*134:*/
//line 2159 "/usr/local/yacco2/compiler/o2/o2_defs.w"

LR1_STATES_ITER_type ci= LR1_COMMON_STATES.begin();
LR1_STATES_ITER_type cie= LR1_COMMON_STATES.end();
yacco2::lrclog<<"Common States dump"<<std::endl;
int cstate_no(0);
for(;ci!=cie;++ci){
++cstate_no;
STATES_ITER_type si= ci->second.begin();
STATES_ITER_type sie= ci->second.end();
bool pre= false;
for(;si!=sie;++si){
state*cstate= *si;
if(pre==false){
pre= true;
yacco2::lrclog<<cstate_no<<"::Common State: "<<cstate->vectored_into_by_elem_;
if(cstate->vectored_into_by_elem_sym_==0){
yacco2::lrclog<<" Entry Symbol: No symbol"<<std::endl;
}else{
yacco2::lrclog<<" Entry Symbol: "<<cstate->entry_symbol_literal()<<std::endl;
}
}
yacco2::lrclog<<"\tstate no: "<<cstate->state_no_<<std::endl;
}
yacco2::lrclog<<std::endl;
}


/*:134*/
//line 620 "/usr/local/yacco2/compiler/o2/prog.w"

return 1;
}

/*:40*/
//line 74 "/usr/local/yacco2/compiler/o2/prog.w"

/*37:*/
//line 537 "/usr/local/yacco2/compiler/o2/prog.w"

lrclog<<"Evaluate rules count"<<endl;
using namespace NS_rules_use_cnt;

set<int> rules_use_cnt_filter;
rules_use_cnt_filter.insert(T_Enum::T_T_subrule_def_);
rules_use_cnt_filter.insert(T_Enum::T_rule_def_);
rules_use_cnt_filter.insert(T_Enum::T_refered_rule_);

tok_can_ast_functor rules_use_walk_functr;
ast_prefix rules_use_walk(*GRAMMAR_TREE,&rules_use_walk_functr
,&rules_use_cnt_filter,ACCEPT_FILTER);
tok_can<AST*> rules_use_can(rules_use_walk);
Crules_use_cnt rules_use_cnt_fsm;
Parser rules_use_cnt(rules_use_cnt_fsm,&rules_use_can,0,0,&Error_queue);
rules_use_cnt.parse();


/*:37*/
//line 75 "/usr/local/yacco2/compiler/o2/prog.w"

/*130:*/
//line 2126 "/usr/local/yacco2/compiler/o2/o2_defs.w"


/*118:*/
//line 1990 "/usr/local/yacco2/compiler/o2/o2_defs.w"

lrclog<<"Output enumeration header file "<<endl;
OP_ENUMERATION_HEADER(Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 1993 "/usr/local/yacco2/compiler/o2/o2_defs.w"


/*:118*/
//line 2128 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*119:*/
//line 1996 "/usr/local/yacco2/compiler/o2/o2_defs.w"

if(ERR_SW=='y'){
lrclog<<"Output Errors vocabulary files "<<endl;
OP_ERRORS_HEADER(Error_queue);
OP_ERRORS_CPP(Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 2001 "/usr/local/yacco2/compiler/o2/o2_defs.w"

}

/*:119*/
//line 2129 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*120:*/
//line 2005 "/usr/local/yacco2/compiler/o2/o2_defs.w"

if(T_SW=='y'){
lrclog<<"Output User Terminal vocabulary files "<<endl;
OP_USER_T_HEADER(Error_queue);
OP_USER_T_CPP(Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 2010 "/usr/local/yacco2/compiler/o2/o2_defs.w"

}

/*:120*/
//line 2130 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*125:*/
//line 2036 "/usr/local/yacco2/compiler/o2/o2_defs.w"

if(T_SW=='y'||ERR_SW=='y'){
lrclog<<"Output User Terminal vocabulary files "<<endl;
OP_T_Alphabet(Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 2040 "/usr/local/yacco2/compiler/o2/o2_defs.w"

}

/*:125*/
//line 2131 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*121:*/
//line 2014 "/usr/local/yacco2/compiler/o2/o2_defs.w"

lrclog<<"Output grammar header file "<<endl;
OP_GRAMMAR_HEADER(Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 2017 "/usr/local/yacco2/compiler/o2/o2_defs.w"


/*:121*/
//line 2132 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*122:*/
//line 2020 "/usr/local/yacco2/compiler/o2/o2_defs.w"

lrclog<<"Output grammar cpp file "<<endl;
OP_GRAMMAR_CPP(Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 2023 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*:122*/
//line 2133 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*123:*/
//line 2025 "/usr/local/yacco2/compiler/o2/o2_defs.w"

lrclog<<"Output grammar sym file "<<endl;
OP_GRAMMAR_SYM(Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 2028 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*:123*/
//line 2134 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*124:*/
//line 2030 "/usr/local/yacco2/compiler/o2/o2_defs.w"

lrclog<<"Output grammar tbl file "<<endl;
OP_GRAMMAR_TBL(Error_queue);
/*21:*/
//line 146 "/usr/local/yacco2/compiler/o2/prog.w"

if(Error_queue.empty()!=true){
DUMP_ERROR_QUEUE(Error_queue);
return 1;
}

/*:21*/
//line 2033 "/usr/local/yacco2/compiler/o2/o2_defs.w"


/*:124*/
//line 2135 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*129:*/
//line 2122 "/usr/local/yacco2/compiler/o2/o2_defs.w"

OP_FSC_FILE(Error_queue);

/*:129*/
//line 2136 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*126:*/
//line 2044 "/usr/local/yacco2/compiler/o2/o2_defs.w"

if(PRT_SW=='y'){
/*127:*/
//line 2076 "/usr/local/yacco2/compiler/o2/o2_defs.w"

using namespace yacco2;
using namespace NS_yacco2_k_symbols;
using namespace NS_mpost_output;
lrclog<<"Emit grammar's railroad diagrams for Mpost"<<endl;
set<int> cweb_k_filter;
cweb_k_filter.insert(T_Enum::T_T_cweb_comment_);
tok_can_ast_functor mpost_just_walk_functr;
ast_prefix mpost_rule_walk(*GRAMMAR_TREE,&mpost_just_walk_functr,&cweb_k_filter,BYPASS_FILTER);
tok_can<AST*> mpost_rules_can(mpost_rule_walk);
Cmpost_output mpost_fsm;
T_fsm_phrase*fsm_ph= O2_FSM_PHASE;
mpost_fsm.grammar_filename_prefix_+= fsm_ph->filename_id()->identifier()->c_str();
mpost_fsm.fq_filename_noext_+= o2_fq_fn_noext.c_str();

Parser mpost_rules(mpost_fsm,&mpost_rules_can,0,0,&Error_queue);
mpost_rules.parse();

/*:127*/
//line 2046 "/usr/local/yacco2/compiler/o2/o2_defs.w"

/*128:*/
//line 2097 "/usr/local/yacco2/compiler/o2/o2_defs.w"

using namespace NS_prt_xrefs_docs;
yacco2::lrclog<<"----- Print xref docs -----"<<std::endl;
set<int> prt_xrefs_docs_filter;
prt_xrefs_docs_filter.insert(T_Enum::T_rule_def_);
prt_xrefs_docs_filter.insert(T_Enum::T_T_subrule_def_);
prt_xrefs_docs_filter.insert(T_Enum::T_refered_T_);
prt_xrefs_docs_filter.insert(T_Enum::T_refered_rule_);
prt_xrefs_docs_filter.insert(T_Enum::T_T_called_thread_eosubrule_);
prt_xrefs_docs_filter.insert(T_Enum::T_T_null_call_thread_eosubrule_);
prt_xrefs_docs_filter.insert(T_Enum::T_T_eosubrule_);

tok_can_ast_functor xrefs_docs_walk_functr;
ast_prefix prt_xrefs_docs_walk(*rules_tree
,&xrefs_docs_walk_functr,&prt_xrefs_docs_filter,ACCEPT_FILTER);
tok_can<AST*> prt_xrefs_docs_can(prt_xrefs_docs_walk);
Cprt_xrefs_docs prt_xrefs_docs_fsm;
prt_xrefs_docs_fsm.grammar_filename_prefix_+= mpost_fsm.grammar_filename_prefix_;
prt_xrefs_docs_fsm.fq_filename_noext_+= o2_fq_fn_noext.c_str();
Parser prt_xrefs_docs(prt_xrefs_docs_fsm,&prt_xrefs_docs_can,0,0,&Error_queue);
prt_xrefs_docs.parse();

/*:128*/
//line 2047 "/usr/local/yacco2/compiler/o2/o2_defs.w"

}
/*:126*/
//line 2137 "/usr/local/yacco2/compiler/o2/o2_defs.w"


/*:130*/
//line 76 "/usr/local/yacco2/compiler/o2/prog.w"



exit:
lrclog<<"Exiting O2"<<std::endl;
return 0;
}
/*:14*//*162:*/
//line 31 "/usr/local/yacco2/compiler/o2/includes.w"


/*:162*/
//line 49 "/usr/local/yacco2/compiler/o2/includes.w"


//line 17 "./o2.w"
/*:164*/
