/*2:*/ #line 41 "./o2_types.w" #ifndef o2_types_ #define o2_types_ 1 /*3:*/ #line 52 "./o2_types.w" #define NO_BITS_PER_SET_PARTITION 8 #define CODE_PRESENCE_IN_ARBITRATOR_CODE "pp_accept_queue__" #define ACCEPT_FILTER true #define BYPASS_FILTER false #define Success true #define Failure false #define Nested_file_cnt_limit 15 #define O2_library_file "yacco2.h" #define Yacco2_holding_file "yacco2cmd.tmp" #define Linker_holding_file "linkercmd.tmp" #define Max_cweb_item_size 10*1024 #define Max_buf_size 2*1024 #define Max_no_subrules 8*1024 #define EPSILON_YES 0 #define EPSILON_NO 1 #define EPSILON_DONT_KNOW 2 #define EPSILON_MAYBE 3 #define SDC_user_imp_sym "#user-imp-sym" #define SDC_user_imp_tbl "#user-imp-tbl" #define SDC_user_prefix_declaration "#user-prefix-declaration" #define SDC_user_suffix_declaration "#user-suffix-declaration" #define SDC_user_declaration "#user-declaration" #define SDC_constructor "#constructor" #define SDC_destructor "#destructor" #define SDC_op "#op" #define SDC_failed "#failed" #define SDC_user_implementation "#user-implementation" #define SDC_user_imp_implementation "#user-imp-sym" #define SDC_user_tbl_implementation "#user-tbl-tbl" #define SDC_arbitrator_code "#arbitrator-code" #define PP_thread_name "#parallel-thread-function" #define Suffix_fsmheader ".h" #define Suffix_fsmimp ".cpp" #define Suffix_fsmsym "sym.cpp" #define Suffix_fsmtbl "tbl.cpp" #define Suffix_enumeration_hdr ".h" #define Suffix_t_alphabet ".fsc" #define Suffix_Errors_hdr ".h" #define Suffix_Errors_imp ".cpp" #define Suffix_T_hdr ".h" #define Suffix_T_imp ".cpp" #define Suffix_RC_hdr ".h" #define Suffix_RC_imp ".cpp" #define Suffix_LRK_hdr ".h" #define Suffix_LRK_imp ".cpp" #define Suffix_fsc ".fsc" #define LR1_COMPATIBLE true #define NOT_LR1_COMPATIBLE false #define MERGED true #define NOT_MERGED false #define ABORT_GENING_STATES 2 #define START_STATE_ENUMERATE -1 #define LR1_QUESTIONABLE_SHIFT_OPERATOR 0 #define LR1_QUESTIONABLE_SHIFT_OPERATOR_LITERAL "|?|" #define LR1_EOG 1 #define LR1_EOLR 2 #define LR1_EOLR_LITERAL "eolr" #define LR1_PARALLEL_OPERATOR 3 #define LR1_REDUCE_OPERATOR 4 #define LR1_REDUCE_OPERATOR_LITERAL "|r|" #define LR1_INVISIBLE_SHIFT_OPERATOR 5 #define LR1_ALL_SHIFT_OPERATOR 6 #define LR1_FSET_TRANSIENCE_OPERATOR 7 #define LR1_FSET_TRANSIENCE_OPERATOR_LITERAL "LR1_fset_transience_operator" #define LR1_PROCEDURE_CALL_OPERATOR 7 #define LR1_PROCEDURE_CALL_OPERATOR_LITERAL "|p|" #define END_OF_LR1_DEFS 7 #define SMALL_BUFFER_4K 1024*4 #define BIG_BUFFER_32K 1024*32 #define THREAD_CALL 0 #define PROCEDURE_CALL 1 #define MICROSOFT_THREAD_LIBRARY 1 #define PTHREAD_LIBRARY 0 /*:3*/ #line 44 "./o2_types.w" ; /*4:*/ #line 129 "./o2_types.w" typedef int Voc_ENO; typedef int RULE_ENO; struct state; struct state_element; struct follow_element; /*:4*//*5:*/ #line 135 "./o2_types.w" typedef std::map SDC_MAP_type; /*:5*//*6:*/ #line 137 "./o2_types.w" typedef SDC_MAP_type::iterator SDC_MAP_ITER_type; /*:6*//*7:*/ #line 139 "./o2_types.w" typedef std::vector STBL_T_ITEMS_type; /*:7*//*8:*/ #line 141 "./o2_types.w" typedef std::set T_IN_STBL_SET_type; /*:8*//*9:*/ #line 143 "./o2_types.w" typedef T_IN_STBL_SET_type::iterator T_IN_STBL_SET_ITER_type; /*:9*//*10:*/ #line 145 "./o2_types.w" typedef std::vector T_IN_STBL_SORTED_SET_type; /*:10*//*11:*/ #line 147 "./o2_types.w" typedef T_IN_STBL_SORTED_SET_type::iterator T_IN_STBL_SORTED_SET_ITER_type; /*:11*//*12:*/ #line 149 "./o2_types.w" typedef std::set RULE_IN_STBL_SET_type; /*:12*//*13:*/ #line 151 "./o2_types.w" typedef RULE_IN_STBL_SET_type::iterator RULE_IN_STBL_SET_ITER_type; /*:13*//*14:*/ #line 153 "./o2_types.w" typedef std::vector O2_PHRASE_TBL_type; /*:14*//*15:*/ #line 155 "./o2_types.w" typedef O2_PHRASE_TBL_type::iterator O2_PHRASE_TBL_ITER_type; /*:15*//*16:*/ #line 157 "./o2_types.w" typedef std::set RULES_IN_FS_SET_type; /*:16*//*17:*/ #line 159 "./o2_types.w" typedef RULES_IN_FS_SET_type::iterator RULES_IN_FS_SET_ITER_type; /*:17*//*18:*/ #line 161 "./o2_types.w" typedef std::vector RULE_DEFS_TBL_type; /*:18*//*19:*/ #line 163 "./o2_types.w" typedef RULE_DEFS_TBL_type::iterator RULE_DEFS_TBL_ITER_type; /*:19*//*20:*/ #line 165 "./o2_types.w" typedef std::vector SUBRULE_DEFS_type; /*:20*//*21:*/ #line 167 "./o2_types.w" typedef SUBRULE_DEFS_type::iterator SUBRULE_DEFS_ITER_type; /*:21*//*22:*/ #line 169 "./o2_types.w" typedef std::map T_DEF_MAP_type; /*:22*//*23:*/ #line 171 "./o2_types.w" typedef T_DEF_MAP_type::iterator T_DEF_MAP_ITER_type; /*:23*//*24:*/ #line 173 "./o2_types.w" typedef std::set INT_SET_type; /*:24*//*25:*/ #line 175 "./o2_types.w" typedef INT_SET_type::iterator INT_SET_ITER_type; /*:25*//*26:*/ #line 177 "./o2_types.w" typedef std::map INT_STR_MAP_type; /*:26*//*27:*/ #line 179 "./o2_types.w" typedef INT_STR_MAP_type::iterator INT_STR_MAP_ITER_type; /*:27*//*28:*/ #line 181 "./o2_types.w" typedef std::set STR_SET_type; /*:28*//*29:*/ #line 183 "./o2_types.w" typedef STR_SET_type::iterator STR_SET_ITER_type; /*:29*//*30:*/ #line 185 "./o2_types.w" typedef std::map T_IN_STBL_SET_STR_MAP_type; /*:30*//*31:*/ #line 187 "./o2_types.w" typedef T_IN_STBL_SET_STR_MAP_type::iterator T_IN_STBL_SET_STR_MAP_ITER_type; /*:31*//*32:*/ #line 189 "./o2_types.w" typedef std::list STATES_type; /*:32*//*33:*/ #line 191 "./o2_types.w" typedef STATES_type::iterator STATES_ITER_type; /*:33*//*34:*/ #line 193 "./o2_types.w" typedef int Voc_ENO; /*:34*//*35:*/ #line 195 "./o2_types.w" typedef int RULE_ENO; /*:35*//*36:*/ #line 197 "./o2_types.w" typedef int T_ENO; /*:36*//*37:*/ #line 200 "./o2_types.w" typedef std::set RULE_NOS_SET_type; /*:37*//*38:*/ #line 203 "./o2_types.w" typedef RULE_NOS_SET_type::iterator RULE_NOS_SET_ITER_type; /*:38*//*39:*/ #line 206 "./o2_types.w" typedef std::set STATES_SET_type; /*:39*//*40:*/ #line 209 "./o2_types.w" typedef STATES_SET_type::iterator STATES_SET_ITER_type; /*:40*//*41:*/ #line 212 "./o2_types.w" typedef std::map LR1_STATES_type; /*:41*//*42:*/ #line 215 "./o2_types.w" typedef LR1_STATES_type::iterator LR1_STATES_ITER_type; /*:42*//*43:*/ #line 218 "./o2_types.w" typedef std::list S_VECTOR_ELEMS_type; /*:43*//*44:*/ #line 221 "./o2_types.w" typedef S_VECTOR_ELEMS_type::iterator S_VECTOR_ELEMS_ITER_type; /*:44*//*45:*/ #line 231 "./o2_types.w" typedef std::map S_VECTORS_type; /*:45*//*46:*/ #line 233 "./o2_types.w" typedef S_VECTORS_type::iterator S_VECTORS_ITER_type; /*:46*//*47:*/ #line 235 "./o2_types.w" typedef std::set FOLLOW_SETS_type; /*:47*//*48:*/ #line 237 "./o2_types.w" typedef FOLLOW_SETS_type::iterator FOLLOW_SETS_ITER_type; /*:48*//*49:*/ #line 239 "./o2_types.w" typedef std::set LA_SET_type; /*:49*//*50:*/ #line 241 "./o2_types.w" typedef LA_SET_type::iterator LA_SET_ITER_type; /*:50*//*51:*/ #line 243 "./o2_types.w" typedef std::set SHIFT_SET_type; /*:51*//*52:*/ #line 245 "./o2_types.w" typedef SHIFT_SET_type::iterator SHIFT_SET_ITER_type; /*:52*//*53:*/ #line 247 "./o2_types.w" typedef std::list TRANSITIONS_type; /*:53*//*54:*/ #line 249 "./o2_types.w" typedef TRANSITIONS_type::iterator TRANSITIONS_ITER_type; /*:54*//*55:*/ #line 251 "./o2_types.w" typedef std::list MERGES_type; /*:55*//*56:*/ #line 253 "./o2_types.w" typedef MERGES_type::iterator MERGES_ITER_type; /*:56*//*57:*/ #line 259 "./o2_types.w" typedef std::list SR_ELEMENTS_type; /*:57*//*58:*/ #line 264 "./o2_types.w" typedef std::map S_FOLLOW_SETS_type; /*:58*//*59:*/ #line 267 "./o2_types.w" typedef S_FOLLOW_SETS_type::iterator S_FOLLOW_SETS_ITER_type; /*:59*//*60:*/ #line 276 "./o2_types.w" typedef std::list S_CONFLICT_STATES_type; /*:60*//*61:*/ #line 279 "./o2_types.w" typedef S_CONFLICT_STATES_type::iterator S_CONFLICT_STATES_ITER_type; /*:61*//*62:*/ #line 282 "./o2_types.w" typedef std::set CLOSURE_RULES_type; /*:62*//*63:*/ #line 285 "./o2_types.w" typedef CLOSURE_RULES_type::iterator CLOSURE_RULES_ITER_type; /*:63*//*64:*/ #line 288 "./o2_types.w" typedef std::set FOLLOW_RULES_type; /*:64*//*65:*/ #line 291 "./o2_types.w" typedef FOLLOW_RULES_type::iterator FOLLOW_RULES_ITER_type; /*:65*//*66:*/ #line 294 "./o2_types.w" typedef std::set FIRST_SET_type; /*:66*//*67:*/ #line 297 "./o2_types.w" typedef FIRST_SET_type::iterator FIRST_SET_ITER_type; /*:67*//*68:*/ #line 299 "./o2_types.w" typedef vector T_COUNT_type; /*:68*//*69:*/ #line 301 "./o2_types.w" typedef T_COUNT_type::iterator T_COUNT_ITER_type; /*:69*//*70:*/ #line 303 "./o2_types.w" typedef vector STBL_T_ITEMS_type; /*:70*//*71:*/ #line 305 "./o2_types.w" typedef STBL_T_ITEMS_type::iterator STBL_T_ITEMS_ITER_type; /*:71*//*72:*/ #line 307 "./o2_types.w" typedef std::set RULES_HAVING_AR_type; /*:72*//*73:*/ #line 309 "./o2_types.w" typedef RULES_HAVING_AR_type::iterator RULES_HAVING_AR_ITER_type; /*:73*//*74:*/ #line 311 "./o2_types.w" typedef std::vector COMMON_LA_SETS_type; /*:74*//*75:*/ #line 313 "./o2_types.w" typedef COMMON_LA_SETS_type::iterator COMMON_LA_SETS_ITER_type; /*:75*//*76:*/ #line 315 "./o2_types.w" typedef std::map BIT_MAP_type; /*:76*//*77:*/ #line 317 "./o2_types.w" typedef BIT_MAP_type::iterator BIT_MAP_ITER_type; /*:77*//*78:*/ #line 320 "./o2_types.w" struct use_cnt_type{ rule_def*for_rule_use_cnt_; rule_def*against_rule_; int use_cnt_; use_cnt_type(rule_def*R,rule_def*S):for_rule_use_cnt_(R),against_rule_(S),use_cnt_(0){}; use_cnt_type(const use_cnt_type&C):for_rule_use_cnt_(C.for_rule_use_cnt_) ,against_rule_(C.against_rule_),use_cnt_(C.use_cnt_){}; }; typedef std::map CYCLIC_USE_TBL_type; typedef CYCLIC_USE_TBL_type::iterator CYCLIC_USE_TBL_ITER_type; /*:78*//*79:*/ #line 331 "./o2_types.w" typedef std::set SET_FILTER_type; /*:79*//*80:*/ #line 333 "./o2_types.w" typedef tok_can TOK_CAN_TREE_type; /*:80*/ #line 45 "./o2_types.w" ; /*82:*/ #line 567 "./o2_types.w" struct gen_context{ state*for_closure_state_; Voc_ENO gen_vector_; gen_context(state*S,Voc_ENO Ve); }; /*:82*//*83:*/ #line 587 "./o2_types.w" struct state_element{ gen_context cs_vector_combo_gening_it_; LA_SET_type*la_set_; state*closure_state_; state*goto_state_; state*reduced_state_; state*previous_state_; state*self_state_; state*closured_state_gening_it_; state_element*previous_state_element_; state_element*next_state_element_; AST*sr_element_; CAbs_lr1_sym*sr_def_element_; T_subrule_def*subrule_def_; int common_la_set_idx_; int its_enum_id_; state_element(AST*Elem); ~state_element(); void fill_la_from_merge(state_element&La_to_fill_in,MERGES_type&Merge,RULE_ENO Rule_no); void fill_la_from_transition(state_element&La_to_fill_in,TRANSITIONS_type&Transition); bool calc_la(state_element&La_to_fill_in); void add_fs_setA_to_LA(follow_element&Fe,LA_SET_type&La_to_fill_in); RULE_ENO find_state_element_s_rule_no(); }; /*:83*//*84:*/ #line 625 "./o2_types.w" struct follow_element{ RULE_ENO rule_no_; AST*rule_def_t_; state*its_state_; FOLLOW_SETS_type follow_set_; TRANSITIONS_type transitions_; MERGES_type merges_; SR_ELEMENTS_type sr_elements_; void add_T_to_follow_set(AST*T_element); void add_follow_set_contributor(AST*SR_element); void add_follow_set_transition(state_element&State_elem,T_eosubrule&Eos); void add_follow_set_transition(state_element&State_elem,T_called_thread_eosubrule&Eos); void add_follow_set_transition(state_element&State_elem,T_null_call_thread_eosubrule&Eos); AST*rule_def_t(); state*its_state(); follow_element(RULE_ENO Rule_no,state_element&State_elem,AST&Rule_def_t); follow_element(state*State); void remove_merge_closure_info(); void add_merge_closure_info(state&To_merge_closure_state); }; /*:84*//*85:*/ #line 677 "./o2_types.w" struct state{ gen_context cs_vector_combo_gening_it_; Voc_ENO vectored_into_by_elem_; CAbs_lr1_sym*vectored_into_by_elem_sym_; int state_no_; CLOSURE_RULES_type closure_rule_list_; CLOSURE_RULES_type derives_closure_rule_list_; FOLLOW_RULES_type follow_rule_list_; void add_closure_rules_subrules_to_state(gen_context&Possible_gen_context,state&Closure_state); void add_rule_s_subrules_to_state(AST&Start_Rule_def_t,gen_context&Possible_gen_context,state&Closure_state_associate_with); bool crt_core_items_of_state (S_VECTOR_ELEMS_ITER_type&Iter_begin ,S_VECTOR_ELEMS_ITER_type&Iter_end ,gen_context&Gening_context); S_VECTORS_type state_s_vector_; S_FOLLOW_SETS_type state_s_follow_set_map_; S_CONFLICT_STATES_type state_s_conflict_state_list_; void add_element_to_state_vector(Voc_ENO Elem_id,state_element&Elem); void add_rule_to_closure_list(rule_in_stbl*Rule_in_stbl); void add_rule_to_follow_list(RULE_ENO Refered_rule); void create_follow_sets_of_state(); void create_start_state(AST&Start_rule_t); bool gen_transitive_states_for_closure_context(gen_context&For_gening_context,state&For_closure_state,state&State); bool gen_transitive_states_balance_for_closure_vector(gen_context&Gen_context,state&For_closure_state,state&Goto_state); state(Voc_ENO Eno,CAbs_lr1_sym*Entry_sym); state(AST*Start_rule_t); bool gen_a_state (gen_context&For_gening_context ,state&For_closure_state ,state&Requesting_state,S_VECTORS_ITER_type&Elem_iter); const char*entry_symbol_literal(); void add_state_to_gbl_lr1_state_tbls(state*State); void add_state_to_conflict_states_list_if(gen_context&Gening_context,state&State); state*closure_state_birthing_it_; bool is_state_lr1_compatible(state&State_to_eval); int are_2_states_compatible_yes_merge(state&To_merge_into_state,state&State_for_merging); void merge_state(state&To_merge_into_state,state&State_for_merging); int find_2_states_compatible_and_merge(state&State_for_merging); bool are_states_equivalent(state&Merge_into_state,state&To_merge_state); bool are_gened_states_lr1_compatible(); bool is_str_rt_bnded(AST*Str); bool is_str_epsilonable(AST*Str); void crt_start_rule_s_follow_set(AST&Str); state(); void closure_only_derives(AST*Rule_tree); int determine_reduced_state_type(state*S); int state_type_; string*arbitrator_name_; }; /*:85*/ #line 46 "./o2_types.w" ; #endif /*:2*/