/*35:*/
//#line 446 "/usr/local/yacco2/library/intro.w"

/*565:*/
//#line 24 "/usr/local/yacco2/library/macros.w"



/*:565*/
//#line 447 "/usr/local/yacco2/library/intro.w"

#ifndef yacco2_
#define yacco2_ 1
/*29:*/
//#line 416 "/usr/local/yacco2/library/intro.w"

#include "yacco2_compile_symbols.h"

/*:29*/
//#line 450 "/usr/local/yacco2/library/intro.w"

#define START_OF_LRK_ENUMERATE 0
#define END_OF_LRK_ENUMERATE 7
#define START_OF_RC_ENUMERATE END_OF_LRK_ENUMERATE+1
#define END_OF_RC_ENUMERATE START_OF_RC_ENUMERATE+256-1
#define START_OF_ERROR_ENUMERATE END_OF_RC_ENUMERATE+1
#define SEQ_SRCH_VS_BIN_SRCH_LIMIT 71
#define MAX_UINT (0xffffffff) 
#define MAX_USINT 256*256-1
#define MAX_LR_STK_ITEMS 256
#define C_MAX_LR_STK_ITEMS MAX_LR_STK_ITEMS+1
#define BITS_PER_WORD 32
#define BITS_PER_WORD_REL_0 BITS_PER_WORD-1
#define MAX_NO_THDS 1024
#define START_OF_RC_ENUM 8
#define SIZE_CAbs_lr1_sym 56
#define NO_CAbs_lr1_sym_ENTRIES 1024*1024
#define SIZE_RC_MALLOC NO_CAbs_lr1_sym_ENTRIES*SIZE_CAbs_lr1_sym
#define ASCII_8_BIT 256
#define START_LINE_NO 1
#define START_CHAR_POS 0
#define LINE_FEED 10
#define EOF_CHAR_SUB 256
#define YES true
#define NO false
#define ON true
#define OFF false
#define BUFFER_SIZE 1024*4
#define BIG_BUFFER_32K 1024*32
#define SMALL_BUFFER_4K 1024*4
#define THREAD_WORKING 0
#define THREAD_WAITING_FOR_WORK 1
#define ALL_THREADS_BUSY 2
#define NO_THREAD_AT_ALL 3
#define THREAD_TO_EXIT 4
#define EVENT_RECEIVED 0
#define WAIT_FOR_EVENT 1
#define Token_start_pos 0
#define No_Token_start_pos Token_start_pos-1
#define CALLED_AS_THREAD true
#define CALLED_AS_PROC false
#define ACCEPT_FILTER true
#define BYPASS_FILTER false
#define Recursion_count()  \
int RECURSION_INDEX__(0) ; \

#define FORCE_STK_TRACE 0
#define COND_STK_TRACE 1
#define Accept_parallel_parse 1
#define Shutdown 2
#define LR1_Questionable_operator 0
#define LR1_Eog 1
#define LR1_Eolr 2
#define LR1_Parallel_operator 3
#define LR1_Reduce_operator 4
#define LR1_Invisible_shift_operator 5
#define LR1_All_shift_operator 6
#define LR1_FSET_transience_operator 7
#define LR1_Procedure_call_operator 7 \

#define SET_ELEM_NO_BITS 8
#define Remap_token(Token)  \
if(sym_lookup_functor__==0) return Token; \
if(sym_lookup_functor__->lkup__==OFF) { \
return Token; \
} \
CAbs_lr1_sym*x= sym_lookup_functor__->operator() (Token) ; \
if(x==0) return Token;
#define Remap_set_result_and_return(Token)  \
Token= x; \
return Token;
#define Remap_return_result return x;
#define EXTERNAL_GPSing(TOK__)  \
if(TOK__->tok_co_ords__.external_file_id__<yacco2::FILE_TBL__.size() ) { \
yacco2::lrclog<<yacco2::FILE_TBL__[TOK__->tok_co_ords__.external_file_id__].c_str() ; \
}else{ \
yacco2::lrclog<<" EXTERNAL_GPSing - No external file registered to use" \
<<" stack subscript: " \
<<TOK__->tok_co_ords__.external_file_id__; \
}
#define FILE_LINE ' '<<__FILE__<<": "<<__LINE__ \

#define T_CTOR(A,B,C,D,E)  \
:CAbs_lr1_sym(A,C,B,D,E) 
#define T_CTOR_RW(A,B,C,D,E,F,G)  \
:CAbs_lr1_sym(A,C,B,D,E,F,G) 
#define YACCO2_define_trace_variables()  \
int yacco2::YACCO2_T__(OFF) ; \
int yacco2::YACCO2_TLEX__(OFF) ; \
int yacco2::YACCO2_MSG__(OFF) ; \
int yacco2::YACCO2_TH__(OFF) ; \
int yacco2::YACCO2_AR__(OFF) ; \
int yacco2::YACCO2_THP__(OFF) ; \
int yacco2::YACCO2_MU_TRACING__(OFF) ; \
int yacco2::YACCO2_MU_TH_TBL__(OFF) ; \
int yacco2::YACCO2_MU_GRAMMAR__(OFF) ; \

#define ADD_TOKEN_TO_RECYCLE_BIN(Token)  \
rule_info__.parser__->add_token_to_recycle_bin(Token) 
#define DELETE_T_SYM(T)  \
if(T!=0) { \
if(T->enumerated_id__> END_OF_RC_ENUMERATE) { \
if(T->dtor__!=0) { \
(*T->dtor__) (T,0) ; \
} \
delete T; \
} \
}
#define RSVP(Token)  \
rule_info__.parser__->pp_rsvp__.fill_it(*rule_info__.parser__ \
,*Token,Token->tok_co_ords__.rc_pos__ \
,*rule_info__.parser__->current_token__ \
,rule_info__.parser__->current_token_pos__)  \

#define RSVP_WLA(Token,LATOK,LAPOS)  \
rule_info__.parser__->pp_rsvp__.fill_it(*rule_info__.parser__ \
,*Token,Token->tok_co_ords__.rc_pos__ \
,*LATOK \
,LAPOS)  \

#define RSVP_FSM(Token)  \
parser__->pp_rsvp__.fill_it(*parser__ \
,*Token,Token->tok_co_ords__.rc_pos__ \
,*parser__->current_token__,parser__->current_token_pos__)  \

#define ADD_TOKEN_TO_PRODUCER_QUEUE(TOKEN)  \
rule_info__.parser__->add_token_to_producer(TOKEN) 
#define ADD_TOKEN_TO_ERROR_QUEUE(TOKEN) rule_info__.parser__->add_token_to_error_queue(TOKEN) 
#define ADD_TOKEN_TO_ERROR_QUEUE_FSM(TOKEN) parser__->add_token_to_error_queue(TOKEN)  \
 \

#define ssNEW_TRACEss(ssPss,ssQss)  \
yacco2::lrclog<<"\t!!!!! new adr: "<<(void*) ssPss \
<<" "<<#ssQss<<' '<<__FILE__<<':'<<__LINE__<<std::endl; \
yacco2::lrclog<<"\tfile: "<<__FILE__<<" line: "<<__LINE__<<std::endl; \

#define ssP_TRACEss(ssPss,ssQss)  \
yacco2::lrclog \
<<'\t'<<Parse_env->thread_no__ \
<<"\t!!!!! new adr: "<<(void*) ssPss \
<<" "<<#ssQss<<FILE_LINE<<std::endl; \
yacco2::lrclog \
<<"\tfile: "<<__FILE__<<" line: "<<__LINE__<<std::endl; \

#define sstrace_terminalsss  \
if(yacco2::YACCO2_TLEX__) { \
bool to_trace_or_not_to= trace_parser_env(rule_info__.parser__,FORCE_STK_TRACE) ; \
if(to_trace_or_not_to==true) { \
yacco2::lrclog \
<<"\tYACCO2_TLEX__::"<<rule_info__.parser__->thread_no__ \
<<rule_info__.parser__->fsm_tbl__->id__<<"::"<<id__<<"::op()\n"; \
} \
} \

#define sstrace_rulesss  \
if(yacco2::YACCO2_TLEX__) { \
bool to_trace_or_not_to= trace_parser_env(rule_info__.parser__,FORCE_STK_TRACE) ; \
if(to_trace_or_not_to==true) { \
yacco2::lrclog<<"\tYACCO2_TLEX__::"<<rule_info__.parser__->thread_no__ \
<<"::"<<rule_info__.parser__->fsm_tbl__->id__<<"::"<<id__<<"::op()\n"; \
} \
} \

#define sstrace_sub_rulesss  \
if(yacco2::YACCO2_TLEX__) { \
bool to_trace_or_not_to= trace_parser_env(rule_info__.parser__,FORCE_STK_TRACE) ; \
if(to_trace_or_not_to==true) { \
yacco2::lrclog<<"\tYACCO2_TLEX__::"<<rule_info__.parser__->thread_no__ \
<<"::"<<rule_info__.parser__->fsm_tbl__->id__<<"::"<<id__<<"::op()\n"; \
} \
} \

#define sstrace_stack_rtnsss  \
if(yacco2::YACCO2_TLEX__) { \
bool to_trace_or_not_to= trace_parser_env(Parse_env,FORCE_STK_TRACE) ) ; \
if(to_trace_or_not_to==true) { \
yacco2::lrclog \
<<"\tYACCO2_TLEX__::"<<Parse_env->thread_no__ \
<<"::"<<Parse_env->fsm_tbl__->id__<<"::op() sym: "<<id__ \
<<FILE_LINE<<std::endl; \
} \
} \
 \


//#line 451 "/usr/local/yacco2/library/intro.w"

/*14:*/
//#line 300 "/usr/local/yacco2/library/intro.w"

/*32:*/
//#line 429 "/usr/local/yacco2/library/intro.w"

#include <stdlib.h> 
#include <limits.h> 
#include <assert.h> 
#include "std_includes.h"
#include <time.h> 

/*:32*/
//#line 301 "/usr/local/yacco2/library/intro.w"


//#line 1 "/usr/local/yacco2/library/gbl_defs.w"







/*:14*//*138:*/
//#line 57 "/usr/local/yacco2/library/wthread.w"

#if THREAD_LIBRARY_TO_USE__ == 1
#include <windows.h> 
#include <process.h> 
#elif THREAD_LIBRARY_TO_USE__ == 0
#include <pthread.h> 
#endif
/*:138*/
//#line 452 "/usr/local/yacco2/library/intro.w"


/*24:*/
//#line 396 "/usr/local/yacco2/library/intro.w"

namespace yacco2{

/*:24*/
//#line 454 "/usr/local/yacco2/library/intro.w"

/*16:*/
//#line 308 "/usr/local/yacco2/library/intro.w"

typedef const char*KCHARP;
typedef unsigned char UCHAR;
typedef char CHAR;
typedef UCHAR*UCHARP;
typedef unsigned short int USINT;
typedef short int SINT;
typedef CHAR*CHARP;
typedef const void*KVOIDP;
typedef void*VOIDP;
typedef int INT;
typedef unsigned int UINT;
typedef unsigned int ULINT;
typedef void(*FN_DTOR)(VOIDP This,VOIDP Parser);
typedef UCHARP LA_set_type;
typedef LA_set_type LA_set_ptr;
struct CAbs_lr1_sym;
struct State;
struct Parser;
struct Shift_entry;
struct Shift_tbl;
struct Reduce_tbl;
struct State_s_thread_tbl;
struct Thread_entry;
struct T_array_having_thd_ids;
struct Set_entry;
struct Recycled_rule_struct;
struct Rule_s_reuse_entry;
typedef Shift_entry Shift_entry_array_type[1024*100];
typedef Set_entry Set_entry_array_type[1024*100];
/*:16*//*44:*/
//#line 57 "/usr/local/yacco2/library/set.w"

typedef std::map<yacco2::USINT,yacco2::USINT> yacco2_set_type;
typedef yacco2_set_type::iterator yacco2_set_iter_type;

/*:44*//*124:*/
//#line 75 "/usr/local/yacco2/library/parse_env.w"

struct Cparse_record{
void set_aborted(bool X);
bool aborted()const;
yacco2::CAbs_lr1_sym*symbol();
void set_symbol(yacco2::CAbs_lr1_sym*Symbol);
yacco2::State*state();
void set_state(yacco2::State*State_no);
void set_rule_s_reuse_entry(yacco2::Rule_s_reuse_entry*Rule_s_reuse);
yacco2::Rule_s_reuse_entry*rule_s_reuse_entry();
yacco2::CAbs_lr1_sym*symbol__;
yacco2::State*state__;
bool aborted__;
yacco2::Rule_s_reuse_entry*rule_s_reuse_entry_ptr__;
};

/*:124*//*125:*/
//#line 94 "/usr/local/yacco2/library/parse_env.w"

struct lr_stk{
lr_stk();
void lr_stk_init(yacco2::State&S1);
void push_state(yacco2::State&S1);
void push_symbol(yacco2::CAbs_lr1_sym&Sym);
bool empty();
void pop();
void clean_up();
Cparse_record*sf_by_sub(yacco2::UINT Sub);
Cparse_record*sf_by_top(yacco2::UINT No);
Cparse_record lr_stk__[C_MAX_LR_STK_ITEMS];
yacco2::UINT top_sub__;
Cparse_record*top__;
Cparse_record*first_sf__;
State*first_state__;
};

/*:125*//*139:*/
//#line 65 "/usr/local/yacco2/library/wthread.w"

typedef void*LPVOID;
#if THREAD_LIBRARY_TO_USE__ == 1
#define _YACCO2_CALL_TYPE 
typedef HANDLE MUTEX;
typedef unsigned int THREAD_NO;
typedef HANDLE THREAD;
typedef HANDLE COND_VAR;
typedef uintptr_t THR;
typedef int THR_result;
typedef THR(
_YACCO2_CALL_TYPE
*Type_pp_fnct_ptr)(yacco2::Parser*PP_requestor);
typedef THR_result(
_YACCO2_CALL_TYPE
*Type_pc_fnct_ptr)(yacco2::Parser*PP_requestor);
typedef THR(
--stdcall
*Type_pp_fnct_ptr_voidp)(yacco2::LPVOID PP_requestor);
#elif THREAD_LIBRARY_TO_USE__ == 0
#define _YACCO2_CALL_TYPE
typedef pthread_mutex_t MUTEX;
typedef pthread_t THREAD_NO;
typedef pthread_cond_t COND_VAR;
typedef void*LPVOID;
typedef LPVOID THR;
typedef int THR_result;
typedef pthread_t THREAD;
typedef THR(*Type_pp_fnct_ptr)(yacco2::Parser*PP_requestor);
typedef THR(*Type_pp_fnct_ptr_voidp)(yacco2::LPVOID PP_requestor);
typedef THR_result(*Type_pc_fnct_ptr)(yacco2::Parser*PP_requestor);
#endif
typedef std::vector<yacco2::Thread_entry*> yacco2_threads_to_run_type;
typedef yacco2_threads_to_run_type::iterator yacco2_threads_to_run_iter_type;

/*:139*//*170:*/
//#line 22 "/usr/local/yacco2/library/thread.w"

struct worker_thread_blk;
typedef std::list<yacco2::worker_thread_blk*> Parallel_thread_list_type;
typedef Parallel_thread_list_type::iterator Parallel_thread_list_iterator_type;
typedef std::vector<yacco2::Parallel_thread_list_type> Parallel_thread_tbl_type;
typedef Parallel_thread_tbl_type::iterator Parallel_thread_tbl_iterator_type;
struct called_proc_entry{
bool proc_call_in_use__;
};
typedef called_proc_entry Parallel_thread_proc_call_table_type;

/*:170*//*316:*/
//#line 1830 "/usr/local/yacco2/library/parser.w"

struct Caccept_parse;
#define pp_accept_queue_size 8
typedef yacco2::Caccept_parse pp_accept_queue_type[pp_accept_queue_size];


/*:316*//*423:*/
//#line 35 "/usr/local/yacco2/library/runtime_env.w"

typedef std::vector<std::string> gbl_file_map_type;

/*:423*//*431:*/
//#line 203 "/usr/local/yacco2/library/runtime_env.w"

typedef std::set<yacco2::CAbs_lr1_sym*> set_of_objs_type;
typedef set_of_objs_type::iterator set_of_objs_iter_type;

/*:431*/
//#line 455 "/usr/local/yacco2/library/intro.w"

/*21:*/
//#line 385 "/usr/local/yacco2/library/intro.w"


/*:21*//*172:*/
//#line 67 "/usr/local/yacco2/library/thread.w"

extern Parallel_thread_tbl_type Parallel_thread_table;
extern Parallel_thread_proc_call_table_type Parallel_thread_proc_call_table[MAX_NO_THDS];
/*:172*//*424:*/
//#line 39 "/usr/local/yacco2/library/runtime_env.w"

extern std::list<std::string> O2_LOGICALS__;
extern std::ofstream lrclog;
extern std::ofstream lrerrors;
extern yacco2::KCHARP Lr1_VERSION;
extern yacco2::KCHARP O2linker_VERSION;
extern yacco2::MUTEX TRACE_MU;
extern yacco2::MUTEX TH_TBL_MU;
extern yacco2::MUTEX SYM_TBL_MU;
extern yacco2::MUTEX TOKEN_MU;
extern yacco2::gbl_file_map_type FILE_TBL__;
extern yacco2::UINT FILE_CNT__;
extern std::vector<yacco2::UINT> STK_FILE_NOS__;
struct rc_map;
extern yacco2::rc_map RC__;


/*:424*//*425:*/
//#line 63 "/usr/local/yacco2/library/runtime_env.w"

extern yacco2::Set_entry LRK_LA_EOLR_SET;

/*:425*//*426:*/
//#line 73 "/usr/local/yacco2/library/runtime_env.w"

extern yacco2::Set_entry LRK_LA_QUE_SET;

/*:426*/
//#line 456 "/usr/local/yacco2/library/intro.w"

/*20:*/
//#line 373 "/usr/local/yacco2/library/intro.w"

extern int YACCO2_T__;
extern int YACCO2_TLEX__;
extern int YACCO2_MSG__;
extern int YACCO2_TH__;
extern int YACCO2_AR__;
extern int YACCO2_THP__;
extern int YACCO2_MU_TRACING__;
extern int YACCO2_MU_TH_TBL__;
extern int YACCO2_MU_GRAMMAR__;

/*:20*/
//#line 457 "/usr/local/yacco2/library/intro.w"

/*19:*/
//#line 362 "/usr/local/yacco2/library/intro.w"


extern void*THDS_STABLE__;
extern void*T_ARRAY_HAVING_THD_IDS__;
extern void*BIT_MAPS_FOR_SALE__;
extern int TOTAL_NO_BIT_WORDS__;
extern int BIT_MAP_IDX__;
extern CAbs_lr1_sym*PTR_LR1_eog__;

/*:19*/
//#line 458 "/usr/local/yacco2/library/intro.w"

/*18:*/
//#line 346 "/usr/local/yacco2/library/intro.w"



/*:18*//*45:*/
//#line 73 "/usr/local/yacco2/library/set.w"

struct Set_entry{
yacco2::UCHAR partition__;
yacco2::UCHAR elements__;
};
struct Set_tbl{
yacco2::UCHAR no_entries__;
yacco2::Set_entry first_entry__[1];
};

/*:45*//*51:*/
//#line 10 "/usr/local/yacco2/library/tblkup.w"

template<typename Functor>
struct functor2{
struct functor{};
void operator()(Functor*Func){Func->operator()();};
};
template<typename T>
class tble_lkup:public std::unary_function<T,T>{
public:
tble_lkup():lkup__(ON){};
~tble_lkup(){};
virtual T operator()(T t)= 0;
void turn_off_lkup(){
lkup__= OFF;

};
void turn_on_lkup(){
lkup__= ON;

};
bool lkup(){return lkup__;};
bool lkup__;
};

/*:51*//*52:*/
//#line 35 "/usr/local/yacco2/library/tblkup.w"

typedef tble_lkup<yacco2::CAbs_lr1_sym*> tble_lkup_type;
//#line 1 "/usr/local/yacco2/library/rc.w"








/*:52*//*53:*/
//#line 27 "/usr/local/yacco2/library/rc.w"

struct rc_map{
enum rc_size{rc_size_= ASCII_8_BIT+1};
yacco2::CAbs_lr1_sym*
map_char_to_raw_char_sym(yacco2::UINT Char,yacco2::UINT File,yacco2::UINT Pos
,UINT*Line_no,UINT*Pos_in_line);
static char array_chr_sym__[SIZE_RC_MALLOC];
static INT current_rc_malloc_sub__;
static yacco2::KCHARP chr_literal__[ASCII_8_BIT];
};
/*:53*//*58:*/
//#line 52 "/usr/local/yacco2/library/CAbs_lr1_sym.w"

struct CAbs_lr1_sym{
CAbs_lr1_sym(
yacco2::KCHARP Id
,yacco2::FN_DTOR Dtor
,yacco2::USINT Enum_id
,bool Auto_delete
,bool Affected_by_abort);

CAbs_lr1_sym(
yacco2::KCHARP Id
,yacco2::FN_DTOR Dtor
,yacco2::USINT Enum_id
,bool Auto_delete
,bool Affected_by_abort
,yacco2::USINT Ext_file_no
,yacco2::UINT Rc_pos);

CAbs_lr1_sym(
yacco2::KCHARP Id
,yacco2::FN_DTOR Dtor
,yacco2::USINT Enum_id
,yacco2::Parser*P
,bool Auto_delete= false
,bool Affected_by_abort= false);

yacco2::KCHARP id()const;
yacco2::USINT enumerated_id()const;
void set_enumerated_id(yacco2::USINT Id);
void set_auto_delete(bool X);
bool auto_delete()const;
void set_affected_by_abort(bool X);
bool affected_by_abort()const;
yacco2::UINT rc_pos();
void set_rc_pos(yacco2::UINT Pos);
yacco2::UINT external_file_id();
void set_external_file_id(yacco2::UINT File);
void set_rc(yacco2::CAbs_lr1_sym&Rc
,yacco2::KCHARP GPS_FILE= __FILE__,yacco2::UINT GPS_LINE= __LINE__);
yacco2::UINT line_no();
void set_line_no(yacco2::UINT Line_no);
yacco2::UINT pos_in_line();
void set_pos_in_line(yacco2::UINT Pos_in_line);
void set_line_no_and_pos_in_line(yacco2::CAbs_lr1_sym&Rc);
void set_line_no_and_pos_in_line(yacco2::UINT Line_no,yacco2::UINT Pos_in_line);
void set_who_created(yacco2::KCHARP File,yacco2::UINT Line_no);
yacco2::UINT who_line_no();
yacco2::KCHARP who_file();
yacco2::Parser*parser();
yacco2::FN_DTOR dtor();
yacco2::USINT rhs_no_of_parms();
yacco2::KCHARP id__;
yacco2::FN_DTOR dtor__;
yacco2::USINT enumerated_id__;
bool auto_delete__;
bool affected_by_abort__;
UCHAR enum_id_set_partition_no()const;
UCHAR enum_id_set_member()const;

struct tok_co_ordinates{
yacco2::KCHARP who_file__;
yacco2::UINT who_line_no__;
yacco2::UINT rc_pos__;
yacco2::UINT line_no__;
yacco2::USINT external_file_id__;
yacco2::USINT pos_in_line__;
Set_entry set_entry__;
};
struct rule_info{
yacco2::Parser*parser__;
yacco2::USINT rhs_no_of_parms__;
};
union{
tok_co_ordinates tok_co_ords__;
rule_info rule_info__;
};
};

/*:58*//*78:*/
//#line 48 "/usr/local/yacco2/library/tok_can.w"

extern void LOCK_MUTEX(yacco2::MUTEX&Mu);
extern void UNLOCK_MUTEX(yacco2::MUTEX&Mu);
extern
void LOCK_MUTEX_OF_CALLED_PARSER
(yacco2::MUTEX&Mu,yacco2::Parser&parser,const char*Text);
extern
void UNLOCK_MUTEX_OF_CALLED_PARSER
(yacco2::MUTEX&Mu,yacco2::Parser&parser,const char*Text);

/*:78*//*79:*/
//#line 61 "/usr/local/yacco2/library/tok_can.w"

struct tok_base{
tok_base(USINT RW):r_w_cnt__(RW){};
virtual yacco2::UINT size()= 0;
virtual yacco2::CAbs_lr1_sym*operator[](yacco2::UINT Pos)= 0;
virtual void push_back(yacco2::CAbs_lr1_sym&Tok)= 0;
virtual void clear()= 0;
virtual bool empty()= 0;
USINT r_w_cnt__;
};

template<typename Container> 
class tok_can:public tok_base{
public:
typedef Container value_type;
typedef typename Container::size_type size_type;
typedef typename Container::difference_type difference_type;

typedef typename Container::iterator iterator;
typedef typename Container::const_iterator const_iterator;
typedef typename Container::reverse_iterator reverse_iterator;
typedef typename Container::const_reverse_iterator const_reverse_iterator;

typedef typename Container::pointer pointer;
typedef typename Container::const_pointer const_pointer;
typedef typename Container::reference reference;
typedef typename Container::const_reference const_reference;
tok_can():tok_base(1),pos__(0){};
~tok_can(){};
yacco2::CAbs_lr1_sym*operator[](yacco2::UINT Pos){
if(Pos>=container__.size()){
if(YACCO2_T__!=0){
/*389:*/
//#line 3053 "/usr/local/yacco2/library/parser.w"

LOCK_MUTEX(yacco2::TRACE_MU);
if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Acquired trace mu"<<FILE_LINE<<std::endl;
}

/*:389*/
//#line 93 "/usr/local/yacco2/library/tok_can.w"

yacco2::lrclog<<"YACCO2_T__::tok_can token eog: "
<<PTR_LR1_eog__<<" pos: "<<Pos<<FILE_LINE<<std::endl;
/*390:*/
//#line 3060 "/usr/local/yacco2/library/parser.w"

if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Releasing trace mu"<<FILE_LINE<<std::endl;
}
UNLOCK_MUTEX(yacco2::TRACE_MU);

/*:390*/
//#line 96 "/usr/local/yacco2/library/tok_can.w"

}
return PTR_LR1_eog__;
}
CAbs_lr1_sym*tok_(0);
if(r_w_cnt__> 1){
/*391:*/
//#line 3068 "/usr/local/yacco2/library/parser.w"

LOCK_MUTEX(yacco2::TOKEN_MU);

/*:391*/
//#line 102 "/usr/local/yacco2/library/tok_can.w"

tok_= container__[Pos];
/*392:*/
//#line 3072 "/usr/local/yacco2/library/parser.w"

UNLOCK_MUTEX(yacco2::TOKEN_MU);

/*:392*/
//#line 104 "/usr/local/yacco2/library/tok_can.w"

}else{
tok_= container__[Pos];
}
if(YACCO2_T__!=0){
/*389:*/
//#line 3053 "/usr/local/yacco2/library/parser.w"

LOCK_MUTEX(yacco2::TRACE_MU);
if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Acquired trace mu"<<FILE_LINE<<std::endl;
}

/*:389*/
//#line 109 "/usr/local/yacco2/library/tok_can.w"

yacco2::lrclog<<"YACCO2_T__::tok_can token: "<<tok_->id__
<<" *: "<<tok_<<" pos: "<<Pos
<<" enum: "<<tok_->enumerated_id__
<<'"'<<tok_->id__<<'"'
<<FILE_LINE<<std::endl;
yacco2::lrclog
<<"\t\t::GPS FILE: ";

EXTERNAL_GPSing(tok_)
yacco2::lrclog
<<" GPS LINE: "
<<tok_->tok_co_ords__.line_no__
<<" GPS CHR POS: "
<<tok_->tok_co_ords__.pos_in_line__
<<FILE_LINE<<std::endl;
/*390:*/
//#line 3060 "/usr/local/yacco2/library/parser.w"

if(yacco2::YACCO2_MU_TRACING__){
yacco2::lrclog<<"YACCO2_MU_TRACING__::Releasing trace mu"<<FILE_LINE<<std::endl;
}
UNLOCK_MUTEX(yacco2::TRACE_MU);

/*:390*/
//#line 125 "/usr/local/yacco2/library/tok_can.w"

}
return tok_;
};
yacco2::UINT pos(){return pos__;};
yacco2::UINT size(){return container__.size();};
bool empty(){return container__.empty();};
void push_back(yacco2::CAbs_lr1_sym&Tok){container__.push_back(&Tok);};
void remove(){};
void clear(){container__.clear();};
Container&container(){return container__;};
iterator begin(){return container__.begin();};
iterator end(){return container__.end();};
private:
yacco2::UINT pos__;
bool have_1st_rec__;
Container container__;
};

/*:79*//*80:*/
//#line 156 "/usr/local/yacco2/library/tok_can.w"

typedef tok_base token_container_type;

typedef tok_can<std::vector<yacco2::CAbs_lr1_sym*> > GAGGLE;
typedef GAGGLE::iterator GAGGLE_ITER;

typedef GAGGLE TOKEN_GAGGLE;
typedef GAGGLE_ITER TOKEN_GAGGLE_ITER;

template<> class tok_can<std::ifstream> :public yacco2::tok_base{
public:
tok_can();
tok_can(const char*File_name);
~tok_can();
std::string&file_name();
void set_file_name(const char*File_name);
yacco2::CAbs_lr1_sym*operator[](yacco2::UINT Pos);
yacco2::UINT pos();
yacco2::UINT size();
bool empty();
void push_back(yacco2::CAbs_lr1_sym&Tok);
void remove();
void clear();
TOKEN_GAGGLE&container();
bool file_ok();
void open_file();
void close_file();
private:
std::ifstream file__;
yacco2::UINT pos_;
bool have_1st_rec__;
std::ios::int_type eof_pos_;
bool file_ok_;
UINT line_no__;
UINT pos_in_line__;
TOKEN_GAGGLE container__;
std::string file_name__;
yacco2::UINT file_no__;
};

template<> class tok_can<std::string> :public yacco2::tok_base{
public:
tok_can();
tok_can(const char*String,CAbs_lr1_sym*GPS= 0);
~tok_can();
void set_string(const char*String);
void reuse_string(const char*String,CAbs_lr1_sym*GPS= 0);
yacco2::CAbs_lr1_sym*operator[](yacco2::UINT Pos);
yacco2::UINT pos();
yacco2::UINT size();
bool empty();
void push_back(yacco2::CAbs_lr1_sym&Tok);
void remove();
void clear();
TOKEN_GAGGLE&container();
std::string*string_used();
void set_gps(CAbs_lr1_sym*Gps);
yacco2::CAbs_lr1_sym*gps_used();
private:
std::string string__;
yacco2::UINT pos_;
bool have_1st_rec__;
std::ios::int_type eof_pos_;
UINT line_no__;
UINT pos_in_line__;
TOKEN_GAGGLE container__;
CAbs_lr1_sym*eof_sym_;
yacco2::UINT file_no__;
int real_start_pos_in_line_;
yacco2::CAbs_lr1_sym*gps__;
};

/*:80*//*81:*/
//#line 254 "/usr/local/yacco2/library/tok_can.w"

struct AST;
struct ast_base_stack;
typedef std::set<yacco2::INT> int_set_type;
typedef int_set_type::iterator int_set_iter_type;
typedef std::vector<yacco2::AST*> ast_vector_type;
typedef std::vector<yacco2::INT> ast_accept_node_type;
typedef enum{bypass_node,accept_node,stop_walking}functor_result_type;
typedef ast_vector_type Type_AST_ancestor_list;
template<class T> struct ast_functor{
virtual functor_result_type operator()(T Ast_env)= 0;
};

typedef ast_functor<yacco2::ast_base_stack*> Type_AST_functor;
struct ast_base_stack{
typedef enum n_action{init,left,visit,right,eoc}n_action_;
struct s_rec{
AST*node_;
n_action_ act_;
};
ast_base_stack();
ast_base_stack(Type_AST_functor*Action,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
s_rec*stk_rec(yacco2::INT I);
void pop();
void push(AST&Node,ast_base_stack::n_action Action);
yacco2::INT cur_stk_index();
s_rec*cur_stk_rec();
yacco2::INT idx_;
std::vector<s_rec> stk_;
Type_AST_functor*action_;
s_rec*cur_stk_rec_;
yacco2::int_set_type*filter_;
bool accept_opt_;
};

struct ast_stack{
ast_stack(Type_AST_functor*Action,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
ast_base_stack base_stk_;
virtual void exec()= 0;
virtual void advance()= 0;
};

/*:81*//*82:*/
//#line 309 "/usr/local/yacco2/library/tok_can.w"

struct AST{
AST(yacco2::CAbs_lr1_sym&Obj);
AST();
~AST();
static AST*restructure_2trees_into_1tree(AST&S1,AST&S2);
static void crt_tree_of_1son(AST&Parent,AST&S1);
static void crt_tree_of_2sons(AST&Parent,AST&S1,AST&S2);
static void crt_tree_of_3sons(AST&Parent,AST&S1,AST&S2,AST&S3);
static void crt_tree_of_4sons(AST&Parent,AST&S1,AST&S2,AST&S3,AST&S4);
static void crt_tree_of_5sons(AST&Parent,AST&S1,AST&S2,AST&S3,AST&S4,AST&S5);
static void crt_tree_of_6sons(AST&Parent,AST&S1,AST&S2,AST&S3,AST&S4,AST&S5,AST&S6);
static void crt_tree_of_7sons(AST&Parent,AST&S1,AST&S2,AST&S3,AST&S4,AST&S5,AST&S6
,AST&S7);
static void crt_tree_of_8sons(AST&Parent,AST&S1,AST&S2,AST&S3,AST&S4,AST&S5
,AST&S6,AST&S7,AST&S8);
static void crt_tree_of_9sons(AST&Parent,AST&S1,AST&S2,AST&S3,AST&S4,AST&S5
,AST&S6,AST&S7,AST&S8,AST&S9);
static void join_pts(AST&Parent,AST&Sibling);
static void join_sts(AST&Elder_sibling,AST&Younger_sibling);
static void ast_delete(AST&Node,bool Due_to_abort= false);
static AST*find_depth(AST&Node,yacco2::INT Enum);
static AST*find_breadth(AST&Node,yacco2::INT Enum);
static yacco2::CAbs_lr1_sym*content(AST&Node);
static AST*get_1st_son(AST&Node);
static AST*get_2nd_son(AST&Node);
static AST*get_3rd_son(AST&Node);
static AST*get_4th_son(AST&Node);
static AST*get_5th_son(AST&Node);
static AST*get_6th_son(AST&Node);
static AST*get_7th_son(AST&Node);
static AST*get_8th_son(AST&Node);
static AST*get_9th_son(AST&Node);
static AST*get_spec_child(AST&Tree,yacco2::INT Cnt);
static AST*get_child_at_end(AST&Tree);
static AST*add_child_at_end(AST&Tree,AST&Child);
static AST*get_younger_sibling(AST&Child,yacco2::INT Pos);
static AST*get_older_sibling(AST&Child,yacco2::INT Pos);
static AST*get_youngest_sibling(AST&Child);
static AST*get_parent(AST&Child);
static AST*common_ancestor
(Type_AST_ancestor_list&ListA,Type_AST_ancestor_list&ListB);

static AST*brother(AST&Node);
static AST*previous(AST&Node);
static void zero_1st_son(AST&Node);
static void zero_2nd_son(AST&Node);
static void zero_brother(AST&Node);
static void zero_previous(AST&Node);
static void zero_content(AST&Node);
static void set_content(AST&Node,yacco2::CAbs_lr1_sym&Sym);
static void set_content_wdelete(AST&Node,yacco2::CAbs_lr1_sym&Sym);
static void set_previous(AST&Node,AST&Previous_node);
static void wdelete(AST&Node,bool Wdelete);
static bool wdelete(AST&Node);
static void replace_node(AST&Old_to,AST&New_to);
static void relink(AST&Previous,AST&Old_to,AST&New_to);
static void relink_between(AST&Previous,AST&Old_to,AST&New_to);
static void relink_after(AST&Previous,AST&New_to);
static void relink_before(AST&Previous,AST&New_to);
static void add_son_to_tree(AST&Parent,AST&Son);
static AST*divorce_node_from_tree(AST&Node);
static AST*clone_tree(AST&Node_to_copy,AST*Calling_node
,ast_base_stack::n_action Relation= ast_base_stack::init);
AST*lt_;
AST*rt_;
AST*pr_;
yacco2::CAbs_lr1_sym*obj_;
bool wdelete_;
};

/*:82*//*83:*/
//#line 450 "/usr/local/yacco2/library/tok_can.w"

template<> class tok_can<yacco2::AST*> :public yacco2::tok_base{
public:
tok_can
(ast_stack&Walker);
~tok_can();

yacco2::CAbs_lr1_sym*operator[](yacco2::UINT Pos);
yacco2::UINT pos();
yacco2::UINT size();
bool empty();
void push_back(yacco2::AST&Node);
void push_back(yacco2::CAbs_lr1_sym&Node);
void remove();
void clear();
yacco2::ast_stack&container();

std::vector<yacco2::AST*> *nodes_visited();

yacco2::AST*ast(yacco2::UINT Pos);

yacco2::INT accept_node_level(yacco2::UINT Pos);

private:
volatile yacco2::UINT pos_;
bool have_1st_rec__;
bool tree_end_reached__;
yacco2::ast_vector_type nodes_visited_;
yacco2::ast_accept_node_type accept_node_level_;
yacco2::ast_stack&traverse_;
};

/*:83*//*104:*/
//#line 46 "/usr/local/yacco2/library/structures.w"

struct Per_rule_s_reuse_table;
struct reuse_rule_list;
struct reuse_rule_list{
reuse_rule_list():younger_(0),older_(0),reuse_rule_entry_(0),per_rule_tbl_ptr_(0){};
reuse_rule_list*younger_;
reuse_rule_list*older_;
Rule_s_reuse_entry*reuse_rule_entry_;
Per_rule_s_reuse_table*per_rule_tbl_ptr_;
};
struct Rule_s_reuse_entry{
reuse_rule_list its_linked_list_;
CAbs_lr1_sym*rule_;
Rule_s_reuse_entry():rule_(0){};
~Rule_s_reuse_entry(){
if(rule_==0)return;
delete rule_;
};
};

struct Per_rule_s_reuse_table{
reuse_rule_list*in_use_list_;
reuse_rule_list*for_use_list_;
Per_rule_s_reuse_table():in_use_list_(0),for_use_list_(0){};
};

struct Fsm_rules_reuse_table{
int no_rules_entries_;
Per_rule_s_reuse_table*per_rule_s_table_[1];
};

//#line 1 "/usr/local/yacco2/library/fsm_tbls.w"







/*:104*//*106:*/
//#line 63 "/usr/local/yacco2/library/fsm_tbls.w"

struct State{
yacco2::UINT state_no__;
yacco2::Shift_entry*parallel_shift__;
yacco2::Shift_entry*all_shift__;
yacco2::Shift_entry*inv_shift__;
yacco2::Shift_entry*proc_call_shift__;
yacco2::Shift_tbl*shift_tbl_ptr__;
yacco2::Reduce_tbl*reduce_tbl_ptr__;
yacco2::State_s_thread_tbl*state_s_thread_tbl__;
yacco2::Type_pc_fnct_ptr proc_call_addr__;
yacco2::Shift_entry*questionable_shift__;
};

/*:106*//*107:*/
//#line 102 "/usr/local/yacco2/library/fsm_tbls.w"

struct Shift_entry{
yacco2::USINT id__;
yacco2::State*goto__;
};
struct Shift_tbl{
yacco2::USINT no_entries__;
yacco2::Shift_entry first_entry__[1];
};

/*:107*//*108:*/
//#line 118 "/usr/local/yacco2/library/fsm_tbls.w"

struct Reduce_entry{
yacco2::Set_tbl*la_set__;
yacco2::USINT rhs_id__;
};
struct Reduce_tbl{
yacco2::USINT no_entries__;
yacco2::Reduce_entry first_entry__[1];
};


/*:108*//*112:*/
//#line 484 "/usr/local/yacco2/library/fsm_tbls.w"

struct Thread_entry{
yacco2::KCHARP thread_fnct_name__;
yacco2::Type_pp_fnct_ptr thread_fnct_ptr__;
yacco2::USINT thd_id__;
yacco2::Type_pc_fnct_ptr proc_thread_fnct_ptr__;
};

/*:112*//*113:*/
//#line 493 "/usr/local/yacco2/library/fsm_tbls.w"

struct thread_array_record{
yacco2::USINT no_entries__;
yacco2::Thread_entry*first_entry__[1];
};
/*:113*//*114:*/
//#line 507 "/usr/local/yacco2/library/fsm_tbls.w"

struct State_s_thread_tbl{
yacco2::USINT no_entries__;
yacco2::Type_pp_fnct_ptr ar_fnct_ptr__;
yacco2::ULINT(*thd_id_bit_map__);
yacco2::Thread_entry*first_entry__[1];
};

/*:114*//*115:*/
//#line 528 "/usr/local/yacco2/library/fsm_tbls.w"

struct thd_ids_having_T{
yacco2::ULINT first_thd_id__[1];
};
struct T_array_having_thd_ids{
yacco2::USINT no_of_T__;
yacco2::thd_ids_having_T*first_entry__[1];
};

//#line 1 "/usr/local/yacco2/library/fsm.w"







/*:115*//*117:*/
//#line 21 "/usr/local/yacco2/library/fsm.w"

class CAbs_fsm{
public:
virtual void op()= 0;
virtual bool failed()= 0;
yacco2::KCHARP id();
yacco2::KCHARP version();
yacco2::KCHARP date();
bool debug();
yacco2::KCHARP comments();
yacco2::KCHARP gened_date();
yacco2::State*start_state();
virtual~CAbs_fsm();
virtual void reduce_rhs_of_rule
(yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry**Recycled_rule)= 0;
yacco2::Parser*parser();
void parser(yacco2::Parser&A);
void find_a_recycled_rule
(Per_rule_s_reuse_table*Reuse_rule_table
,Rule_s_reuse_entry**Reuse_rule_entry);
void recycle_rule(Rule_s_reuse_entry*Rule_to_recycle);
protected:
CAbs_fsm(yacco2::KCHARP Id
,yacco2::KCHARP Version
,yacco2::KCHARP Date
,bool Debug
,yacco2::KCHARP Comments
,yacco2::KCHARP Gened_date
,yacco2::State&Start_state
);
public:
yacco2::KCHARP id__;
yacco2::KCHARP version__;
yacco2::KCHARP date__;
bool debug__;
yacco2::KCHARP comments__;
yacco2::KCHARP gened_date__;
yacco2::State*start_state__;
yacco2::Parser*parser__;
};
/*:117*//*171:*/
//#line 49 "/usr/local/yacco2/library/thread.w"

struct worker_thread_blk{
worker_thread_blk();
worker_thread_blk(yacco2::Parser*Grammar_s_parser,yacco2::Parser*Calling_parser);
yacco2::Parser*grammar_s_parser__;
int status__;
int run_cnt__;
int thd_id__;
void set_waiting_for_work();
};
/*:171*//*184:*/
//#line 327 "/usr/local/yacco2/library/thread.w"

struct Caccept_parse{
Caccept_parse
(yacco2::Parser&Th_reporting_success
,yacco2::CAbs_lr1_sym&Accept_token
,yacco2::UINT Accept_token_pos
,yacco2::CAbs_lr1_sym&La_token
,yacco2::UINT La_token_pos);
Caccept_parse();
void initialize_it();
void fill_it(Caccept_parse&Accept_parse);
void fill_it(yacco2::Parser&Th_reporting_success
,yacco2::CAbs_lr1_sym&Accept_token
,yacco2::UINT Accept_token_pos
,yacco2::CAbs_lr1_sym&La_token
,yacco2::UINT La_token_pos);

~Caccept_parse();
yacco2::Parser*th_reporting_success__;
yacco2::CAbs_lr1_sym*accept_token__;
yacco2::UINT accept_token_pos__;
yacco2::CAbs_lr1_sym*la_token__;
yacco2::UINT la_token_pos__;
};

/*:184*//*222:*/
//#line 28 "/usr/local/yacco2/library/parser.w"

struct Parser{
enum parse_result{erred,accepted,reduced,paralleled,no_thds_to_run};
/*223:*/
//#line 65 "/usr/local/yacco2/library/parser.w"

yacco2::CAbs_fsm*fsm_tbl__;
yacco2::KCHARP thread_name__;
yacco2::Thread_entry*thread_entry__;
yacco2::token_container_type*token_supplier__;
yacco2::token_container_type*token_producer__;
yacco2::token_container_type*recycle_bin__;
yacco2::token_container_type*error_queue__;
yacco2::lr_stk parse_stack__;
yacco2::CAbs_lr1_sym*current_token__;
yacco2::UINT current_token_pos__;
yacco2::CAbs_lr1_sym*start_token__;
yacco2::UINT start_token_pos__;
yacco2::tble_lkup_type*sym_lookup_functor__;
bool abort_parse__;
bool stop_parse__;
bool use_all_shift__;
bool has_questionable_shift_occured__;
yacco2::Parser*from_thread__;
yacco2::THREAD_NO thread_no__;
yacco2::COND_VAR cv__;
yacco2::MUTEX mu__;
int cv_cond__;
yacco2::worker_thread_blk th_blk__;

yacco2::pp_accept_queue_type pp_accept_queue__;
int pp_accept_queue_idx__;
yacco2::INT th_active_cnt__;
yacco2::INT th_accepting_cnt__;

yacco2::Parser*pp_requesting_parallelism__;
yacco2::INT msg_id__;
yacco2::Caccept_parse*arbitrated_token__;
yacco2::Caccept_parse pp_rsvp__;
int no_competing_pp_ths__;
int no_requested_ths_to_run__;
yacco2::yacco2_threads_to_run_type th_lst__;
bool launched_as_procedure__;
USINT supplier_r_w_cnt__;

/*:223*/
//#line 31 "/usr/local/yacco2/library/parser.w"

Parser(yacco2::CAbs_fsm&Fsm_tbl
,yacco2::token_container_type*Token_supplier
,yacco2::token_container_type*Token_producer
,yacco2::UINT Token_supplier_key_pos= Token_start_pos
,yacco2::token_container_type*Error_queue= 0
,yacco2::token_container_type*Recycle_bin= 0
,yacco2::tble_lkup_type*Sym_lookup_functor= 0
,bool Use_all_shift= ON);
Parser(yacco2::CAbs_fsm&Fsm_tbl
,yacco2::Thread_entry&Thread_entry
,yacco2::Parser*Calling_parser);
Parser(yacco2::CAbs_fsm&Fsm_tbl
,yacco2::Parser*Calling_parser);
~Parser();
/*226:*/
//#line 134 "/usr/local/yacco2/library/parser.w"

parse_result parse();
void shift(yacco2::Shift_entry&SE);
void invisible_shift(yacco2::Shift_entry&SE);
void questionable_shift(yacco2::Shift_entry&SE);
void all_shift(yacco2::Shift_entry&SE);
void parallel_shift(yacco2::CAbs_lr1_sym&Accept_terminal);
void proc_call_shift(yacco2::CAbs_lr1_sym&Accept_terminal);
parse_result reduce(yacco2::Reduce_entry&RE);
parse_result parallel_parse();
parse_result proc_call_parse();
parse_result start_parallel_parsing(yacco2::State&S);
THR_result chained_proc_call_parsing(yacco2::State&S);
parse_result start_manually_parallel_parsing(yacco2::USINT Thread_id);
yacco2::Shift_entry*find_cur_T_shift_entry();
yacco2::Shift_entry*find_R_or_paralleled_T_shift_entry(yacco2::USINT Enum_id);
yacco2::Reduce_entry*find_questionable_sym_in_reduce_lookahead();
yacco2::Reduce_entry*find_reduce_entry();
yacco2::Reduce_entry*find_parallel_reduce_entry();
yacco2::Reduce_entry*find_proc_call_reduce_entry();

/*:226*/
//#line 46 "/usr/local/yacco2/library/parser.w"

/*227:*/
//#line 156 "/usr/local/yacco2/library/parser.w"

yacco2::token_container_type*token_supplier();
void set_token_supplier(yacco2::token_container_type&Token_supplier);
yacco2::token_container_type*token_producer();
void set_token_producer(yacco2::token_container_type&Token_producer);
yacco2::token_container_type*recycle_bin();
void set_recycle_bin(yacco2::token_container_type&Recycle_bin);
void set_error_queue(yacco2::token_container_type&Error_queue);
yacco2::token_container_type*error_queue();
void add_token_to_supplier(yacco2::CAbs_lr1_sym&Token);
void add_token_to_producer(yacco2::CAbs_lr1_sym&Token);
void add_token_to_recycle_bin(yacco2::CAbs_lr1_sym&Token);
void add_token_to_error_queue(yacco2::CAbs_lr1_sym&Token);

/*:227*/
//#line 47 "/usr/local/yacco2/library/parser.w"

/*229:*/
//#line 184 "/usr/local/yacco2/library/parser.w"

void get_shift_s_next_token();
yacco2::CAbs_lr1_sym*get_next_token();
yacco2::CAbs_lr1_sym*get_spec_token(yacco2::UINT Pos);
yacco2::CAbs_lr1_sym*current_token();
yacco2::CAbs_lr1_sym*start_token();
void set_start_token(yacco2::CAbs_lr1_sym&Start_tok);
yacco2::UINT start_token_pos();
void set_start_token_pos(yacco2::UINT Pos);
void reset_current_token(yacco2::UINT Pos);
void override_current_token(yacco2::CAbs_lr1_sym&Current_token,yacco2::UINT Pos);
void override_current_token_pos(yacco2::UINT Pos);
yacco2::UINT current_token_pos();

/*:229*/
//#line 48 "/usr/local/yacco2/library/parser.w"

/*228:*/
//#line 171 "/usr/local/yacco2/library/parser.w"

void cleanup_stack_due_to_abort();
yacco2::lr_stk*parse_stack();
yacco2::INT no_items_on_stack();
yacco2::Cparse_record*get_stack_record(yacco2::INT Pos);
yacco2::Cparse_record*top_stack_record();
void remove_from_stack(yacco2::INT No_to_remove);
void add_to_stack(yacco2::State&State_no);
yacco2::INT current_stack_pos();
void clear_parse_stack();
yacco2::CAbs_lr1_sym*get_spec_stack_token(yacco2::UINT Pos);

/*:228*/
//#line 49 "/usr/local/yacco2/library/parser.w"

/*225:*/
//#line 124 "/usr/local/yacco2/library/parser.w"

void set_use_all_shift_on();
void set_use_all_shift_off();
bool use_all_shift();
bool abort_parse();
void set_abort_parse(bool Abort);
bool stop_parse();
void set_stop_parse(bool Stop);

/*:225*/
//#line 50 "/usr/local/yacco2/library/parser.w"


yacco2::CAbs_fsm*fsm_tbl();
void fsm_tbl(yacco2::CAbs_fsm*Fsm_tbl);

yacco2::tble_lkup_type*sym_lookup_functor();
Parser::parse_result parallel_parse_successful();
Parser::parse_result parallel_parse_unsuccessful();
Parser::parse_result proc_call_parse_successful();
Parser::parse_result proc_call_parse_unsuccessful();
bool spawn_thread_manually(yacco2::USINT Thread_id);
/*224:*/
//#line 106 "/usr/local/yacco2/library/parser.w"

yacco2::Parser*from_thread();
yacco2::KCHARP thread_name();
yacco2::Thread_entry*thread_entry();
void post_event_to_requesting_grammar
(yacco2::Parser&To_thread
,yacco2::INT Message_id
,yacco2::Parser&From_thread);
void wait_for_event();
bool start_threads();
THR_result start_procedure_call(yacco2::State&S);
void put_T_into_accept_queue(yacco2::Caccept_parse&Parm);
void clean_up();
void call_arbitrator(yacco2::Type_pp_fnct_ptr The_judge);
bool have_all_threads_reported_back();
void abort_accept_queue_irregularites(yacco2::Caccept_parse&Calling_parm);
void abort_no_selected_accept_parse_in_arbitrator();
/*:224*/
//#line 61 "/usr/local/yacco2/library/parser.w"

};

/*:222*//*429:*/
//#line 119 "/usr/local/yacco2/library/runtime_env.w"

struct Source_info{
Source_info(yacco2::KCHARP File,yacco2::UINT Line);
void w_info();
yacco2::KCHARP file__;
yacco2::INT line__;
};
struct Yacco2_faulty_precondition:Source_info{
Yacco2_faulty_precondition(yacco2::KCHARP Message
,yacco2::KCHARP File= __FILE__
,yacco2::UINT Line= __LINE__);
};

struct Yacco2_faulty_postcondition:Source_info{
Yacco2_faulty_postcondition(yacco2::KCHARP Message
,yacco2::KCHARP File= __FILE__
,yacco2::UINT Line= __LINE__);
};

/*:429*//*443:*/
//#line 147 "/usr/local/yacco2/library/tree.w"

struct ast_postfix:public ast_stack{
ast_postfix(AST&Forest,Type_AST_functor*Action
,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
void exec();
void advance();
};

/*:443*//*444:*/
//#line 156 "/usr/local/yacco2/library/tree.w"

struct ast_prefix:public ast_stack{
ast_prefix(AST&Forest,Type_AST_functor*Action
,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
void exec();
void advance();
};

/*:444*//*445:*/
//#line 167 "/usr/local/yacco2/library/tree.w"

struct ast_postfix_1forest:public ast_stack{
ast_postfix_1forest(AST&Forest,Type_AST_functor*Action
,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
void exec();
void advance();
};

/*:445*//*446:*/
//#line 177 "/usr/local/yacco2/library/tree.w"

struct ast_prefix_1forest:public ast_stack{
ast_prefix_1forest(AST&Forest,Type_AST_functor*Action
,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
void exec();
void advance();
};

/*:446*//*447:*/
//#line 187 "/usr/local/yacco2/library/tree.w"

struct ast_breadth_only:public ast_stack{
ast_breadth_only(AST&Forest,Type_AST_functor*Action
,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
void exec();
void advance();
};

/*:447*//*448:*/
//#line 197 "/usr/local/yacco2/library/tree.w"

struct ast_prefix_wbreadth_only:public ast_stack{
ast_prefix_wbreadth_only(AST&Forest,Type_AST_functor*Action
,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
void exec();
void advance();
};

/*:448*//*449:*/
//#line 216 "/usr/local/yacco2/library/tree.w"

struct ast_moonwalk_looking_for_ancestors{
ast_moonwalk_looking_for_ancestors
(AST&Moonchild,USINT Goal,Type_AST_ancestor_list&Ancestors,Type_AST_functor*Functor
,yacco2::int_set_type*Filter= 0,bool Accept_opt= true);
void let_s_moonwalk();
bool deal_with_parent(AST*Parent);
functor_result_type let_s_functor(AST*Parent);
bool deal_with_functor(AST*Parent);
AST*moonchild_;
USINT goal_;
Type_AST_ancestor_list*ancestor_list_;
Type_AST_functor*functor_;
yacco2::int_set_type*filter_;
bool filter_type_;
bool filter_provided_;
};

/*:449*//*526:*/
//#line 1753 "/usr/local/yacco2/library/tree.w"

struct insert_back_recycled_items_functor:public Type_AST_functor{
functor_result_type operator()(yacco2::ast_base_stack*Stk_env);
void insert_node(yacco2::AST&Inode);
yacco2::AST*new_root();
void insert_before();
private:
yacco2::ast_base_stack*stk_env_;
yacco2::INT idx_;
yacco2::AST*cnode_;
yacco2::ast_base_stack::s_rec*srec_;
yacco2::AST*insert_node_;
yacco2::AST*new_root_;
};

/*:526*//*527:*/
//#line 1769 "/usr/local/yacco2/library/tree.w"

struct tok_can_ast_functor:public Type_AST_functor{
functor_result_type operator()(yacco2::ast_base_stack*Stk_env);
};
/*:527*//*528:*/
//#line 1774 "/usr/local/yacco2/library/tree.w"

struct tok_can_ast_no_stop_functor:public Type_AST_functor{
functor_result_type operator()(yacco2::ast_base_stack*Stk_env);
};
/*:528*//*529:*/
//#line 1779 "/usr/local/yacco2/library/tree.w"

struct tok_can_ast_bypass_functor:public Type_AST_functor{
functor_result_type operator()(yacco2::ast_base_stack*Stk_env);
};
/*:529*//*530:*/
//#line 1784 "/usr/local/yacco2/library/tree.w"

struct prt_ast_functor:public Type_AST_functor{
functor_result_type operator()(yacco2::ast_base_stack*Stk_env);
typedef void(*PF)(AST*);
prt_ast_functor(PF Func,std::ofstream*Ofile= 0);
void reset_cnt();
private:
yacco2::ast_base_stack*stk_env_;
yacco2::INT idx_;
yacco2::AST*cnode_;
yacco2::ast_base_stack::s_rec*srec_;
PF prt_funct_;
yacco2::INT cnt_;
char how_[3];
std::ofstream*ofile_;
};
/*:530*//*531:*/
//#line 1801 "/usr/local/yacco2/library/tree.w"

struct fire_a_func_ast_functor:public Type_AST_functor{
functor_result_type operator()(yacco2::ast_base_stack*Stk_env);
typedef void(*PF)(AST*);
fire_a_func_ast_functor(PF Func);
private:
yacco2::ast_base_stack*stk_env_;
yacco2::INT idx_;
yacco2::AST*cnode_;
yacco2::ast_base_stack::s_rec*srec_;
PF a_funct_;
};
/*:531*//*532:*/
//#line 1814 "/usr/local/yacco2/library/tree.w"

struct str_ast_functor:public Type_AST_functor{
functor_result_type operator()(yacco2::ast_base_stack*Stk_env);
typedef void(*PF)(AST*,Type_AST_functor*);
str_ast_functor(PF Func);
std::string source_str_;
private:
yacco2::ast_base_stack*stk_env_;
yacco2::INT idx_;
yacco2::AST*cnode_;
yacco2::ast_base_stack::s_rec*srec_;
PF prt_funct_;
char how_[3];
};
/*:532*//*533:*/
//#line 1829 "/usr/local/yacco2/library/tree.w"

struct remove_unwanted_ast_functor:public Type_AST_functor{
functor_result_type operator()(yacco2::ast_base_stack*Stk_env);
void possible_delete();
~remove_unwanted_ast_functor();

private:
yacco2::ast_base_stack*stk_env_;
yacco2::INT idx_;
yacco2::AST*cnode_;
yacco2::ast_base_stack::s_rec*srec_;
};

/*:533*/
//#line 459 "/usr/local/yacco2/library/intro.w"

/*22:*/
//#line 388 "/usr/local/yacco2/library/intro.w"


/*:22*//*46:*/
//#line 93 "/usr/local/yacco2/library/set.w"

extern void create_set_entry(yacco2::USINT Enum_id,yacco2::Set_entry&Set);

/*:46*//*140:*/
//#line 104 "/usr/local/yacco2/library/wthread.w"

extern void CREATE_MUTEX(yacco2::MUTEX&Mu);
extern void LOCK_MUTEX(yacco2::MUTEX&Mu);
extern void UNLOCK_MUTEX(yacco2::MUTEX&Mu);
extern
void LOCK_MUTEX_OF_CALLED_PARSER(yacco2::MUTEX&Mu,yacco2::Parser&parser,const char*Text);
extern
void UNLOCK_MUTEX_OF_CALLED_PARSER(yacco2::MUTEX&Mu,yacco2::Parser&parser,const char*Text);
extern void DESTROY_MUTEX(yacco2::MUTEX&Mu);
extern void CREATE_COND_VAR(yacco2::COND_VAR&Cv);
extern void COND_WAIT(yacco2::COND_VAR&Cv,yacco2::MUTEX&Mu,yacco2::Parser&parser);
extern void SIGNAL_COND_VAR(yacco2::Parser&To_thread,yacco2::Parser&parser);
extern void DESTROY_COND_VAR(yacco2::COND_VAR&Cv);
extern yacco2::THR_result
CREATE_THREAD(yacco2::Type_pp_fnct_ptr Thread,yacco2::Parser&Parser_requesting_parallelism);
extern THREAD_NO THREAD_SELF();


/*:140*//*173:*/
//#line 71 "/usr/local/yacco2/library/thread.w"

extern void Parallel_threads_shutdown(yacco2::Parser&PP);
extern yacco2::THR
_YACCO2_CALL_TYPE
AR_for_manual_thread_spawning(yacco2::Parser*Caller_pp);
extern yacco2::Type_pp_fnct_ptr PTR_AR_for_manual_thread_spawning;

/*:173*//*211:*/
//#line 820 "/usr/local/yacco2/library/thread.w"

extern void find_threads_by_first_set
(yacco2::USINT Current_T_id
,yacco2::yacco2_threads_to_run_type&Th_list
,yacco2::State_s_thread_tbl&P_tbl);

/*:211*//*427:*/
//#line 77 "/usr/local/yacco2/library/runtime_env.w"

extern void Delete_tokens(yacco2::TOKEN_GAGGLE&Tks,bool Do_delete= OFF);
extern void Clear_yacco2_opened_files_dictionary();


/*:427*//*632:*/
//#line 1274 "/usr/local/yacco2/library/macros.w"

extern bool trace_parser_env(Parser*parser,bool Trace_type);
/*:632*/
//#line 460 "/usr/local/yacco2/library/intro.w"

/*25:*/
//#line 400 "/usr/local/yacco2/library/intro.w"

};

/*:25*/
//#line 461 "/usr/local/yacco2/library/intro.w"

namespace NS_yacco2_k_symbols{
extern yacco2::CAbs_lr1_sym*PTR_LR1_questionable_shift_operator__;
extern yacco2::CAbs_lr1_sym*PTR_LR1_eog__;
extern yacco2::CAbs_lr1_sym*PTR_LR1_eolr__;
extern yacco2::CAbs_lr1_sym*PTR_LR1_parallel_operator__;
extern yacco2::CAbs_lr1_sym*PTR_LR1_fset_transience_operator__;
extern yacco2::CAbs_lr1_sym*PTR_LR1_invisible_shift_operator__;
extern yacco2::CAbs_lr1_sym*PTR_LR1_all_shift_operator__;
};
/*13:*/
//#line 295 "/usr/local/yacco2/library/intro.w"


/*:13*//*630:*/
//#line 1237 "/usr/local/yacco2/library/macros.w"

#define sstrace_parallel_supportss(ssPROC_NAME) \
if(yacco2::YACCO2_TLEX__){\
  Parser* _ap =  parser_of_parallel_support(); \
  yacco2::lrclog  << "YACCO2_TLEX__::" << pthread_self() << "::" \
  << _ap->fsm_tbl__->id__ << "::" \
  << ' ' << #ssPROC_NAME << " this:: " << this << std::endl; \
  yacco2::lrclog  << "\tYACCO2_TLEX__:: parser_of_parallel_support:: " \
  << _ap \
  << FILE_LINE<< std::endl; \
  yacco2::lrclog  << "\tself thread id:: " << thread_no__\
  << FILE_LINE<< std::endl; \
  yacco2::lrclog \
  << "\tYACCO2_TLEX__:: embedded thread id:: " \
  << embedded_thread_no()\
  << FILE_LINE<< std::endl;\
  }

/*:630*//*631:*/
//#line 1257 "/usr/local/yacco2/library/macros.w"

#define  sstrace_parallel_support_envss(ssPROC_NAME) \
if(yacco2::YACCO2_TLEX__){\
  yacco2::lrclog  << "YACCO2_TLEX__::" << GetCurrentThreadid__ << "::" \
  << fsm_tbl__->id__ << "::" \
  << ' ' << #ssPROC_NAME << " this:: " << this \
  << FILE_LINE<< std::endl; \
  yacco2::lrclog  << "\tYACCO2_TLEX__:: self thread id:: "\
  << thread_no__ \
  << FILE_LINE<< std::endl;\
  }

/*:631*/
//#line 471 "/usr/local/yacco2/library/intro.w"

#endif


/*:35*/
