/*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< 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"<id__ <<" file no: "<tok_co_ords__.external_file_id__ <<" line no: "<tok_co_ords__.line_no__ <<" pos: "<tok_co_ords__.pos_in_line__ < 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 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 yes_pile; set no_pile; list< pair > maybe_list; T_rules_phrase*rules_ph= O2_RULES_PHASE; AST*rules_tree= rules_ph->phrase_tree(); set 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 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 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 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 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 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: " <total_no_subrules() <<" exceeds the allocated space for table elem_space: " <total_no_subrules() <<" exceeds the allocated space for table elem_space: " < 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 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: " <state_no_ <<" for vector: " <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: " <Please check Grammar dump file: " <state_no_<<" for details"<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<vectored_into_by_elem_; if(cstate->vectored_into_by_elem_sym_==0){ yacco2::lrclog<<" Entry Symbol: No symbol"<entry_symbol_literal()<state_no_<Please check Grammar dump file: " <Please check Grammar dump file: " <state_no_<<" for details"<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<vectored_into_by_elem_; if(cstate->vectored_into_by_elem_sym_==0){ yacco2::lrclog<<" Entry Symbol: No symbol"<entry_symbol_literal()<state_no_< 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 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 "< 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 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 -----"< 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 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"<