diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /web/yacco2/grammar-testsuite |
Initial commit
Diffstat (limited to 'web/yacco2/grammar-testsuite')
98 files changed, 9990 insertions, 0 deletions
diff --git a/web/yacco2/grammar-testsuite/Err.w b/web/yacco2/grammar-testsuite/Err.w new file mode 100644 index 0000000000..ab22055e9b --- /dev/null +++ b/web/yacco2/grammar-testsuite/Err.w @@ -0,0 +1,60 @@ +\input "supp-pdf" +\input "/yacco2/diagrams+etc/o2mac.tex" +\DOCtitle{Error Vocabulary}{testout\_err\_symbols} +{NS\_testout\_err\_symbols}{4} + +@i "/yacco2/copyright.w" +@** Testout Error symbols vocabulary.\fbreak + +@*2 {\bf Bad T inputted}.\fbreak +Enum: T\_Err\_bad\_T\_inputted\_ +\fbreak +\line{Class: Err\_bad\_T\_inputted \hfil AB: N \hfil AD: N} + +\fbreak +\hrule +@*2 {\bf bad filename}.\fbreak +Enum: T\_Err\_bad\_filename\_ +\fbreak +\line{Class: Err\_bad\_filename \hfil AB: N \hfil AD: N} + +\fbreak +\hrule +@*3 bad filename user-declaration directive. +@<bad filename user-declaration directive@>= + + public: + Err_bad_filename(std::string& File_name); + Err_bad_filename(const char* File_name); + std::string* file_name(); + private: + std::string file_name_; + +@*3 bad filename user-implementation directive. +@<bad filename user-implementation directive@>= + + Err_bad_filename:: + Err_bad_filename(std::string& File_name) + T_CTOR("bad filename",T_Enum::T_Err_bad_filename_,0,false,false) + {file_name_ += File_name.c_str();} + Err_bad_filename:: + Err_bad_filename(const char* File_name) + T_CTOR("bad filename",T_Enum::T_Err_bad_filename_,0,false,false) + {file_name_ += File_name;} + std::string* Err_bad_filename::file_name(){return &file_name_;} + +@*2 {\bf no cmd-lne-data}.\fbreak +Enum: T\_Err\_no\_cmd\_lne\_data\_ +\fbreak +\line{Class: Err\_no\_cmd\_lne\_data \hfil AB: N \hfil AD: N} + +\fbreak +\hrule +@*2 {\bf no filename}.\fbreak +Enum: T\_Err\_no\_filename\_ +\fbreak +\line{Class: Err\_no\_filename \hfil AB: N \hfil AD: N} + +\fbreak +\hrule +@** Index. diff --git a/web/yacco2/grammar-testsuite/Lrk.w b/web/yacco2/grammar-testsuite/Lrk.w new file mode 100644 index 0000000000..02f9d47a6e --- /dev/null +++ b/web/yacco2/grammar-testsuite/Lrk.w @@ -0,0 +1,331 @@ +\input "supp-pdf" +\input "/yacco2/diagrams+etc/o2mac.tex" +\DOCtitle{Lr K Vocabulary}{yacco2\_k\_symbols} +{NS\_yacco2\_k\_symbols}{8} + +@i "/yacco2/library/copyright.w" +@** K symbols vocabulary.\fbreak +Ahh the ``Constant grammar'' symbols used throughout all grammars. +Depending on the command line options \O2 can generate the grammar +and possibly the various flavours of the Terminal vocabulary. +Under normal development, the grammar writer +compiles and emits just the grammar. +Flavours of the terminal vocabulary are not usually generated unless +there have been changes +to either {\bf error} or +{\bf terminal} with accompaning command line option. +At the +initial ``big bang'' of bootstrapping \O2's library and compiler / compiler, +both {\bf raw characters} and {\bf lr k} terminals were generated +using their command line options +{/rc} and {/lrk}. The command line option +now uses an Unix style {-t, -err} and +these 2 terminal types ``lrk'' and ``raw characters'' +are now cast in cement: u cannot regen them + from their ``*.T'' file definitions but +u can change their ``big bang'' generated ``c++'' modules. +These terminals are now read-only: +they will never be changed by a user of \O2 and who'd want to anyway?. + +The hardwired ``k'' terminals are used by \O2's library + for internal parsing situations. +Apart from {\bf eog} who represents +the end-of-grammar and end-of-file conditions, +all other definitions are not part of the token source + stream being parsed. +I call them meta terminals +as they are never in the token stream but +represent internal parsing conditions within the emitted +finite-state table that triggers the \O2's library routines. +For example, the presence of \paralleloperator within +a parse state +indicates the potential ``to run'' threads. +If u look carefully, their file definitions and +implementations reside in \O2's ``../yacco2/library/grammars'' folder. +Their definition files are ``yacco2\_k\_symbols.T'' and +``yacco2\_characters.T'' with +their ``c++'' variants having the ``.h'' and ''.cpp'' extensions. + +@*2 {\bf eog}.\fbreak +Enum: T\_LR1\_eog\_ +\fbreak +\line{Class: LR1\_eog \hfil AB: N \hfil AD: N} + + + Used to indicate an end-of-grammar or an end-of-file condition. + When the token container is reached, calls for another terminal + will always return the |eog|. + It's your door bouncer before hell. + +\fbreak +\hrule +@*3 eog user-declaration directive. +@<eog user-declaration directive@>= + + LR1_eog(); + +@*3 eog user-implementation directive. +@<eog user-implementation directive@>= + + LR1_eog::LR1_eog() + T_CTOR("eog",T_LR1_eog_,0,false,false) + {} + LR1_eog LR1_eog__; + yacco2::CAbs_lr1_sym* yacco2::PTR_LR1_eog__ = &LR1_eog__; + +@*2 {\bf eolr}.\fbreak +Enum: T\_LR1\_eolr\_ +\fbreak +\line{Class: LR1\_eolr \hfil AB: N \hfil AD: N} + + + Used to indicate all-terminals of the + terminal vocabulary including itself. + It saves finger blisters by not having + to be explicit in the thread's lookahead expression. + Dieting hasn't been this effective to code bloat. + +\fbreak +\hrule +@*3 eolr user-declaration directive. +@<eolr user-declaration directive@>= + + LR1_eolr(); + +@*3 eolr user-implementation directive. +@<eolr user-implementation directive@>= + + LR1_eolr::LR1_eolr() + T_CTOR("eolr",T_LR1_eolr_,0,false,false) + {} + LR1_eolr LR1_eolr__; + yacco2::CAbs_lr1_sym* NS_yacco2_k_symbols::PTR_LR1_eolr__ = &LR1_eolr__; + +@*2 {\bf \ALLshift{}}.\fbreak +Enum: T\_LR1\_all\_shift\_operator\_ +\fbreak +\line{Class: LR1\_all\_shift\_operator \hfil AB: N \hfil AD: N} + + + Represents the wild token situation. + Lowers the specific shifts of the finite-state-table and + allows the grammar writer to field the unexpected from returned + threads. Good stuff. + +Caveat: One should use the \QUEshift to field unknow return Tes if +they are to be interpreted as errors. + +\fbreak +\hrule +@*3 \ALLshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive. +@<\ALLshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive@>= + + LR1_all_shift_operator(); + +@*3 \ALLshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive. +@<\ALLshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive@>= + + LR1_all_shift_operator::LR1_all_shift_operator() + T_CTOR("|+|",T_LR1_all_shift_operator_,0,false,false) + {} + LR1_all_shift_operator LR1_all_shift_operator__; + yacco2::CAbs_lr1_sym* NS_yacco2_k_symbols::PTR_LR1_all_shift_operator__ += &LR1_all_shift_operator__; + +@*2 {\bf \INVshift{}}.\fbreak +Enum: T\_LR1\_invisible\_shift\_operator\_ +\fbreak +\line{Class: LR1\_invisible\_shift\_operator \hfil AB: N \hfil AD: N} + + + It's a nice way to program + out of an ambiguous grammar. + It can also lower the code bloat + of a thread's first set. + +\fbreak +\hrule +@*3 \INVshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive. +@<\INVshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive@>= + + LR1_invisible_shift_operator(); + +@*3 \INVshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive. +@<\INVshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive@>= + + LR1_invisible_shift_operator::LR1_invisible_shift_operator() + T_CTOR("|.|",T_LR1_invisible_shift_operator_,0,false,false) + {} + LR1_invisible_shift_operator LR1_invisible_shift_operator__; + yacco2::CAbs_lr1_sym* NS_yacco2_k_symbols::PTR_LR1_invisible_shift_operator__ + = &LR1_invisible_shift_operator__; + +@*2 {\bf \QUEshift{}}.\fbreak +Enum: T\_LR1\_questionable\_shift\_operator\_ +\fbreak +\line{Class: LR1\_questionable\_shift\_operator \hfil AB: N \hfil AD: N} + + + Represents a questionable grammar situation. +It pinpoints programmed error points within the grammar. +The subrule using this symbol has a lr(0) reduction as +the lookahead is not kosher and so would probably not reduce +in the lr(1) context. +It can be used both in the following grammar expressions:\fbreak +\INDENT{1.5cm}{1) \subrule \QUEshift} +\INDENT{1.5cm}{2) \subrule \PARshift \quad \QUEshift \quad NULL} +Point 1 covers the state where the current token being parsed +is improper. Point 2 is more interesting as it captures +a returned terminal that the thread passes back as an error. + +The \QUEshift was not one of the original +``k'' terminals. It replaced the ``eof'' terminal +which was marginal in intent. +I felt the \QUEshift symbol drew the reader's eye of the grammar where +``faulty'' points where captured and to force lr(0) context processing +to reduce its subrule. +Why lr(0) context? Glad u asked, the lookahead terminal --- the current +terminal being parsed, is in error and +so ``how is the subrule with the \QUEshift to reduce after its shifted T?''. +It must be divorced of any lookahead and just acted upon. + +Now another question arises: ``how is this condition detected in +a parsing state of +mixed conditions --- threading, shifting, reducing''? +There is a pecking order on the conditions tried by the parser:\fbreak +\INDENT{1.5cm}{$\circ$ threading} +\INDENT{2.5cm}{if tried and unsuccessful the balance of conditions are attempted} +\INDENT{1.5cm}{$\circ$ shifts pecking order by their presence in current parse state:} +\INDENT{2.5cm}{can the current token be shifted?} +\INDENT{2.5cm}{\QUEshift --- error condition} +\INDENT{2.5cm}{\INVshift --- explicit \emptyrule} +\INDENT{2.5cm}{\ALLshift --- any terminial} +\INDENT{1.5cm}{$\circ$ reduce} +\INDENT{2.5cm}{note shifting is favoured over reducing} + +\fbreak +\hrule +@*3 \QUEshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive. +@<\QUEshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive@>= + + LR1_questionable_shift_operator(); + +@*3 \QUEshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive. +@<\QUEshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive@>= + + LR1_questionable_shift_operator::LR1_questionable_shift_operator() + T_CTOR("|?|",T_LR1_all_shift_operator_,0,false,false) + {} + LR1_questionable_shift_operator LR1_questionable_shift_operator__; + yacco2::CAbs_lr1_sym* NS_yacco2_k_symbols::PTR_LR1_questionable_shift_operator__ += &LR1_questionable_shift_operator__; + +@*2 {\bf \REDshift{}}.\fbreak +Enum: T\_LR1\_reduce\_operator\_ +\fbreak +\line{Class: LR1\_reduce\_operator \hfil AB: Y \hfil AD: Y} + + + Its presence within the individual state of + the ``fsm'' table is to force a reduce operation. + Why? it's a back-to-back + situation within the state table whereby a thread should reduce + while its reducing lookahead is the \paralleloperator indicating to run a thread. + +\fbreak +\hrule +@*2 {\bf \TRAshift{}}.\fbreak +Enum: T\_LR1\_fset\_transience\_operator\_ +\fbreak +\line{Class: LR1\_fset\_transience\_operator \hfil AB: Y \hfil AD: Y} + + + \TRAshift has dual purposes: used in \O2linker to process the transient + first sets generated by threads, and used within a grammar's +``chained call procedure'' expression to lower thread overhead by +calling a procedure with explicit intent on double use of its +``first set'' token. +I'll give an example of a ``chained procedure call'' expression drawn from +the ``pass3.lex'' grammar handling the grammar's file include expression:\fbreak +\fbreak +\INDENT{1cm}{\subrule "\ATsign" Rprefile\_inc\_dispatcher} +\fbreak +The ``Rprefile\_inc\_dispatcher'' grammar rule has the following subrule:\fbreak +\fbreak +\INDENT{1cm}{\subrule \TRAshift "file-inclusion" NS\_prefile\_include::PROC\_TH\_prefile\_include} +\fbreak +The ``chained'' part is in the duplicating of ``\ATsign''; +that is, the parsing mechanism does not get a new terminal when shifted but +passes this T onto the called procedure. +The called PROC\_TH\_prefile\_include procedure / thread has its +start rule as:\fbreak +\fbreak +\INDENT{1cm}{\subrule "\ATsign" Rpossible\_ws Rfile\_string Reof} +\fbreak +The repeated use of ``\ATsign'' was to reenforce the idea +that the procedure called cuz of ``\ATsign'': there's that ``first set'' again. +Well time will pass its comments on this thought process. + +\fbreak +\hrule +@*3 \TRAshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive. +@<\TRAshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive@>= + + LR1_fset_transience_operator(); + +@*3 \TRAshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive. +@<\TRAshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive@>= + + LR1_fset_transience_operator::LR1_fset_transience_operator() + T_CTOR("|t|",T_LR1_fset_transience_operator_,0,false,false) + {} + LR1_fset_transience_operator LR1_fset_transience_operator__; + yacco2::CAbs_lr1_sym* NS_yacco2_k_symbols::PTR_LR1_fset_transience_operator__ + = &LR1_fset_transience_operator__; + +@*2 {\bf \PARshift{}}.\fbreak +Enum: T\_LR1\_parallel\_operator\_ +\fbreak +\line{Class: LR1\_parallel\_operator \hfil AB: N \hfil AD: N} + + + Its presence within the individual state of + the ``fsm'' table dictates potential threads to run. + You see it sprinkled throughout my grammars + to call threads. + This is part of \O2's raison d'{\^e}tre. + +\fbreak +\hrule +@*3 \PARshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive. +@<\PARshift\BRACEOPEN{}\BRACECLOSE{} user-declaration directive@>= + + LR1_parallel_operator(); + +@*3 \PARshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive. +@<\PARshift\BRACEOPEN{}\BRACECLOSE{} user-implementation directive@>= + + LR1_parallel_operator::LR1_parallel_operator() + T_CTOR("|||",T_LR1_parallel_operator_,0,false,false) + {} + LR1_parallel_operator LR1_parallel_operator__; + yacco2::CAbs_lr1_sym* NS_yacco2_k_symbols::PTR_LR1_parallel_operator__ += &LR1_parallel_operator__; + +@*1 {\bf lrk-sufx} directive.\fbreak + +As they are constants, they are defined globally +to save space / overhead in the typical new create / delete +cycle of terminals. Thar's recycling going on in this green space. + +@<lrk-sufx directive@>= + + 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_questionable_shift_operator__; + extern yacco2::CAbs_lr1_sym* PTR_LR1_all_shift_operator__; + extern yacco2::CAbs_lr1_sym* PTR_LR1_eolr__; + + +@** Index. diff --git a/web/yacco2/grammar-testsuite/Makefile_Edit_cweb b/web/yacco2/grammar-testsuite/Makefile_Edit_cweb new file mode 100644 index 0000000000..5dcdd45ab5 --- /dev/null +++ b/web/yacco2/grammar-testsuite/Makefile_Edit_cweb @@ -0,0 +1,30 @@ +# Makefile_Edit_cweb +# clean up the ctangle and cweave droppings +# changed cwebmac.tex to include \input eplain instead of modifying before o2,yacco2stbl, and yacco2extn.tex +# comment out #line of cweb emits +# +tmp=/tmp/o2 +mkdir /tmp/o2 +if [ ! -e "$tmp" ] +then + mkdir $tmp +fi + +sed_cmd1="'-e s;^#line;//line;'" +sed_cmd2="'-e s/^;$//'" + +for i in o2 o2_externs common_externs o2_defs # comment out line reference macros +do + j=$i.cpp + echo "correcting cweb file: $j" + eval "sed $sed_cmd1 $sed_cmd2 < $j > $tmp/$j" + cp $tmp/$j $j +done +for i in o2 o2_externs common_externs extndefs globals # comment out line reference macros of gened headers +do + j=$i.h + echo "correcting cweb file: $j" + eval "sed $sed_cmd1 $sed_cmd2 < $j > $tmp/$j" + cp $tmp/$j $j +done +rm -fr $tmp
\ No newline at end of file diff --git a/web/yacco2/grammar-testsuite/T.w b/web/yacco2/grammar-testsuite/T.w new file mode 100644 index 0000000000..d9b6866d85 --- /dev/null +++ b/web/yacco2/grammar-testsuite/T.w @@ -0,0 +1,17 @@ +\input "supp-pdf" +\input "/yacco2/diagrams+etc/o2mac.tex" +\DOCtitle{Terminal Vocabulary}{testout\_terminals} +{NS\_testout\_terminals}{1} + +@i "/yacco2/copyright.w" +@** Testout Terminal vocabulary.\fbreak +The one T definition is defined as \O2{} does not allow an empty definition. + +@*2 {\bf testout-ok}.\fbreak +Enum: T\_T\_testout\_ok\_ +\fbreak +\line{Class: T\_testout\_ok \hfil AB: N \hfil AD: N} + +\fbreak +\hrule +@** Index. diff --git a/web/yacco2/grammar-testsuite/dp_1.cpp b/web/yacco2/grammar-testsuite/dp_1.cpp new file mode 100644 index 0000000000..f6e231125a --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1.cpp @@ -0,0 +1,75 @@ +/* + File: dp_1.cpp + Date and Time: Sat Jan 31 11:58:31 2015 +*/ +#include "dp_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_dp_1;// grammar's ns +// first set terminals +fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ + no_rules_entries_ = 4; + per_rule_s_table_[0] = new Per_rule_s_reuse_table(); + per_rule_s_table_[1] = new Per_rule_s_reuse_table(); + per_rule_s_table_[2] = new Per_rule_s_reuse_table(); + per_rule_s_table_[3] = new Per_rule_s_reuse_table(); +} + Cdp_1:: + Cdp_1() + :yacco2::CAbs_fsm + ("dp_1.lex" + ,"1.0" + ,"7 mar 2014" + ,false + ,"LALR(1) Deremer and Pennello grammar from page 632." + ,"Sat Jan 31 11:58:31 2015 " + ,S1_Cdp_1){ + + } + +Cdp_1::~Cdp_1(){ + + for(int x = 0;x < 4;++x){ + ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; + } +} + + bool Cdp_1::failed(){ + return false; + } + void Cdp_1::op(){ +} +int Cdp_1::rhs_to_rules_mapping_[8] = { + -1 + ,0 // subrule 1 for rule 1 + ,1 // subrule 2 for rule 2 + ,1 // subrule 3 for rule 2 + ,1 // subrule 4 for rule 2 + ,1 // subrule 5 for rule 2 + ,2 // subrule 6 for rule 3 + ,3 // subrule 7 for rule 4 +}; +Rs::Rs(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs",0,Cdp_1::R_Rs_,P,false,false){ +} + +Rs1::Rs1(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs1",0,Cdp_1::R_Rs1_,P,false,false){ +} + +Ra::Ra(yacco2::Parser* P) + :CAbs_lr1_sym + ("Ra",0,Cdp_1::R_Ra_,P,false,false){ +} + +Rb::Rb(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rb",0,Cdp_1::R_Rb_,P,false,false){ +} + diff --git a/web/yacco2/grammar-testsuite/dp_1.fsc b/web/yacco2/grammar-testsuite/dp_1.fsc new file mode 100644 index 0000000000..6d539781f4 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1.fsc @@ -0,0 +1,21 @@ +/* + File: dp_1.fsc + Date and Time: Sat Jan 31 11:58:31 2015 +*/ +transitive n +grammar-name "dp_1" +name-space "NS_dp_1" +thread-name "Cdp_1" +monolithic y +file-name "dp_1.fsc" +no-of-T 569 +list-of-native-first-set-terminals 2 + raw_a + raw_b +end-list-of-native-first-set-terminals +list-of-transitive-threads 0 +end-list-of-transitive-threads +list-of-used-threads 0 +end-list-of-used-threads +fsm-comments +"LALR(1) Deremer and Pennello grammar from page 632." diff --git a/web/yacco2/grammar-testsuite/dp_1.h b/web/yacco2/grammar-testsuite/dp_1.h new file mode 100644 index 0000000000..767617d72f --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1.h @@ -0,0 +1,76 @@ +/* + File: dp_1.h + Date and Time: Sat Jan 31 11:58:31 2015 +*/ +#ifndef __dp_1_h__ +#define __dp_1_h__ 1 +#include "yacco2.h" +#include "yacco2_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "yacco2_err_symbols.h" +#include "yacco2_terminals.h" +#include "yacco2_characters.h" +// monolithic grammar: no thread +extern yacco2::State S1_Cdp_1; +namespace NS_dp_1 { +using namespace NS_yacco2_T_enum;// enumerate +using namespace yacco2; +struct fsm_rules_reuse_table_type{ + fsm_rules_reuse_table_type(); + int no_rules_entries_; + Per_rule_s_reuse_table* per_rule_s_table_[4]; +}; +class Cdp_1: public yacco2::CAbs_fsm { + public: + enum rules_and_subrules{ + start_of_rule_list = NS_yacco2_T_enum::T_Enum::sum_total_T + ,R_Rs_ = 569//start_of_rule_list + 0 + ,rhs1_Rs_ = 1 + ,R_Rs1_ = 570//start_of_rule_list + 2 + ,rhs1_Rs1_ = 2 + ,rhs2_Rs1_ = 3 + ,rhs3_Rs1_ = 4 + ,rhs4_Rs1_ = 5 + ,R_Ra_ = 571//start_of_rule_list + 4 + ,rhs1_Ra_ = 6 + ,R_Rb_ = 572//start_of_rule_list + 6 + ,rhs1_Rb_ = 7 + }; + //no of la sets = 4 + //no of states = 15 + Cdp_1(); + ~Cdp_1(); + void op(); + bool failed(); + void reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule); + fsm_rules_reuse_table_type fsm_rules_reuse_table; + static int rhs_to_rules_mapping_[8]; + }; +struct Rs; +struct Rs1; +struct Ra; +struct Rb; +struct Rs:public yacco2::CAbs_lr1_sym { + Rs(yacco2::Parser* P); + public: +}; + +struct Rs1:public yacco2::CAbs_lr1_sym { + Rs1(yacco2::Parser* P); + public: +}; + +struct Ra:public yacco2::CAbs_lr1_sym { + Ra(yacco2::Parser* P); + public: +}; + +struct Rb:public yacco2::CAbs_lr1_sym { + Rb(yacco2::Parser* P); + public: +}; + +} // end of namespace + +#endif diff --git a/web/yacco2/grammar-testsuite/dp_1.lex b/web/yacco2/grammar-testsuite/dp_1.lex new file mode 100644 index 0000000000..8c2c364024 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1.lex @@ -0,0 +1,40 @@ +/* +Author: Dave Bone +FILE: dp_1.lex +Date: 7 mar 2014 +Purpose: Test out compiler/compiler with Deremer and Pennello lalr grammar page 632 +*/ + +/@ +@** Deremer and Pennello page 632 Lalr(1) Grammar.\fbreak +Efficient Computation of LALR(1) Look-Ahead Sets\fbreak +ACM Transactions on Programming Languages and Systems, 4(4):615—649, 1982\fbreak +@/ + +fsm +(fsm-id "dp_1.lex",fsm-filename dp_1,fsm-namespace NS_dp_1 +,fsm-class Cdp_1 +,fsm-version "1.0",fsm-date "7 mar 2014",fsm-debug "false" +,fsm-comments "LALR(1) Deremer and Pennello grammar from page 632.") +@"/usr/local/yacco2/compiler/grammars/yacco2_T_includes.T" + +rules{ +Rs(){ + -> Rs1 eog +} + +Rs1(){ + -> a Ra c + -> a g d + -> b Ra d + -> b g c +} + +Ra(){ + -> Rb +} + +Rb(){ + -> g +} +} diff --git a/web/yacco2/grammar-testsuite/dp_1.pdf b/web/yacco2/grammar-testsuite/dp_1.pdf Binary files differnew file mode 100644 index 0000000000..8e40087b59 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1.pdf diff --git a/web/yacco2/grammar-testsuite/dp_1_idx.pdf b/web/yacco2/grammar-testsuite/dp_1_idx.pdf Binary files differnew file mode 100644 index 0000000000..48ac4d2209 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1_idx.pdf diff --git a/web/yacco2/grammar-testsuite/dp_1_idx.w b/web/yacco2/grammar-testsuite/dp_1_idx.w new file mode 100644 index 0000000000..cd849b0cf7 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1_idx.w @@ -0,0 +1,228 @@ +\input "supp-pdf" +\input "/yacco2/diagrams+etc/o2mac.tex" +\IDXdoctitle{dp\_1\_idx.w}{dp\_1\_idx.w} +@** Grammar symbols: Used cross reference.\fbreak +Reference of each grammar's symbol used within each rule's productions. The index +uses the tripple: rule name, its subrule no, and the symbol's position + within the symbol string. +@*2 Ra:.\fbreak +Rs1 1.2\ \ +Rs1 3.2\ \ +\fbreak +@*2 Rb:.\fbreak +Ra 1.1\ \ +\fbreak +@*2 Rs1:.\fbreak +Rs 1.1\ \ +\fbreak +@*2 a:.\fbreak +Rs1 1.1\ \ +Rs1 2.1\ \ +\fbreak +@*2 b:.\fbreak +Rs1 3.1\ \ +Rs1 4.1\ \ +\fbreak +@*2 c:.\fbreak +Rs1 1.3\ \ +Rs1 4.3\ \ +\fbreak +@*2 d:.\fbreak +Rs1 2.3\ \ +Rs1 3.3\ \ +\fbreak +@*2 eog:.\fbreak +Rs 1.2\ \ +\fbreak +@*2 g:.\fbreak +Rs1 2.2\ \ +Rs1 4.2\ \ +Rb 1.1\ \ +\fbreak +@** Grammar Rules's First Sets.\fbreak + +@*2 |Rs| \# in set: 2.\fbreak + a\ \ + b\ \ +@*2 |Rs1| \# in set: 2.\fbreak + a\ \ + b\ \ +@*2 |Ra| \# in set: 1.\fbreak + g\ \ +@*2 |Rb| \# in set: 1.\fbreak + g\ \ +@*2 LR State Network.\fbreak +\LRstatenetwork + +@*3 Rs.\fbreak +@.R$_{1}$ --- Rs@> + +\Subrulestartsymstrindent{1} Rs1\ \ +eog\ \ +\Subrulederivedstatesindent +1\ \ +12\ \ +13\ \ +@*3 Rs1.\fbreak +@.R$_{2}$ --- Rs1@> + +\Subrulestartsymstrindent{1} a\ \ +Ra\ \ +c\ \ +\Subrulederivedstatesindent +1\ \ +2\ \ +5\ \ +6\ \ +\Subrulestartsymstrindent{2} a\ \ +g\ \ +d\ \ +\Subrulederivedstatesindent +1\ \ +2\ \ +3\ \ +4\ \ +\Subrulestartsymstrindent{3} b\ \ +Ra\ \ +d\ \ +\Subrulederivedstatesindent +1\ \ +7\ \ +10\ \ +11\ \ +\Subrulestartsymstrindent{4} b\ \ +g\ \ +c\ \ +\Subrulederivedstatesindent +1\ \ +7\ \ +8\ \ +9\ \ +@*3 Ra.\fbreak +@.R$_{3}$ --- Ra@> + +\Subrulestartsymstrindent{1} Rb\ \ +\Subrulederivedstatesindent +2\ \ +14\ \ +\Subrulederivedstatesindent +7\ \ +15\ \ +@*3 Rb.\fbreak +@.R$_{4}$ --- Rb@> + +\Subrulestartsymstrindent{1} g\ \ +\Subrulederivedstatesindent +2\ \ +3\ \ +\Subrulederivedstatesindent +7\ \ +8\ \ +@*2 List of reducing states.\fbreak +\Listofreducingstates +\fbreak + +\Reducedstatelist +{3\ShiftReduce\ \ } +{4\Reduceonly\ \ } +{6\Reduceonly\ \ } +{8\ShiftReduce\ \ } +{9\Reduceonly\ \ } +{11\Reduceonly\ \ } +{13\Reduceonly\ \ } +{14\Reduceonly\ \ } +{15\Reduceonly\ \ } +@** Lr1 State's Follow sets and reducing lookahead sets.\fbreak +\FollSetnotesintro +\fbreak +\FollSetstateno{1} +\halign{ +\span\FollSettemplate +\FollSettitle +{Rs\rulenameno{1}}& +{ +} \cr +} +\FollSetreducinglocalyield +eolr. + +\halign{ +\span\FollSettemplate +\FollSettitle +{Rs1\rulenameno{2}}& +{ +\FollSetcreators{1}{1}{1} +} \cr +} +\FollSetreducinglocalyield +eog. + +\FollSetstateno{2} +\halign{ +\span\FollSettemplate +\FollSettitle +{Ra\rulenameno{3}}& +{ +\FollSetcreators{2}{1}{2} +} \cr +} +\FollSetreducinglocalyield +c. + +\halign{ +\span\FollSettemplate +\FollSettitle +{Rb\rulenameno{4}}& +{ +\FollSetcreators{3}{1}{1} +\FollSettransition{2}{3} +} \cr +} +\FollSetreducinglocalyield + +\FollSetstateno{7} +\halign{ +\span\FollSettemplate +\FollSettitle +{Ra\rulenameno{3}}& +{ +\FollSetcreators{2}{3}{2} +} \cr +} +\FollSetreducinglocalyield +d. + +\halign{ +\span\FollSettemplate +\FollSettitle +{Rb\rulenameno{4}}& +{ +\FollSetcreators{3}{1}{1} +\FollSettransition{7}{3} +} \cr +} +\FollSetreducinglocalyield + +@*1 Common Follow sets.\fbreak + +@*2 LA set: 1.\fbreak +\item{} +\raggedright +c. + +@*2 LA set: 2.\fbreak +\item{} +\raggedright +eog. + +@*2 LA set: 3.\fbreak +\item{} +\raggedright +d. + +@*2 LA set: 4.\fbreak +\item{} +\raggedright +eolr. + +@** Index. diff --git a/web/yacco2/grammar-testsuite/dp_1sym.cpp b/web/yacco2/grammar-testsuite/dp_1sym.cpp new file mode 100644 index 0000000000..aec0a228ff --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1sym.cpp @@ -0,0 +1,125 @@ +/* + File: dp_1sym.cpp + Date and Time: Sat Jan 31 11:58:31 2015 +*/ +#include "dp_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_dp_1;// grammar's ns +// first set terminals +// monolithic grammar --- no thread +void +Cdp_1::reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule){ + int reducing_rule = rhs_to_rules_mapping_[Sub_rule_no]; + Per_rule_s_reuse_table* rule_reuse_tbl_ptr = + fsm_rules_reuse_table.per_rule_s_table_[reducing_rule]; + Rule_s_reuse_entry* re(0); + find_a_recycled_rule(rule_reuse_tbl_ptr,&re); + (*Recycled_rule) = re; + fnd_re: switch (Sub_rule_no){ + case rhs1_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Rs1_:{ + Rs1* sym; + if(re->rule_ == 0){ + sym = new Rs1(parser__); + re->rule_ = sym; + }else{ + sym = (Rs1*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs2_Rs1_:{ + Rs1* sym; + if(re->rule_ == 0){ + sym = new Rs1(parser__); + re->rule_ = sym; + }else{ + sym = (Rs1*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs3_Rs1_:{ + Rs1* sym; + if(re->rule_ == 0){ + sym = new Rs1(parser__); + re->rule_ = sym; + }else{ + sym = (Rs1*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs4_Rs1_:{ + Rs1* sym; + if(re->rule_ == 0){ + sym = new Rs1(parser__); + re->rule_ = sym; + }else{ + sym = (Rs1*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs1_Ra_:{ + Ra* sym; + if(re->rule_ == 0){ + sym = new Ra(parser__); + re->rule_ = sym; + }else{ + sym = (Ra*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Rb_:{ + Rb* sym; + if(re->rule_ == 0){ + sym = new Rb(parser__); + re->rule_ = sym; + }else{ + sym = (Rb*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + default: return; + } +} diff --git a/web/yacco2/grammar-testsuite/dp_1tbl.cpp b/web/yacco2/grammar-testsuite/dp_1tbl.cpp new file mode 100644 index 0000000000..d7e4a56a55 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_1tbl.cpp @@ -0,0 +1,287 @@ +/* + File: dp_1tbl.cpp + Date and Time: Sat Jan 31 11:58:31 2015 +*/ +#include "dp_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_dp_1;// grammar's ns +// first set terminals +// raw_c +yacco2::UCHAR LA1_Cdp_1[] ={ +1 +,13,8 +}; +// LR1_eog +yacco2::UCHAR LA2_Cdp_1[] ={ +1 +,0,2 +}; +// raw_d +yacco2::UCHAR LA3_Cdp_1[] ={ +1 +,13,16 +}; +// LR1_eolr +yacco2::UCHAR LA4_Cdp_1[] ={ +1 +,0,4 +}; +extern yacco2::State S1_Cdp_1; +extern yacco2::State S2_Cdp_1; +extern yacco2::State S3_Cdp_1; +extern yacco2::State S4_Cdp_1; +extern yacco2::State S5_Cdp_1; +extern yacco2::State S6_Cdp_1; +extern yacco2::State S7_Cdp_1; +extern yacco2::State S8_Cdp_1; +extern yacco2::State S9_Cdp_1; +extern yacco2::State S10_Cdp_1; +extern yacco2::State S11_Cdp_1; +extern yacco2::State S12_Cdp_1; +extern yacco2::State S13_Cdp_1; +extern yacco2::State S14_Cdp_1; +extern yacco2::State S15_Cdp_1; +struct S1std_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[4]; +}; +S1std_Cdp_1 S1st_Cdp_1 = { + 4 + , + {// start of table + {105,(State*)&S2_Cdp_1} // shift sym: raw_a + ,{106,(State*)&S7_Cdp_1} // shift sym: raw_b + ,{569,(State*)&S1_Cdp_1} // accept sym: Rs + ,{570,(State*)&S12_Cdp_1} // shift sym: Rs1 + }// end of shift table +}; +yacco2::State S1_Cdp_1 = //State's vectored into symbol: " No symbol" +{1 +,0,0,0,0,(Shift_tbl*)&S1st_Cdp_1,0,0,0,0}; +struct S2std_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S2std_Cdp_1 S2st_Cdp_1 = { + 3 + , + {// start of table + {111,(State*)&S3_Cdp_1} // shift sym: raw_g + ,{571,(State*)&S5_Cdp_1} // shift sym: Ra + ,{572,(State*)&S14_Cdp_1} // shift sym: Rb + }// end of shift table +}; +yacco2::State S2_Cdp_1 = //State's vectored into symbol: "a" +{2 +,0,0,0,0,(Shift_tbl*)&S2st_Cdp_1,0,0,0,0}; +struct S3std_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S3std_Cdp_1 S3st_Cdp_1 = { + 1 + , + {// start of table + {108,(State*)&S4_Cdp_1} // shift sym: raw_d + }// end of shift table +}; +struct S3rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S3rtd_Cdp_1 S3rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cdp_1,Cdp_1::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S3_Cdp_1 = //State's vectored into symbol: "g" +{3 +,0,0,0,0,(Shift_tbl*)&S3st_Cdp_1,(Reduce_tbl*)&S3rt_Cdp_1,0,0,0}; +struct S4rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S4rtd_Cdp_1 S4rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cdp_1,Cdp_1::rhs2_Rs1_} + }// end of reduce table +}; +yacco2::State S4_Cdp_1 = //State's vectored into symbol: "d" +{4 +,0,0,0,0,0,(Reduce_tbl*)&S4rt_Cdp_1,0,0,0}; +struct S5std_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S5std_Cdp_1 S5st_Cdp_1 = { + 1 + , + {// start of table + {107,(State*)&S6_Cdp_1} // shift sym: raw_c + }// end of shift table +}; +yacco2::State S5_Cdp_1 = //State's vectored into symbol: "Ra" +{5 +,0,0,0,0,(Shift_tbl*)&S5st_Cdp_1,0,0,0,0}; +struct S6rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S6rtd_Cdp_1 S6rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cdp_1,Cdp_1::rhs1_Rs1_} + }// end of reduce table +}; +yacco2::State S6_Cdp_1 = //State's vectored into symbol: "c" +{6 +,0,0,0,0,0,(Reduce_tbl*)&S6rt_Cdp_1,0,0,0}; +struct S7std_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S7std_Cdp_1 S7st_Cdp_1 = { + 3 + , + {// start of table + {111,(State*)&S8_Cdp_1} // shift sym: raw_g + ,{571,(State*)&S10_Cdp_1} // shift sym: Ra + ,{572,(State*)&S15_Cdp_1} // shift sym: Rb + }// end of shift table +}; +yacco2::State S7_Cdp_1 = //State's vectored into symbol: "b" +{7 +,0,0,0,0,(Shift_tbl*)&S7st_Cdp_1,0,0,0,0}; +struct S8std_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S8std_Cdp_1 S8st_Cdp_1 = { + 1 + , + {// start of table + {107,(State*)&S9_Cdp_1} // shift sym: raw_c + }// end of shift table +}; +struct S8rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S8rtd_Cdp_1 S8rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Cdp_1,Cdp_1::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S8_Cdp_1 = //State's vectored into symbol: "g" +{8 +,0,0,0,0,(Shift_tbl*)&S8st_Cdp_1,(Reduce_tbl*)&S8rt_Cdp_1,0,0,0}; +struct S9rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S9rtd_Cdp_1 S9rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cdp_1,Cdp_1::rhs4_Rs1_} + }// end of reduce table +}; +yacco2::State S9_Cdp_1 = //State's vectored into symbol: "c" +{9 +,0,0,0,0,0,(Reduce_tbl*)&S9rt_Cdp_1,0,0,0}; +struct S10std_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S10std_Cdp_1 S10st_Cdp_1 = { + 1 + , + {// start of table + {108,(State*)&S11_Cdp_1} // shift sym: raw_d + }// end of shift table +}; +yacco2::State S10_Cdp_1 = //State's vectored into symbol: "Ra" +{10 +,0,0,0,0,(Shift_tbl*)&S10st_Cdp_1,0,0,0,0}; +struct S11rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S11rtd_Cdp_1 S11rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cdp_1,Cdp_1::rhs3_Rs1_} + }// end of reduce table +}; +yacco2::State S11_Cdp_1 = //State's vectored into symbol: "d" +{11 +,0,0,0,0,0,(Reduce_tbl*)&S11rt_Cdp_1,0,0,0}; +struct S12std_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S12std_Cdp_1 S12st_Cdp_1 = { + 1 + , + {// start of table + {1,(State*)&S13_Cdp_1} // shift sym: LR1_eog + }// end of shift table +}; +yacco2::State S12_Cdp_1 = //State's vectored into symbol: "Rs1" +{12 +,0,0,0,0,(Shift_tbl*)&S12st_Cdp_1,0,0,0,0}; +struct S13rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S13rtd_Cdp_1 S13rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cdp_1,Cdp_1::rhs1_Rs_} + }// end of reduce table +}; +yacco2::State S13_Cdp_1 = //State's vectored into symbol: "eog" +{13 +,0,0,0,0,0,(Reduce_tbl*)&S13rt_Cdp_1,0,0,0}; +struct S14rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S14rtd_Cdp_1 S14rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cdp_1,Cdp_1::rhs1_Ra_} + }// end of reduce table +}; +yacco2::State S14_Cdp_1 = //State's vectored into symbol: "Rb" +{14 +,0,0,0,0,0,(Reduce_tbl*)&S14rt_Cdp_1,0,0,0}; +struct S15rtd_Cdp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S15rtd_Cdp_1 S15rt_Cdp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Cdp_1,Cdp_1::rhs1_Ra_} + }// end of reduce table +}; +yacco2::State S15_Cdp_1 = //State's vectored into symbol: "Rb" +{15 +,0,0,0,0,0,(Reduce_tbl*)&S15rt_Cdp_1,0,0,0}; diff --git a/web/yacco2/grammar-testsuite/dp_2.cpp b/web/yacco2/grammar-testsuite/dp_2.cpp new file mode 100644 index 0000000000..1d9b488c8e --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_2.cpp @@ -0,0 +1,88 @@ +/* + File: dp_2.cpp + Date and Time: Sat Jan 31 11:58:36 2015 +*/ +#include "dp_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_dp_2;// grammar's ns +// first set terminals +fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ + no_rules_entries_ = 6; + per_rule_s_table_[0] = new Per_rule_s_reuse_table(); + per_rule_s_table_[1] = new Per_rule_s_reuse_table(); + per_rule_s_table_[2] = new Per_rule_s_reuse_table(); + per_rule_s_table_[3] = new Per_rule_s_reuse_table(); + per_rule_s_table_[4] = new Per_rule_s_reuse_table(); + per_rule_s_table_[5] = new Per_rule_s_reuse_table(); +} + Cdp_2:: + Cdp_2() + :yacco2::CAbs_fsm + ("dp_2.lex" + ,"1.0" + ,"7 mar 2014" + ,false + ,"LR(0) Deremer and Pennello grammar from page 633." + ,"Sat Jan 31 11:58:36 2015 " + ,S1_Cdp_2){ + + } + +Cdp_2::~Cdp_2(){ + + for(int x = 0;x < 6;++x){ + ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; + } +} + + bool Cdp_2::failed(){ + return false; + } + void Cdp_2::op(){ +} +int Cdp_2::rhs_to_rules_mapping_[9] = { + -1 + ,0 // subrule 1 for rule 1 + ,1 // subrule 2 for rule 2 + ,1 // subrule 3 for rule 2 + ,1 // subrule 4 for rule 2 + ,2 // subrule 5 for rule 3 + ,3 // subrule 6 for rule 4 + ,4 // subrule 7 for rule 5 + ,5 // subrule 8 for rule 6 +}; +Rs::Rs(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs",0,Cdp_2::R_Rs_,P,false,false){ +} + +Rs1::Rs1(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs1",0,Cdp_2::R_Rs1_,P,false,false){ +} + +Rb::Rb(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rb",0,Cdp_2::R_Rb_,P,false,false){ +} + +Rc::Rc(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rc",0,Cdp_2::R_Rc_,P,false,false){ +} + +Rd::Rd(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rd",0,Cdp_2::R_Rd_,P,false,false){ +} + +Re::Re(yacco2::Parser* P) + :CAbs_lr1_sym + ("Re",0,Cdp_2::R_Re_,P,false,false){ +} + diff --git a/web/yacco2/grammar-testsuite/dp_2.fsc b/web/yacco2/grammar-testsuite/dp_2.fsc new file mode 100644 index 0000000000..660e0e237b --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_2.fsc @@ -0,0 +1,21 @@ +/* + File: dp_2.fsc + Date and Time: Sat Jan 31 11:58:36 2015 +*/ +transitive n +grammar-name "dp_2" +name-space "NS_dp_2" +thread-name "Cdp_2" +monolithic y +file-name "dp_2.fsc" +no-of-T 569 +list-of-native-first-set-terminals 2 + raw_a + raw_c +end-list-of-native-first-set-terminals +list-of-transitive-threads 0 +end-list-of-transitive-threads +list-of-used-threads 0 +end-list-of-used-threads +fsm-comments +"LR(0) Deremer and Pennello grammar from page 633." diff --git a/web/yacco2/grammar-testsuite/dp_2.h b/web/yacco2/grammar-testsuite/dp_2.h new file mode 100644 index 0000000000..f53f65f258 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_2.h @@ -0,0 +1,91 @@ +/* + File: dp_2.h + Date and Time: Sat Jan 31 11:58:36 2015 +*/ +#ifndef __dp_2_h__ +#define __dp_2_h__ 1 +#include "yacco2.h" +#include "yacco2_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "yacco2_err_symbols.h" +#include "yacco2_terminals.h" +#include "yacco2_characters.h" +// monolithic grammar: no thread +extern yacco2::State S1_Cdp_2; +namespace NS_dp_2 { +using namespace NS_yacco2_T_enum;// enumerate +using namespace yacco2; +struct fsm_rules_reuse_table_type{ + fsm_rules_reuse_table_type(); + int no_rules_entries_; + Per_rule_s_reuse_table* per_rule_s_table_[6]; +}; +class Cdp_2: public yacco2::CAbs_fsm { + public: + enum rules_and_subrules{ + start_of_rule_list = NS_yacco2_T_enum::T_Enum::sum_total_T + ,R_Rs_ = 569//start_of_rule_list + 0 + ,rhs1_Rs_ = 1 + ,R_Rs1_ = 570//start_of_rule_list + 2 + ,rhs1_Rs1_ = 2 + ,rhs2_Rs1_ = 3 + ,rhs3_Rs1_ = 4 + ,R_Rb_ = 571//start_of_rule_list + 4 + ,rhs1_Rb_ = 5 + ,R_Rc_ = 572//start_of_rule_list + 6 + ,rhs1_Rc_ = 6 + ,R_Rd_ = 573//start_of_rule_list + 8 + ,rhs1_Rd_ = 7 + ,R_Re_ = 574//start_of_rule_list + 10 + ,rhs1_Re_ = 8 + }; + //no of la sets = 4 + //no of states = 13 + Cdp_2(); + ~Cdp_2(); + void op(); + bool failed(); + void reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule); + fsm_rules_reuse_table_type fsm_rules_reuse_table; + static int rhs_to_rules_mapping_[9]; + }; +struct Rs; +struct Rs1; +struct Rb; +struct Rc; +struct Rd; +struct Re; +struct Rs:public yacco2::CAbs_lr1_sym { + Rs(yacco2::Parser* P); + public: +}; + +struct Rs1:public yacco2::CAbs_lr1_sym { + Rs1(yacco2::Parser* P); + public: +}; + +struct Rb:public yacco2::CAbs_lr1_sym { + Rb(yacco2::Parser* P); + public: +}; + +struct Rc:public yacco2::CAbs_lr1_sym { + Rc(yacco2::Parser* P); + public: +}; + +struct Rd:public yacco2::CAbs_lr1_sym { + Rd(yacco2::Parser* P); + public: +}; + +struct Re:public yacco2::CAbs_lr1_sym { + Re(yacco2::Parser* P); + public: +}; + +} // end of namespace + +#endif diff --git a/web/yacco2/grammar-testsuite/dp_2.lex b/web/yacco2/grammar-testsuite/dp_2.lex new file mode 100644 index 0000000000..822b88fb8c --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_2.lex @@ -0,0 +1,46 @@ +/* +Author: Dave Bone +FILE: dp_2.lex +Date: 7 mar 2014 +Purpose: Test out compiler/compiler with Deremer and Pennello lair grammar page 633 +*/ +/@ +@** Deremer and Pennello page 633 Lalr(0) Grammar.\fbreak +Efficient Computation of LALR(1) Look-Ahead Sets\fbreak +ACM Transactions on Programming Languages and Systems, 4(4):615—649, 1982\fbreak +@/ +fsm +(fsm-id "dp_2.lex",fsm-filename dp_2,fsm-namespace NS_dp_2 +,fsm-class Cdp_2 +,fsm-version "1.0",fsm-date "7 mar 2014",fsm-debug "false" +,fsm-comments "LR(0) Deremer and Pennello grammar from page 633.") +@"/usr/local/yacco2/compiler/grammars/yacco2_T_includes.T" + +rules{ +Rs(){ + -> Rs1 eog +} + +Rs1(){ + -> c d + -> a Rb d + -> Rc Rb g +} + +Rb(){ + -> Rd Re +} + +Rc(){ + -> c +} + +Rd(){ + -> +} + +Re(){ + -> +} +} + diff --git a/web/yacco2/grammar-testsuite/dp_2.pdf b/web/yacco2/grammar-testsuite/dp_2.pdf Binary files differnew file mode 100644 index 0000000000..22149cc57e --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_2.pdf diff --git a/web/yacco2/grammar-testsuite/dp_2_idx.pdf b/web/yacco2/grammar-testsuite/dp_2_idx.pdf Binary files differnew file mode 100644 index 0000000000..196c3f1fcc --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_2_idx.pdf diff --git a/web/yacco2/grammar-testsuite/dp_2sym.cpp b/web/yacco2/grammar-testsuite/dp_2sym.cpp new file mode 100644 index 0000000000..30151cbff5 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_2sym.cpp @@ -0,0 +1,139 @@ +/* + File: dp_2sym.cpp + Date and Time: Sat Jan 31 11:58:36 2015 +*/ +#include "dp_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_dp_2;// grammar's ns +// first set terminals +// monolithic grammar --- no thread +void +Cdp_2::reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule){ + int reducing_rule = rhs_to_rules_mapping_[Sub_rule_no]; + Per_rule_s_reuse_table* rule_reuse_tbl_ptr = + fsm_rules_reuse_table.per_rule_s_table_[reducing_rule]; + Rule_s_reuse_entry* re(0); + find_a_recycled_rule(rule_reuse_tbl_ptr,&re); + (*Recycled_rule) = re; + fnd_re: switch (Sub_rule_no){ + case rhs1_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Rs1_:{ + Rs1* sym; + if(re->rule_ == 0){ + sym = new Rs1(parser__); + re->rule_ = sym; + }else{ + sym = (Rs1*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs2_Rs1_:{ + Rs1* sym; + if(re->rule_ == 0){ + sym = new Rs1(parser__); + re->rule_ = sym; + }else{ + sym = (Rs1*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs3_Rs1_:{ + Rs1* sym; + if(re->rule_ == 0){ + sym = new Rs1(parser__); + re->rule_ = sym; + }else{ + sym = (Rs1*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs1_Rb_:{ + Rb* sym; + if(re->rule_ == 0){ + sym = new Rb(parser__); + re->rule_ = sym; + }else{ + sym = (Rb*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Rc_:{ + Rc* sym; + if(re->rule_ == 0){ + sym = new Rc(parser__); + re->rule_ = sym; + }else{ + sym = (Rc*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Rd_:{ + Rd* sym; + if(re->rule_ == 0){ + sym = new Rd(parser__); + re->rule_ = sym; + }else{ + sym = (Rd*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 0; + + + return;} + case rhs1_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 0; + + + return;} + default: return; + } +} diff --git a/web/yacco2/grammar-testsuite/dp_2tbl.cpp b/web/yacco2/grammar-testsuite/dp_2tbl.cpp new file mode 100644 index 0000000000..b44ff81fe4 --- /dev/null +++ b/web/yacco2/grammar-testsuite/dp_2tbl.cpp @@ -0,0 +1,279 @@ +/* + File: dp_2tbl.cpp + Date and Time: Sat Jan 31 11:58:36 2015 +*/ +#include "dp_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_dp_2;// grammar's ns +// first set terminals +// raw_d +// raw_g +yacco2::UCHAR LA1_Cdp_2[] ={ +1 +,13,144 +}; +// LR1_eog +yacco2::UCHAR LA2_Cdp_2[] ={ +1 +,0,2 +}; +// raw_g +yacco2::UCHAR LA3_Cdp_2[] ={ +1 +,13,128 +}; +// LR1_eolr +yacco2::UCHAR LA4_Cdp_2[] ={ +1 +,0,4 +}; +extern yacco2::State S1_Cdp_2; +extern yacco2::State S2_Cdp_2; +extern yacco2::State S3_Cdp_2; +extern yacco2::State S4_Cdp_2; +extern yacco2::State S5_Cdp_2; +extern yacco2::State S6_Cdp_2; +extern yacco2::State S7_Cdp_2; +extern yacco2::State S8_Cdp_2; +extern yacco2::State S9_Cdp_2; +extern yacco2::State S10_Cdp_2; +extern yacco2::State S11_Cdp_2; +extern yacco2::State S12_Cdp_2; +extern yacco2::State S13_Cdp_2; +struct S1std_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[5]; +}; +S1std_Cdp_2 S1st_Cdp_2 = { + 5 + , + {// start of table + {105,(State*)&S2_Cdp_2} // shift sym: raw_a + ,{107,(State*)&S5_Cdp_2} // shift sym: raw_c + ,{569,(State*)&S1_Cdp_2} // accept sym: Rs + ,{570,(State*)&S7_Cdp_2} // shift sym: Rs1 + ,{572,(State*)&S9_Cdp_2} // shift sym: Rc + }// end of shift table +}; +yacco2::State S1_Cdp_2 = //State's vectored into symbol: " No symbol" +{1 +,0,0,0,0,(Shift_tbl*)&S1st_Cdp_2,0,0,0,0}; +struct S2std_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[2]; +}; +S2std_Cdp_2 S2st_Cdp_2 = { + 2 + , + {// start of table + {571,(State*)&S3_Cdp_2} // shift sym: Rb + ,{573,(State*)&S12_Cdp_2} // shift sym: Rd + }// end of shift table +}; +struct S2rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S2rtd_Cdp_2 S2rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cdp_2,Cdp_2::rhs1_Rd_} + }// end of reduce table +}; +yacco2::State S2_Cdp_2 = //State's vectored into symbol: "a" +{2 +,0,0,0,0,(Shift_tbl*)&S2st_Cdp_2,(Reduce_tbl*)&S2rt_Cdp_2,0,0,0}; +struct S3std_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S3std_Cdp_2 S3st_Cdp_2 = { + 1 + , + {// start of table + {108,(State*)&S4_Cdp_2} // shift sym: raw_d + }// end of shift table +}; +yacco2::State S3_Cdp_2 = //State's vectored into symbol: "Rb" +{3 +,0,0,0,0,(Shift_tbl*)&S3st_Cdp_2,0,0,0,0}; +struct S4rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S4rtd_Cdp_2 S4rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cdp_2,Cdp_2::rhs2_Rs1_} + }// end of reduce table +}; +yacco2::State S4_Cdp_2 = //State's vectored into symbol: "d" +{4 +,0,0,0,0,0,(Reduce_tbl*)&S4rt_Cdp_2,0,0,0}; +struct S5std_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S5std_Cdp_2 S5st_Cdp_2 = { + 1 + , + {// start of table + {108,(State*)&S6_Cdp_2} // shift sym: raw_d + }// end of shift table +}; +struct S5rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S5rtd_Cdp_2 S5rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Cdp_2,Cdp_2::rhs1_Rc_} + }// end of reduce table +}; +yacco2::State S5_Cdp_2 = //State's vectored into symbol: "c" +{5 +,0,0,0,0,(Shift_tbl*)&S5st_Cdp_2,(Reduce_tbl*)&S5rt_Cdp_2,0,0,0}; +struct S6rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S6rtd_Cdp_2 S6rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cdp_2,Cdp_2::rhs1_Rs1_} + }// end of reduce table +}; +yacco2::State S6_Cdp_2 = //State's vectored into symbol: "d" +{6 +,0,0,0,0,0,(Reduce_tbl*)&S6rt_Cdp_2,0,0,0}; +struct S7std_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S7std_Cdp_2 S7st_Cdp_2 = { + 1 + , + {// start of table + {1,(State*)&S8_Cdp_2} // shift sym: LR1_eog + }// end of shift table +}; +yacco2::State S7_Cdp_2 = //State's vectored into symbol: "Rs1" +{7 +,0,0,0,0,(Shift_tbl*)&S7st_Cdp_2,0,0,0,0}; +struct S8rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S8rtd_Cdp_2 S8rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cdp_2,Cdp_2::rhs1_Rs_} + }// end of reduce table +}; +yacco2::State S8_Cdp_2 = //State's vectored into symbol: "eog" +{8 +,0,0,0,0,0,(Reduce_tbl*)&S8rt_Cdp_2,0,0,0}; +struct S9std_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[2]; +}; +S9std_Cdp_2 S9st_Cdp_2 = { + 2 + , + {// start of table + {571,(State*)&S10_Cdp_2} // shift sym: Rb + ,{573,(State*)&S12_Cdp_2} // shift sym: Rd + }// end of shift table +}; +struct S9rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S9rtd_Cdp_2 S9rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Cdp_2,Cdp_2::rhs1_Rd_} + }// end of reduce table +}; +yacco2::State S9_Cdp_2 = //State's vectored into symbol: "Rc" +{9 +,0,0,0,0,(Shift_tbl*)&S9st_Cdp_2,(Reduce_tbl*)&S9rt_Cdp_2,0,0,0}; +struct S10std_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S10std_Cdp_2 S10st_Cdp_2 = { + 1 + , + {// start of table + {111,(State*)&S11_Cdp_2} // shift sym: raw_g + }// end of shift table +}; +yacco2::State S10_Cdp_2 = //State's vectored into symbol: "Rb" +{10 +,0,0,0,0,(Shift_tbl*)&S10st_Cdp_2,0,0,0,0}; +struct S11rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S11rtd_Cdp_2 S11rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cdp_2,Cdp_2::rhs3_Rs1_} + }// end of reduce table +}; +yacco2::State S11_Cdp_2 = //State's vectored into symbol: "g" +{11 +,0,0,0,0,0,(Reduce_tbl*)&S11rt_Cdp_2,0,0,0}; +struct S12std_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S12std_Cdp_2 S12st_Cdp_2 = { + 1 + , + {// start of table + {574,(State*)&S13_Cdp_2} // shift sym: Re + }// end of shift table +}; +struct S12rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S12rtd_Cdp_2 S12rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cdp_2,Cdp_2::rhs1_Re_} + }// end of reduce table +}; +yacco2::State S12_Cdp_2 = //State's vectored into symbol: "Rd" +{12 +,0,0,0,0,(Shift_tbl*)&S12st_Cdp_2,(Reduce_tbl*)&S12rt_Cdp_2,0,0,0}; +struct S13rtd_Cdp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S13rtd_Cdp_2 S13rt_Cdp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cdp_2,Cdp_2::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S13_Cdp_2 = //State's vectored into symbol: "Re" +{13 +,0,0,0,0,0,(Reduce_tbl*)&S13rt_Cdp_2,0,0,0}; diff --git a/web/yacco2/grammar-testsuite/km_1.cpp b/web/yacco2/grammar-testsuite/km_1.cpp new file mode 100644 index 0000000000..50fbd82e99 --- /dev/null +++ b/web/yacco2/grammar-testsuite/km_1.cpp @@ -0,0 +1,77 @@ +/* + File: km_1.cpp + Date and Time: Sat Jan 31 11:58:40 2015 +*/ +#include "km_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_km_1;// grammar's ns +// first set terminals +fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ + no_rules_entries_ = 4; + per_rule_s_table_[0] = new Per_rule_s_reuse_table(); + per_rule_s_table_[1] = new Per_rule_s_reuse_table(); + per_rule_s_table_[2] = new Per_rule_s_reuse_table(); + per_rule_s_table_[3] = new Per_rule_s_reuse_table(); +} + Ckm_1:: + Ckm_1() + :yacco2::CAbs_fsm + ("km_1.lex" + ,"1.0" + ,"7 mar 2014" + ,false + ,"Test out LALR(1) resolution." + ,"Sat Jan 31 11:58:40 2015 " + ,S1_Ckm_1){ + + } + +Ckm_1::~Ckm_1(){ + + for(int x = 0;x < 4;++x){ + ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; + } +} + + bool Ckm_1::failed(){ + return false; + } + void Ckm_1::op(){ +} +int Ckm_1::rhs_to_rules_mapping_[10] = { + -1 + ,0 // subrule 1 for rule 1 + ,1 // subrule 2 for rule 2 + ,1 // subrule 3 for rule 2 + ,1 // subrule 4 for rule 2 + ,1 // subrule 5 for rule 2 + ,2 // subrule 6 for rule 3 + ,2 // subrule 7 for rule 3 + ,3 // subrule 8 for rule 4 + ,3 // subrule 9 for rule 4 +}; +Rs::Rs(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs",0,Ckm_1::R_Rs_,P,false,false){ +} + +Re::Re(yacco2::Parser* P) + :CAbs_lr1_sym + ("Re",0,Ckm_1::R_Re_,P,false,false){ +} + +Ra::Ra(yacco2::Parser* P) + :CAbs_lr1_sym + ("Ra",0,Ckm_1::R_Ra_,P,false,false){ +} + +Rb::Rb(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rb",0,Ckm_1::R_Rb_,P,false,false){ +} + diff --git a/web/yacco2/grammar-testsuite/km_1.fsc b/web/yacco2/grammar-testsuite/km_1.fsc new file mode 100644 index 0000000000..84a27edc74 --- /dev/null +++ b/web/yacco2/grammar-testsuite/km_1.fsc @@ -0,0 +1,21 @@ +/* + File: km_1.fsc + Date and Time: Sat Jan 31 11:58:40 2015 +*/ +transitive n +grammar-name "km_1" +name-space "NS_km_1" +thread-name "Ckm_1" +monolithic y +file-name "km_1.fsc" +no-of-T 569 +list-of-native-first-set-terminals 2 + raw_u + raw_x +end-list-of-native-first-set-terminals +list-of-transitive-threads 0 +end-list-of-transitive-threads +list-of-used-threads 0 +end-list-of-used-threads +fsm-comments +"Test out LALR(1) resolution." diff --git a/web/yacco2/grammar-testsuite/km_1.h b/web/yacco2/grammar-testsuite/km_1.h new file mode 100644 index 0000000000..fd36dd78b8 --- /dev/null +++ b/web/yacco2/grammar-testsuite/km_1.h @@ -0,0 +1,78 @@ +/* + File: km_1.h + Date and Time: Sat Jan 31 11:58:40 2015 +*/ +#ifndef __km_1_h__ +#define __km_1_h__ 1 +#include "yacco2.h" +#include "yacco2_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "yacco2_err_symbols.h" +#include "yacco2_terminals.h" +#include "yacco2_characters.h" +// monolithic grammar: no thread +extern yacco2::State S1_Ckm_1; +namespace NS_km_1 { +using namespace NS_yacco2_T_enum;// enumerate +using namespace yacco2; +struct fsm_rules_reuse_table_type{ + fsm_rules_reuse_table_type(); + int no_rules_entries_; + Per_rule_s_reuse_table* per_rule_s_table_[4]; +}; +class Ckm_1: public yacco2::CAbs_fsm { + public: + enum rules_and_subrules{ + start_of_rule_list = NS_yacco2_T_enum::T_Enum::sum_total_T + ,R_Rs_ = 569//start_of_rule_list + 0 + ,rhs1_Rs_ = 1 + ,R_Re_ = 570//start_of_rule_list + 2 + ,rhs1_Re_ = 2 + ,rhs2_Re_ = 3 + ,rhs3_Re_ = 4 + ,rhs4_Re_ = 5 + ,R_Ra_ = 571//start_of_rule_list + 4 + ,rhs1_Ra_ = 6 + ,rhs2_Ra_ = 7 + ,R_Rb_ = 572//start_of_rule_list + 6 + ,rhs1_Rb_ = 8 + ,rhs2_Rb_ = 9 + }; + //no of la sets = 4 + //no of states = 24 + Ckm_1(); + ~Ckm_1(); + void op(); + bool failed(); + void reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule); + fsm_rules_reuse_table_type fsm_rules_reuse_table; + static int rhs_to_rules_mapping_[10]; + }; +struct Rs; +struct Re; +struct Ra; +struct Rb; +struct Rs:public yacco2::CAbs_lr1_sym { + Rs(yacco2::Parser* P); + public: +}; + +struct Re:public yacco2::CAbs_lr1_sym { + Re(yacco2::Parser* P); + public: +}; + +struct Ra:public yacco2::CAbs_lr1_sym { + Ra(yacco2::Parser* P); + public: +}; + +struct Rb:public yacco2::CAbs_lr1_sym { + Rb(yacco2::Parser* P); + public: +}; + +} // end of namespace + +#endif diff --git a/web/yacco2/grammar-testsuite/km_1.lex b/web/yacco2/grammar-testsuite/km_1.lex new file mode 100644 index 0000000000..90b1adaad1 --- /dev/null +++ b/web/yacco2/grammar-testsuite/km_1.lex @@ -0,0 +1,41 @@ +/* +Author: Dave Bone +FILE: km_1.lex +Date: 7 mar 2014 +Purpose: Test out compiler/compiler with Kristensen and Madsen grammar - lalr resolution +*/ +/@ +@** Kristensen and Madsen Grammar.\fbreak +Bent Bruun Kristensen and Ole Lehrmann Madsen\fbreak +Correspondence ACM Sigplan Notices, 19(8), August 1984.\fbreak +Test out LALR(1) resolution. +@/ +fsm +(fsm-id "km_1.lex",fsm-filename km_1,fsm-namespace NS_km_1 +,fsm-class Ckm_1 +,fsm-version "1.0",fsm-date "7 mar 2014",fsm-debug "false" +,fsm-comments "Test out LALR(1) resolution.") +@"/usr/local/yacco2/compiler/grammars/yacco2_T_includes.T" + +rules{ +Rs(){ + -> Re eog +} + +Re(){ + -> Ra a + -> Rb b + -> u Ra b + -> u Rb a +} + +Ra(){ + -> x y z Ra + -> x q +} + +Rb(){ + -> x y z Rb + -> x q +} +} diff --git a/web/yacco2/grammar-testsuite/km_1.pdf b/web/yacco2/grammar-testsuite/km_1.pdf Binary files differnew file mode 100644 index 0000000000..5ed512c345 --- /dev/null +++ b/web/yacco2/grammar-testsuite/km_1.pdf diff --git a/web/yacco2/grammar-testsuite/km_1_idx.pdf b/web/yacco2/grammar-testsuite/km_1_idx.pdf Binary files differnew file mode 100644 index 0000000000..ca086528bf --- /dev/null +++ b/web/yacco2/grammar-testsuite/km_1_idx.pdf diff --git a/web/yacco2/grammar-testsuite/km_1sym.cpp b/web/yacco2/grammar-testsuite/km_1sym.cpp new file mode 100644 index 0000000000..df1797cb12 --- /dev/null +++ b/web/yacco2/grammar-testsuite/km_1sym.cpp @@ -0,0 +1,153 @@ +/* + File: km_1sym.cpp + Date and Time: Sat Jan 31 11:58:40 2015 +*/ +#include "km_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_km_1;// grammar's ns +// first set terminals +// monolithic grammar --- no thread +void +Ckm_1::reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule){ + int reducing_rule = rhs_to_rules_mapping_[Sub_rule_no]; + Per_rule_s_reuse_table* rule_reuse_tbl_ptr = + fsm_rules_reuse_table.per_rule_s_table_[reducing_rule]; + Rule_s_reuse_entry* re(0); + find_a_recycled_rule(rule_reuse_tbl_ptr,&re); + (*Recycled_rule) = re; + fnd_re: switch (Sub_rule_no){ + case rhs1_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs2_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs3_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs4_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs1_Ra_:{ + Ra* sym; + if(re->rule_ == 0){ + sym = new Ra(parser__); + re->rule_ = sym; + }else{ + sym = (Ra*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 4; + + + return;} + case rhs2_Ra_:{ + Ra* sym; + if(re->rule_ == 0){ + sym = new Ra(parser__); + re->rule_ = sym; + }else{ + sym = (Ra*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Rb_:{ + Rb* sym; + if(re->rule_ == 0){ + sym = new Rb(parser__); + re->rule_ = sym; + }else{ + sym = (Rb*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 4; + + + return;} + case rhs2_Rb_:{ + Rb* sym; + if(re->rule_ == 0){ + sym = new Rb(parser__); + re->rule_ = sym; + }else{ + sym = (Rb*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + default: return; + } +} diff --git a/web/yacco2/grammar-testsuite/km_1tbl.cpp b/web/yacco2/grammar-testsuite/km_1tbl.cpp new file mode 100644 index 0000000000..ab30486d11 --- /dev/null +++ b/web/yacco2/grammar-testsuite/km_1tbl.cpp @@ -0,0 +1,408 @@ +/* + File: km_1tbl.cpp + Date and Time: Sat Jan 31 11:58:40 2015 +*/ +#include "km_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_km_1;// grammar's ns +// first set terminals +// LR1_eog +yacco2::UCHAR LA1_Ckm_1[] ={ +1 +,0,2 +}; +// raw_a +yacco2::UCHAR LA2_Ckm_1[] ={ +1 +,13,2 +}; +// raw_b +yacco2::UCHAR LA3_Ckm_1[] ={ +1 +,13,4 +}; +// LR1_eolr +yacco2::UCHAR LA4_Ckm_1[] ={ +1 +,0,4 +}; +extern yacco2::State S1_Ckm_1; +extern yacco2::State S2_Ckm_1; +extern yacco2::State S3_Ckm_1; +extern yacco2::State S4_Ckm_1; +extern yacco2::State S5_Ckm_1; +extern yacco2::State S6_Ckm_1; +extern yacco2::State S7_Ckm_1; +extern yacco2::State S8_Ckm_1; +extern yacco2::State S9_Ckm_1; +extern yacco2::State S10_Ckm_1; +extern yacco2::State S11_Ckm_1; +extern yacco2::State S12_Ckm_1; +extern yacco2::State S13_Ckm_1; +extern yacco2::State S14_Ckm_1; +extern yacco2::State S15_Ckm_1; +extern yacco2::State S16_Ckm_1; +extern yacco2::State S17_Ckm_1; +extern yacco2::State S18_Ckm_1; +extern yacco2::State S19_Ckm_1; +extern yacco2::State S20_Ckm_1; +extern yacco2::State S21_Ckm_1; +extern yacco2::State S22_Ckm_1; +extern yacco2::State S23_Ckm_1; +extern yacco2::State S24_Ckm_1; +struct S1std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[6]; +}; +S1std_Ckm_1 S1st_Ckm_1 = { + 6 + , + {// start of table + {125,(State*)&S2_Ckm_1} // shift sym: raw_u + ,{128,(State*)&S7_Ckm_1} // shift sym: raw_x + ,{569,(State*)&S1_Ckm_1} // accept sym: Rs + ,{570,(State*)&S13_Ckm_1} // shift sym: Re + ,{571,(State*)&S15_Ckm_1} // shift sym: Ra + ,{572,(State*)&S17_Ckm_1} // shift sym: Rb + }// end of shift table +}; +yacco2::State S1_Ckm_1 = //State's vectored into symbol: " No symbol" +{1 +,0,0,0,0,(Shift_tbl*)&S1st_Ckm_1,0,0,0,0}; +struct S2std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S2std_Ckm_1 S2st_Ckm_1 = { + 3 + , + {// start of table + {128,(State*)&S19_Ckm_1} // shift sym: raw_x + ,{571,(State*)&S3_Ckm_1} // shift sym: Ra + ,{572,(State*)&S5_Ckm_1} // shift sym: Rb + }// end of shift table +}; +yacco2::State S2_Ckm_1 = //State's vectored into symbol: "u" +{2 +,0,0,0,0,(Shift_tbl*)&S2st_Ckm_1,0,0,0,0}; +struct S3std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S3std_Ckm_1 S3st_Ckm_1 = { + 1 + , + {// start of table + {106,(State*)&S4_Ckm_1} // shift sym: raw_b + }// end of shift table +}; +yacco2::State S3_Ckm_1 = //State's vectored into symbol: "Ra" +{3 +,0,0,0,0,(Shift_tbl*)&S3st_Ckm_1,0,0,0,0}; +struct S4rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S4rtd_Ckm_1 S4rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Ckm_1,Ckm_1::rhs3_Re_} + }// end of reduce table +}; +yacco2::State S4_Ckm_1 = //State's vectored into symbol: "b" +{4 +,0,0,0,0,0,(Reduce_tbl*)&S4rt_Ckm_1,0,0,0}; +struct S5std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S5std_Ckm_1 S5st_Ckm_1 = { + 1 + , + {// start of table + {105,(State*)&S6_Ckm_1} // shift sym: raw_a + }// end of shift table +}; +yacco2::State S5_Ckm_1 = //State's vectored into symbol: "Rb" +{5 +,0,0,0,0,(Shift_tbl*)&S5st_Ckm_1,0,0,0,0}; +struct S6rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S6rtd_Ckm_1 S6rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Ckm_1,Ckm_1::rhs4_Re_} + }// end of reduce table +}; +yacco2::State S6_Ckm_1 = //State's vectored into symbol: "a" +{6 +,0,0,0,0,0,(Reduce_tbl*)&S6rt_Ckm_1,0,0,0}; +struct S7std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[2]; +}; +S7std_Ckm_1 S7st_Ckm_1 = { + 2 + , + {// start of table + {121,(State*)&S8_Ckm_1} // shift sym: raw_q + ,{129,(State*)&S9_Ckm_1} // shift sym: raw_y + }// end of shift table +}; +yacco2::State S7_Ckm_1 = //State's vectored into symbol: "x" +{7 +,0,0,0,0,(Shift_tbl*)&S7st_Ckm_1,0,0,0,0}; +struct S8rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[2]; +}; +S8rtd_Ckm_1 S8rt_Ckm_1 = { + 2 + , + {// start of table + {(Set_tbl*)&LA2_Ckm_1,Ckm_1::rhs2_Ra_} + ,{(Set_tbl*)&LA3_Ckm_1,Ckm_1::rhs2_Rb_} + }// end of reduce table +}; +yacco2::State S8_Ckm_1 = //State's vectored into symbol: "q" +{8 +,0,0,0,0,0,(Reduce_tbl*)&S8rt_Ckm_1,0,0,0}; +struct S9std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S9std_Ckm_1 S9st_Ckm_1 = { + 1 + , + {// start of table + {130,(State*)&S10_Ckm_1} // shift sym: raw_z + }// end of shift table +}; +yacco2::State S9_Ckm_1 = //State's vectored into symbol: "y" +{9 +,0,0,0,0,(Shift_tbl*)&S9st_Ckm_1,0,0,0,0}; +struct S10std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S10std_Ckm_1 S10st_Ckm_1 = { + 3 + , + {// start of table + {128,(State*)&S7_Ckm_1} // shift sym: raw_x + ,{571,(State*)&S11_Ckm_1} // shift sym: Ra + ,{572,(State*)&S12_Ckm_1} // shift sym: Rb + }// end of shift table +}; +yacco2::State S10_Ckm_1 = //State's vectored into symbol: "z" +{10 +,0,0,0,0,(Shift_tbl*)&S10st_Ckm_1,0,0,0,0}; +struct S11rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S11rtd_Ckm_1 S11rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Ckm_1,Ckm_1::rhs1_Ra_} + }// end of reduce table +}; +yacco2::State S11_Ckm_1 = //State's vectored into symbol: "Ra" +{11 +,0,0,0,0,0,(Reduce_tbl*)&S11rt_Ckm_1,0,0,0}; +struct S12rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S12rtd_Ckm_1 S12rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Ckm_1,Ckm_1::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S12_Ckm_1 = //State's vectored into symbol: "Rb" +{12 +,0,0,0,0,0,(Reduce_tbl*)&S12rt_Ckm_1,0,0,0}; +struct S13std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S13std_Ckm_1 S13st_Ckm_1 = { + 1 + , + {// start of table + {1,(State*)&S14_Ckm_1} // shift sym: LR1_eog + }// end of shift table +}; +yacco2::State S13_Ckm_1 = //State's vectored into symbol: "Re" +{13 +,0,0,0,0,(Shift_tbl*)&S13st_Ckm_1,0,0,0,0}; +struct S14rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S14rtd_Ckm_1 S14rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Ckm_1,Ckm_1::rhs1_Rs_} + }// end of reduce table +}; +yacco2::State S14_Ckm_1 = //State's vectored into symbol: "eog" +{14 +,0,0,0,0,0,(Reduce_tbl*)&S14rt_Ckm_1,0,0,0}; +struct S15std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S15std_Ckm_1 S15st_Ckm_1 = { + 1 + , + {// start of table + {105,(State*)&S16_Ckm_1} // shift sym: raw_a + }// end of shift table +}; +yacco2::State S15_Ckm_1 = //State's vectored into symbol: "Ra" +{15 +,0,0,0,0,(Shift_tbl*)&S15st_Ckm_1,0,0,0,0}; +struct S16rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S16rtd_Ckm_1 S16rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Ckm_1,Ckm_1::rhs1_Re_} + }// end of reduce table +}; +yacco2::State S16_Ckm_1 = //State's vectored into symbol: "a" +{16 +,0,0,0,0,0,(Reduce_tbl*)&S16rt_Ckm_1,0,0,0}; +struct S17std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S17std_Ckm_1 S17st_Ckm_1 = { + 1 + , + {// start of table + {106,(State*)&S18_Ckm_1} // shift sym: raw_b + }// end of shift table +}; +yacco2::State S17_Ckm_1 = //State's vectored into symbol: "Rb" +{17 +,0,0,0,0,(Shift_tbl*)&S17st_Ckm_1,0,0,0,0}; +struct S18rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S18rtd_Ckm_1 S18rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Ckm_1,Ckm_1::rhs2_Re_} + }// end of reduce table +}; +yacco2::State S18_Ckm_1 = //State's vectored into symbol: "b" +{18 +,0,0,0,0,0,(Reduce_tbl*)&S18rt_Ckm_1,0,0,0}; +struct S19std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[2]; +}; +S19std_Ckm_1 S19st_Ckm_1 = { + 2 + , + {// start of table + {121,(State*)&S20_Ckm_1} // shift sym: raw_q + ,{129,(State*)&S21_Ckm_1} // shift sym: raw_y + }// end of shift table +}; +yacco2::State S19_Ckm_1 = //State's vectored into symbol: "x" +{19 +,0,0,0,0,(Shift_tbl*)&S19st_Ckm_1,0,0,0,0}; +struct S20rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[2]; +}; +S20rtd_Ckm_1 S20rt_Ckm_1 = { + 2 + , + {// start of table + {(Set_tbl*)&LA3_Ckm_1,Ckm_1::rhs2_Ra_} + ,{(Set_tbl*)&LA2_Ckm_1,Ckm_1::rhs2_Rb_} + }// end of reduce table +}; +yacco2::State S20_Ckm_1 = //State's vectored into symbol: "q" +{20 +,0,0,0,0,0,(Reduce_tbl*)&S20rt_Ckm_1,0,0,0}; +struct S21std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S21std_Ckm_1 S21st_Ckm_1 = { + 1 + , + {// start of table + {130,(State*)&S22_Ckm_1} // shift sym: raw_z + }// end of shift table +}; +yacco2::State S21_Ckm_1 = //State's vectored into symbol: "y" +{21 +,0,0,0,0,(Shift_tbl*)&S21st_Ckm_1,0,0,0,0}; +struct S22std_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S22std_Ckm_1 S22st_Ckm_1 = { + 3 + , + {// start of table + {128,(State*)&S19_Ckm_1} // shift sym: raw_x + ,{571,(State*)&S23_Ckm_1} // shift sym: Ra + ,{572,(State*)&S24_Ckm_1} // shift sym: Rb + }// end of shift table +}; +yacco2::State S22_Ckm_1 = //State's vectored into symbol: "z" +{22 +,0,0,0,0,(Shift_tbl*)&S22st_Ckm_1,0,0,0,0}; +struct S23rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S23rtd_Ckm_1 S23rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Ckm_1,Ckm_1::rhs1_Ra_} + }// end of reduce table +}; +yacco2::State S23_Ckm_1 = //State's vectored into symbol: "Ra" +{23 +,0,0,0,0,0,(Reduce_tbl*)&S23rt_Ckm_1,0,0,0}; +struct S24rtd_Ckm_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S24rtd_Ckm_1 S24rt_Ckm_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Ckm_1,Ckm_1::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S24_Ckm_1 = //State's vectored into symbol: "Rb" +{24 +,0,0,0,0,0,(Reduce_tbl*)&S24rt_Ckm_1,0,0,0}; diff --git a/web/yacco2/grammar-testsuite/makefile_testout_APPLE b/web/yacco2/grammar-testsuite/makefile_testout_APPLE new file mode 100644 index 0000000000..d7195ddf23 --- /dev/null +++ b/web/yacco2/grammar-testsuite/makefile_testout_APPLE @@ -0,0 +1,100 @@ +# File: makefile_testout_APPLE +# Why: Creates the testout using the GNU make program +# Ks: Depending on your system, this utility might be called gmake or make +# +# testout placement: +# Rlse: /usr/local/yacco2/grammar-testsuite +# +# How to run: U must choose the label to execute: Rlse, Dbg, or Genw +# Rlse --- gen the optimized version of testout with no debug support +# Dbg --- gen the debug version of O2 +# Genw --- gen the pdf document and the cpp code +# from cweb see www.tug.org for details on obtaining code +# for the literate programming environment aka CWEB +# and please join Tug. It is a marvelous FOSS +# Note: U do not need to use Genw as *.cpp and pdf +# document are included in the ``yacco2'' package +# +# Make sure that the pager_1.lex and testout_err_hdlr.lex grammars has been gened: +# o2 pager_1.lex +# o2 testout_err_hdlr.lex +# +# Create the bitmaps for testout +# o2linker testout.fsc +# +# ---> Know where the stdc++ library resides and adjust the STDCC_dir variable +# +# Example: gen the compiler/compiler o2 release version using GNU make +# cd /usr/local/yacco2/grammar-testsuite +# make Rlse -f makefile_testout_APPLE +# +# Example: gen programs from cweb +# make Genw -f makefile_testout_APPLE +# +echo "=======> Build testout compiler using pager_1.lex grammar" +O2 := /usr/local/yacco2 +##CC := /opt/local/bin/c++-mp-4.9 +CC := clang++#g++ +##LD := /opt/local/bin/ld +LD := ld #apple linker + +02_target_dir := +ifeq ($(MAKECMDGOALS),Rlse) +Prg := testout +O2_target_dir := Release +Compile_opts := -c -pthread -arch x86_64 #-frepo -fno-implicit-templates -fno-rtti +else +O2_target_dir := Debug +Prg := testout_debug +Compile_opts := -c -g -pthread -arch x86_64 +endif + +### +# Set up directories +### +Base_o2 := $(O2) +O2_library := $(Base_o2)/library +O2_externs := $(Base_o2)/compiler/o2 +O2_grammars := $(Base_o2)/compiler/grammars +O2_library_grm := $(Base_o2)/library/grammars +O2_library_lib := $(O2_library)/lib/Release +Testout := $(Base_o2)/grammar-testsuite +Testout_includes := -I'$(Testout)' -I'$(O2_externs)' -I'$(O2_grammars)' -I'$(O2_library)' -I'$(O2_library_grm)' +Testout_req_libraries := -lyacco2 +Testout_lib_directories := -L$(O2_library_lib) +CC_lib := c++ +LD_PARMS := -arch x86_64 -macosx_version_min 10.9 #-stack_size 0x2000000 -no_compact_unwind + +#STDCC_dir := -L/usr/llvm-gcc-4.2/lib/gcc/i686-apple-darwin11/4.2.1/ +STDCC_dir := -L/usr/lib/ + +### +# Compile, link, and move O2 into bin account +### +Rlse: YYY + +YYY: + $(CC) -v $(Compile_opts) $(Testout_includes) $(Prg).cpp -o $(Prg).o + $(CC) -v $(Compile_opts) $(Testout_includes) testout_err_hdlr.cpp -o testout_err_hdlr.o + $(CC) -v $(Compile_opts) $(Testout_includes) testout_err_hdlrsym.cpp -o testout_err_hdlrsym.o + $(CC) -v $(Compile_opts) $(Testout_includes) testout_err_hdlrtbl.cpp -o testout_err_hdlrtbl.o + $(CC) -v $(Compile_opts) $(Testout_includes) pager_1.cpp -o pager_1.o + $(CC) -v $(Compile_opts) $(Testout_includes) pager_1sym.cpp -o pager_1sym.o + $(CC) -v $(Compile_opts) $(Testout_includes) pager_1tbl.cpp -o pager_1tbl.o + $(CC) -v $(Compile_opts) $(Testout_includes) testout_err_symbols.cpp -o testout_err_symbols.o + $(CC) -v $(Compile_opts) $(Testout_includes) testout_terminals.cpp -o testout_terminals.o + $(CC) -v $(Compile_opts) $(Testout_includes) testout_fsc.cpp -o testout_fsc.o + $(LD) $(LD_PARMS) -o $(Prg) $(STDCC_dir) $(Testout_lib_directories) $(Testout_req_libraries) -l$(CC_lib) -lpthread testout_err_symbols.o testout_terminals.o testout_err_hdlr.o testout_err_hdlrsym.o testout_err_hdlrtbl.o pager_1.o pager_1sym.o pager_1tbl.o testout_fsc.o $(Prg).o + rm *o + +Genw: + cweave testout + pdftex testout + mv testout\.pdf /usr/local/yacco2/docs/ + ctangle -l +e testout + rm testout.idx + rm testout.scn + rm testout.toc + rm testout.tex + rm testout.log + rm testout.c diff --git a/web/yacco2/grammar-testsuite/makefile_testout_GNU b/web/yacco2/grammar-testsuite/makefile_testout_GNU new file mode 100644 index 0000000000..52a7367327 --- /dev/null +++ b/web/yacco2/grammar-testsuite/makefile_testout_GNU @@ -0,0 +1,90 @@ +# File: makefile_GNU +# Why: Creates the o2 compiler /compiler using the GNU make program +# Ks: Depending on your system, this utility might be called gmake or make +# +# O2 placement: +# Rlse: /usr/local/yacco2/bin/o2 +# Dbg: /usr/local/yacco2/bin/o2_dbg +# Genw: for the pdf file: yacco2/docs +# for the *.cpp files +# +# How to run: U must choose the label to execute: Rlse, Dbg, or Genw +# Rlse --- gen the optimizwd version of O2 with no debug support +# Dbg --- gen the debug version of O2 +# Genw --- gen the pdf document and the cpp code +# from cweb see www.tug.org for details on obtaining code +# for the literate programming environment aka CWEB +# and please join Tug. It is a marvalous FOSS +# Note: U do not need to use Genw as *.cpp and pdf +# document are included in the ``yacco2'' package +# +# Example: gen the debug version of the library using GNU make = gmake +# cd /usr/local/yacco2/compiler/o2 +# make Rlse -f GNU_makefile +# +O2 := /usr/local/yacco2 + +CC := g++ + +02_target_dir := +ifeq ($(MAKECMDGOALS),Rlse) +O2_target_dir := Release +else +O2_target_dir := Debug +endif + +### +# Set up directories +### +Base_yacco2 := $(O2) +O2_bin := $(Base_yacco2)/bin +O2_eternals := $(Base_yacco2)/externals +O2_docs := $(Base_yacco2)/docs +O2_lib := $(Base_yacco2)/library +O2_lib_grms := $(Base_yacco2)/library/grammars +O2_cc_grms := $(Base_yacco2)/compiler/grammars +O2_cc := $(Base_yacco2)/compiler/o2 +O2_includes := -I'$(O2_cc)' -I'$(O2_cc_grms)' -I'$(O2_lib)' -I'$(O2_lib_grms)' +O2_req_libraries := -lyacco2 -lo2grammars +O2_lib_directories := -L$(O2_cc_grms)/lib/$(O2_target_dir) -L$(O2_lib)/lib/$(O2_target_dir) + +### +# Set up c++ compiler and ld linker options +### + +Rlse: Compile_opts := -c -O3 -pthread #-frepo -fno-implicit-templates -fno-rtti +Dbg: Compile_opts := -c -g -pthread -arch x86_64 +Link_opts := -Wl,-z -Wl,muldefs -Wl,-Ur #$(O2_lib_directories) +Multi_rd_libs := -static-libgcc -Wl,--start-group -lyacco2 -lo2grammars -Wl,--end-group -lpthread + +### +# Compile, link, and move O2 into bin account +### +Rlse: YYY Move_rlse_o2 +Dbg: YYY Move_dbg_o2 +YYY: + $(CC) -v $(Compile_opts) o2.cpp -o o2.o $(O2_includes) + $(CC) -v $(Compile_opts) common_externs.cpp -o common_externs.o $(O2_includes) + $(CC) -v $(Compile_opts) o2_externs.cpp -o o2_externs.o $(O2_includes) + $(CC) -v $(Compile_opts) o2_defs.cpp -o o2_defs.o $(O2_includes) + ld '-o' 'o2' '-shared-libgcc' '-mtune=generic'\ + --eh-frame-hdr -m elf_i386 --hash-style=both -dynamic-linker\ + /lib/ld-linux.so.2 -o o2 -z relro /usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crt1.o\ + /usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crti.o /usr/lib/gcc/i486-linux-gnu/4.3.2/crtbegin.o\ + -L/usr/lib/gcc/i486-linux-gnu/4.3.2 -L/usr/lib/gcc/i486-linux-gnu/4.3.2\ + -L/usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib -L/lib/../lib -L/usr/lib/../lib\ + -L/usr/lib/gcc/i486-linux-gnu/4.3.2/../../..\ + $(O2_lib_directories) o2_externs.o o2_defs.o common_externs.o o2.o\ + --whole-archive -lyacco2 --no-whole-archive -start-group -lo2grammars --end-group -lstdc++ -lm -lgcc_s -lgcc -lc -lgcc_s -lgcc\ + -lpthread /usr/lib/gcc/i486-linux-gnu/4.3.2/crtend.o\ + /usr/lib/gcc/i486-linux-gnu/4.3.2/../../../../lib/crtn.o + +Move_rlse_o2: + mv o2 $(O2_bin) + rm *.o +Move_dbg_o2: + mv o2 o2_dbg + mv o2_dbg $(O2_bin) + rm o2 + rm *.o + diff --git a/web/yacco2/grammar-testsuite/makefile_testout_SOLARIS b/web/yacco2/grammar-testsuite/makefile_testout_SOLARIS new file mode 100644 index 0000000000..6079a234e2 --- /dev/null +++ b/web/yacco2/grammar-testsuite/makefile_testout_SOLARIS @@ -0,0 +1,125 @@ +# File: makefile_SOLARIS +# Why: Creates the o2 compiler /compiler +# Library placement: +# Rlse: /usr/local/yacco2/bin/o2 +# Dbg: /usr/local/yacco2/bin/o2_debug +# Genw: for the pdf file: yacco2/docs +# for the *.cpp files +# +# How to run: U must choose the label to execute: Rlse, Dbg +# Rlse --- gen the fast version of library with no debug support +# Dbg --- gen the debug version of library +# Genw --- gen the pdf document and the cpp code +# from cweb see www.tug.org for details on obtaining code +# for the literate programming environment aka CWEB +# and please join Tug. It is a marvalous FOSS +# Note: U do not need to use Genw as *.cpp and pdf +# document are included in the ``yacco2'' package +# Notice: Some possible construction to be done +# 1) Adjust base_dir variable if the ``yacco2'' package is moved elsewhere. +# For example, if u installed the ``yacco2'' package in /opt/yacco2 +# Set the base_dir variable in this file to: base_dir = /opt/ +# The trailing / must be there or ugly things will happen. +# +# Example: gen the debug version of the library +# cd /usr/local/yacco2/compiler/o2 +# make Dbg -f Solaris_makefile +# +O2 := /usr/local/yacco2 + +Rlse: BASICOPTS := -fast -c -m64 -lpthread +Rlse: Bld_BASICOPTS := -m64 -lpthread + +Dbg: BASICOPTS := -c -m64 -lpthread -xs -g +Dbg: Bld_BASICOPTS := -m64 -lpthread -xs -g + +o2_lib := $(O2)/library/ +o2_stbl := $(O2)/compiler/stbl/ +o2_docs := $(O2)/docs/ +o2_lib_grms := $(O2)/library/grammars/ +o2_grms := $(O2)/compiler/grammars/ +o2 := $(O2)/compiler/o2/ + + +O2_includes := -I'$(o2)' -I'$(o2_grms)' -I'$(o2_lib)' -I'$(o2_lib_grms)' +o2_req_libraries := -lyacco2 -lo2grammars +Rlse: o2_lib_directories := -L $(o2_grms)lib/Release/ -L $(o2_lib)lib/Release/ +Dbg: o2_lib_directories := -L $(o2_grms)lib/Debug/ -L $(o2_lib)lib/Debug/ +files_to_cc := \ +o2_defs.cpp \ +common_externs.cpp \ +o2_externs.cpp \ +o2.cpp +files_to_o := $(files_to_cc:.cpp=.o) + +Rlse: Compile Rlse_o2 +Rlse_o2: + mv o2prg $(base_dir)yacco2/bin/o2 + rm -f *.o + +Dbg: $(files_to_o) Dbg_o2 +Dbg_o2: + mv o2prg $(base_dir)yacco2/bin/o2_debug + rm -f *.o + +Compile: $(files_to_o) +common_externs.o: common_externs.cpp + CC $(BASICOPTS) $(O2_includes) common_externs.cpp -o $@ +o2_externs.o: o2_externs.cpp + CC $(BASICOPTS) $(O2_includes) o2_externs.cpp -o $@ +o2_defs.o: o2_defs.cpp + CC $(BASICOPTS) $(O2_includes) o2_defs.cpp -o $@ +o2.o: o2.cpp + CC $(Bld_BASICOPTS) $(O2_includes) o2.cpp -o o2prg \ +o2_defs.o common_externs.o o2_externs.o \ +$(o2_lib_directories) $(o2_req_libraries) +Genw: + cweave types.w + ctangle -l +e types.w + pdftex types + pdftops types.pdf + mv types.pdf $(o2_docs) + mv types.ps $(o2_docs) + cweave common_externs.w + ctangle -l +e common_externs.w + pdftex common_externs + pdftops common_externs.pdf + mv common_externs.pdf $(o2_docs) + mv common_externs.ps $(o2_docs) + cweave o2externs.w + ctangle -l +e o2externs.w + pdftex o2externs + pdftops o2externs.pdf + mv o2externs.pdf $(o2_docs) + mv o2externs.ps $(o2_docs) + cweave o2.w + ctangle -l +e o2.w + sh Makefile_Edit_cweb + pdftex o2 + pdftops o2.pdf + mv o2.pdf $(o2_docs) + mv o2.ps $(o2_docs) + rm types.idx + rm types.scn + rm types.toc + rm types.tex + rm types.log + rm types.c + rm common_externs.idx + rm common_externs.scn + rm common_externs.toc + rm common_externs.tex + rm common_externs.log + rm common_externs.c + rm o2externs.idx + rm o2externs.scn + rm o2externs.toc + rm o2externs.tex + rm o2externs.log + rm o2externs.c + rm o2.idx + rm o2.scn + rm o2.toc + rm o2.tex + rm o2.log + rm o2.c diff --git a/web/yacco2/grammar-testsuite/pager_1.cpp b/web/yacco2/grammar-testsuite/pager_1.cpp new file mode 100644 index 0000000000..96043481cf --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1.cpp @@ -0,0 +1,82 @@ +/* + File: pager_1.cpp + Date and Time: Sat Jan 31 11:58:44 2015 +*/ +#include "pager_1.h" +using namespace NS_testout_T_enum;// enumerate +using namespace NS_testout_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_testout_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_pager_1;// grammar's ns +// first set terminals +fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ + no_rules_entries_ = 4; + per_rule_s_table_[0] = new Per_rule_s_reuse_table(); + per_rule_s_table_[1] = new Per_rule_s_reuse_table(); + per_rule_s_table_[2] = new Per_rule_s_reuse_table(); + per_rule_s_table_[3] = new Per_rule_s_reuse_table(); +} + Cpager_1:: + Cpager_1() + :yacco2::CAbs_fsm + ("pager_1.lex" + ,"1.0" + ,"7 mar 2014" + ,true + ,"Test out David Pager LR(1) resolution page 61." + ,"Sat Jan 31 11:58:44 2015 " + ,S1_Cpager_1){ + + } + +Cpager_1::~Cpager_1(){ + + for(int x = 0;x < 4;++x){ + ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; + } +} + + bool Cpager_1::failed(){ + + CAbs_lr1_sym* sym = new Err_bad_T_inputted; + sym->set_rc(*parser__->current_token__,__FILE__,__LINE__); + ADD_TOKEN_TO_ERROR_QUEUE_FSM(*sym); + return true; + + } + void Cpager_1::op(){ +} +int Cpager_1::rhs_to_rules_mapping_[10] = { + -1 + ,0 // subrule 1 for rule 1 + ,1 // subrule 2 for rule 2 + ,1 // subrule 3 for rule 2 + ,1 // subrule 4 for rule 2 + ,1 // subrule 5 for rule 2 + ,2 // subrule 6 for rule 3 + ,2 // subrule 7 for rule 3 + ,3 // subrule 8 for rule 4 + ,3 // subrule 9 for rule 4 +}; +Rs::Rs(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs",0,Cpager_1::R_Rs_,P,false,false){ +} + +Re::Re(yacco2::Parser* P) + :CAbs_lr1_sym + ("Re",0,Cpager_1::R_Re_,P,false,false){ +} + +Rx::Rx(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rx",0,Cpager_1::R_Rx_,P,false,false){ +} + +Ry::Ry(yacco2::Parser* P) + :CAbs_lr1_sym + ("Ry",0,Cpager_1::R_Ry_,P,false,false){ +} + diff --git a/web/yacco2/grammar-testsuite/pager_1.fsc b/web/yacco2/grammar-testsuite/pager_1.fsc new file mode 100644 index 0000000000..fd970058b8 --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1.fsc @@ -0,0 +1,21 @@ +/* + File: pager_1.fsc + Date and Time: Sat Jan 31 11:58:44 2015 +*/ +transitive n +grammar-name "pager_1" +name-space "NS_pager_1" +thread-name "Cpager_1" +monolithic y +file-name "pager_1.fsc" +no-of-T 269 +list-of-native-first-set-terminals 2 + raw_a + raw_b +end-list-of-native-first-set-terminals +list-of-transitive-threads 0 +end-list-of-transitive-threads +list-of-used-threads 0 +end-list-of-used-threads +fsm-comments +"Test out David Pager LR(1) resolution page 61." diff --git a/web/yacco2/grammar-testsuite/pager_1.h b/web/yacco2/grammar-testsuite/pager_1.h new file mode 100644 index 0000000000..4c2221157a --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1.h @@ -0,0 +1,78 @@ +/* + File: pager_1.h + Date and Time: Sat Jan 31 11:58:44 2015 +*/ +#ifndef __pager_1_h__ +#define __pager_1_h__ 1 +#include "yacco2.h" +#include "testout_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "testout_err_symbols.h" +#include "testout_terminals.h" +#include "yacco2_characters.h" +// monolithic grammar: no thread +extern yacco2::State S1_Cpager_1; +namespace NS_pager_1 { +using namespace NS_testout_T_enum;// enumerate +using namespace yacco2; +struct fsm_rules_reuse_table_type{ + fsm_rules_reuse_table_type(); + int no_rules_entries_; + Per_rule_s_reuse_table* per_rule_s_table_[4]; +}; +class Cpager_1: public yacco2::CAbs_fsm { + public: + enum rules_and_subrules{ + start_of_rule_list = NS_testout_T_enum::T_Enum::sum_total_T + ,R_Rs_ = 269//start_of_rule_list + 0 + ,rhs1_Rs_ = 1 + ,R_Re_ = 270//start_of_rule_list + 2 + ,rhs1_Re_ = 2 + ,rhs2_Re_ = 3 + ,rhs3_Re_ = 4 + ,rhs4_Re_ = 5 + ,R_Rx_ = 271//start_of_rule_list + 4 + ,rhs1_Rx_ = 6 + ,rhs2_Rx_ = 7 + ,R_Ry_ = 272//start_of_rule_list + 6 + ,rhs1_Ry_ = 8 + ,rhs2_Ry_ = 9 + }; + //no of la sets = 4 + //no of states = 19 + Cpager_1(); + ~Cpager_1(); + void op(); + bool failed(); + void reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule); + fsm_rules_reuse_table_type fsm_rules_reuse_table; + static int rhs_to_rules_mapping_[10]; + }; +struct Rs; +struct Re; +struct Rx; +struct Ry; +struct Rs:public yacco2::CAbs_lr1_sym { + Rs(yacco2::Parser* P); + public: +}; + +struct Re:public yacco2::CAbs_lr1_sym { + Re(yacco2::Parser* P); + public: +}; + +struct Rx:public yacco2::CAbs_lr1_sym { + Rx(yacco2::Parser* P); + public: +}; + +struct Ry:public yacco2::CAbs_lr1_sym { + Ry(yacco2::Parser* P); + public: +}; + +} // end of namespace + +#endif diff --git a/web/yacco2/grammar-testsuite/pager_1.lex b/web/yacco2/grammar-testsuite/pager_1.lex new file mode 100644 index 0000000000..c0035e17b0 --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1.lex @@ -0,0 +1,65 @@ +/* +Author: Dave Bone +FILE: pager_1.lex +Date: 7 mar 2014 +Purpose: Test out David Pager lr(1) resolution page 61 +*/ +/@ +@** David Pager Grammar.\fbreak +David Pager\fbreak +The Lane Table Method Of Constructing LR(1) Parsers.\fbreak +@/ +fsm +(fsm-id "pager_1.lex",fsm-filename pager_1,fsm-namespace NS_pager_1 +,fsm-class Cpager_1{ +/@ +The |RSVP_FSM| macro is used +to pass back an error to the calling grammar +in its ``Accept queue''! +Here the error is within the monolithic grammar so place it +directly into the ``Error queue''. +Please read ``wlibrary.pdf'' or ``o2book.pdf'' on the differences between:\fbreak +|RSVP| and |RSVP_FSM| and their contextes to place a T into the ``Accept queue'' +whereas + |ADD_TOKEN_TO_ERROR_QUEUE| and |ADD_TOKEN_TO_ERROR_QUEUE_FSM| +macros +store the T into the ``Error queue''. +\fbreak +{\bf{Note}}: Reference to |current_token| +to fetch its token stream gps. +@/ + failed + CAbs_lr1_sym* sym = new Err_bad_T_inputted; + sym->set_rc(*parser__->current_token__,__FILE__,__LINE__); + ADD_TOKEN_TO_ERROR_QUEUE_FSM(*sym); + return true; +*** +} +,fsm-version "1.0",fsm-date "7 mar 2014",fsm-debug "true" +,fsm-comments "Test out David Pager LR(1) resolution page 61.") +@"/usr/local/yacco2/grammar-testsuite/testout_T_includes.T" + +rules{ + +Rs(){ + -> Re eog +} + +Re(){ + -> a Rx d + -> b Rx c + -> a Ry c + -> b Ry d +} + +Rx(){ + -> e Rx + -> e +} + +Ry(){ + -> e Ry + -> e +} + +} diff --git a/web/yacco2/grammar-testsuite/pager_1.pdf b/web/yacco2/grammar-testsuite/pager_1.pdf Binary files differnew file mode 100644 index 0000000000..c9d15347cc --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1.pdf diff --git a/web/yacco2/grammar-testsuite/pager_1.w b/web/yacco2/grammar-testsuite/pager_1.w new file mode 100644 index 0000000000..e15a6a08db --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1.w @@ -0,0 +1,687 @@ +% file: pager_1.w - cweb grammar +%Date: Sun Jun 15 15:01:27 2014 +\input "supp-pdf" +\input "/yacco2/diagrams+etc/o2mac.tex" +\GRAMMARtitle{pager\_1} +{pager\_1.lex}{NS\_pager\_1} +{1.0}{true} +{Test out David Pager LR(1) resolution page 61.} + + +@** David Pager Grammar.\fbreak +David Pager\fbreak +The Lane Table Method Of Constructing LR(1) Parsers.\fbreak + +@*2 Fsm Cpager\_1 class. + +@*3 Cpager\_1 failed directive. + +The |RSVP_FSM| macro is used +to pass back an error to the calling grammar +in its ``Accept queue''! +Here the error is within the monolithic grammar so place it +directly into the ``Error queue''. +Please read ``wlibrary.pdf'' or ``o2book.pdf'' on the differences between:\fbreak +|RSVP| and |RSVP_FSM| and their contextes to place a T into the ``Accept queue'' +whereas + |ADD_TOKEN_TO_ERROR_QUEUE| and |ADD_TOKEN_TO_ERROR_QUEUE_FSM| +macros +store the T into the ``Error queue''. +\fbreak +{\bf{Note}}: Reference to |current_token| +to fetch its token stream gps. + +@<Cpager\_1 failed directive@>= + + CAbs_lr1_sym* sym = new Err_bad_T_inputted; + sym->set_rc(*parser__->current_token__,__FILE__,__LINE__); + ADD_TOKEN_TO_ERROR_QUEUE_FSM(*sym); + return true; + +@*2 |@!Rs| rule.\fbreak +\fbreak +\convertMPtoPDF{pager_1.1}{1}{1} +@.Re@> +@.eog@> +@*2 |@!Re| rule.\fbreak +\fbreak +\convertMPtoPDF{pager_1.3}{1}{1} +@.Rx@> +@.Rx@> +@.Ry@> +@.Ry@> +@*2 |@!Rx| rule.\fbreak +\fbreak +\convertMPtoPDF{pager_1.8}{1}{1} +@.Rx@> +@*2 |@!Ry| rule.\fbreak +\fbreak +\convertMPtoPDF{pager_1.11}{1}{1} +@.Ry@> +@** First Set Language for \Olinker.\fbreak +\openin 1 = "/yacco2/grammar-testsuite/pager_1.fsc" +\ifeof 1 true + \closein 1 +\else + \closein 1 + \listing{"/yacco2/grammar-testsuite/pager_1.fsc"}\fi +@** Lr1 State Network.\fbreak +\statecolumnspace +\stateno{1} {} {\Shiftonly} +\halign{ +\span\statetemplate +\statetitle +{c}& +{Re}& +{2\hss}& +{3\hss}& +{1\hss}& +{{a} +}& +{1\hss}& +{2\hss}& +{6\hss}& +{\hss}\cr +{c}& +{Re}& +{2\hss}& +{1\hss}& +{1\hss}& +{{a} +}& +{1\hss}& +{2\hss}& +{4\hss}& +{\hss}\cr +{c}& +{Re}& +{2\hss}& +{2\hss}& +{1\hss}& +{{b} +}& +{1\hss}& +{7\hss}& +{9\hss}& +{\hss}\cr +{c}& +{Re}& +{2\hss}& +{4\hss}& +{1\hss}& +{{b} +}& +{1\hss}& +{7\hss}& +{11\hss}& +{\hss}\cr +{c}& +{Rs}& +{1\hss}& +{1\hss}& +{1\hss}& +{{Re} +{$\underline{eog}$} +}& +{1\hss}& +{12\hss}& +{13\hss}& +{\hss}\cr +} +\stateno{2} {a} {\Shiftonly} +\halign{ +\span\statetemplate +\statetitle +{c}& +{Rx}& +{3\hss}& +{1\hss}& +{1\hss}& +{{e} +}& +{2\hss}& +{14\hss}& +{15\hss}& +{\hss}\cr +{c}& +{Rx}& +{3\hss}& +{2\hss}& +{1\hss}& +{{e} +}& +{2\hss}& +{14\hss}& +{14\hss}& +{\hss}\cr +{c}& +{Ry}& +{4\hss}& +{1\hss}& +{1\hss}& +{{e} +}& +{2\hss}& +{14\hss}& +{16\hss}& +{\hss}\cr +{c}& +{Ry}& +{4\hss}& +{2\hss}& +{1\hss}& +{{e} +}& +{2\hss}& +{14\hss}& +{14\hss}& +{\hss}\cr +{t}& +{Re}& +{2\hss}& +{1\hss}& +{2\hss}& +{{Rx} +{$\underline{d}$} +}& +{1\hss}& +{3\hss}& +{4\hss}& +{\hss}\cr +{t}& +{Re}& +{2\hss}& +{3\hss}& +{2\hss}& +{{Ry} +{$\underline{c}$} +}& +{1\hss}& +{5\hss}& +{6\hss}& +{\hss}\cr +} +\stateno{3} {Rx} {\Shiftonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Re}& +{2\hss}& +{1\hss}& +{3\hss}& +{{d} +}& +{1\hss}& +{4\hss}& +{4\hss}& +{\hss}\cr +} +\stateno{4} {d} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Re}& +{2\hss}& +{1\hss}& +{4\hss}& +{{} +}& +{1\hss}& +{0\hss}& +{4\hss}& +{1\hss}\cr +} +\stateno{5} {Ry} {\Shiftonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Re}& +{2\hss}& +{3\hss}& +{3\hss}& +{{c} +}& +{1\hss}& +{6\hss}& +{6\hss}& +{\hss}\cr +} +\stateno{6} {c} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Re}& +{2\hss}& +{3\hss}& +{4\hss}& +{{} +}& +{1\hss}& +{0\hss}& +{6\hss}& +{1\hss}\cr +} +\stateno{7} {b} {\Shiftonly} +\halign{ +\span\statetemplate +\statetitle +{c}& +{Rx}& +{3\hss}& +{1\hss}& +{1\hss}& +{{e} +}& +{7\hss}& +{17\hss}& +{18\hss}& +{\hss}\cr +{c}& +{Rx}& +{3\hss}& +{2\hss}& +{1\hss}& +{{e} +}& +{7\hss}& +{17\hss}& +{17\hss}& +{\hss}\cr +{c}& +{Ry}& +{4\hss}& +{1\hss}& +{1\hss}& +{{e} +}& +{7\hss}& +{17\hss}& +{19\hss}& +{\hss}\cr +{c}& +{Ry}& +{4\hss}& +{2\hss}& +{1\hss}& +{{e} +}& +{7\hss}& +{17\hss}& +{17\hss}& +{\hss}\cr +{t}& +{Re}& +{2\hss}& +{2\hss}& +{2\hss}& +{{Rx} +{$\underline{c}$} +}& +{1\hss}& +{8\hss}& +{9\hss}& +{\hss}\cr +{t}& +{Re}& +{2\hss}& +{4\hss}& +{2\hss}& +{{Ry} +{$\underline{d}$} +}& +{1\hss}& +{10\hss}& +{11\hss}& +{\hss}\cr +} +\stateno{8} {Rx} {\Shiftonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Re}& +{2\hss}& +{2\hss}& +{3\hss}& +{{c} +}& +{1\hss}& +{9\hss}& +{9\hss}& +{\hss}\cr +} +\stateno{9} {c} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Re}& +{2\hss}& +{2\hss}& +{4\hss}& +{{} +}& +{1\hss}& +{0\hss}& +{9\hss}& +{1\hss}\cr +} +\stateno{10} {Ry} {\Shiftonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Re}& +{2\hss}& +{4\hss}& +{3\hss}& +{{d} +}& +{1\hss}& +{11\hss}& +{11\hss}& +{\hss}\cr +} +\stateno{11} {d} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Re}& +{2\hss}& +{4\hss}& +{4\hss}& +{{} +}& +{1\hss}& +{0\hss}& +{11\hss}& +{1\hss}\cr +} +\stateno{12} {Re} {\Shiftonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Rs}& +{1\hss}& +{1\hss}& +{2\hss}& +{{eog} +}& +{1\hss}& +{13\hss}& +{13\hss}& +{\hss}\cr +} +\stateno{13} {eog} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Rs}& +{1\hss}& +{1\hss}& +{3\hss}& +{{} +}& +{1\hss}& +{0\hss}& +{13\hss}& +{2\hss}\cr +} +\stateno{14} {e} {\ShiftandMultipleReduces} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Rx}& +{3\hss}& +{2\hss}& +{2\hss}& +{{} +}& +{2\hss}& +{0\hss}& +{14\hss}& +{3\hss}\cr +{t}& +{Ry}& +{4\hss}& +{2\hss}& +{2\hss}& +{{} +}& +{2\hss}& +{0\hss}& +{14\hss}& +{4\hss}\cr +{c}& +{Rx}& +{3\hss}& +{1\hss}& +{1\hss}& +{{e} +}& +{14\hss}& +{14\hss}& +{15\hss}& +{\hss}\cr +{c}& +{Rx}& +{3\hss}& +{2\hss}& +{1\hss}& +{{e} +}& +{14\hss}& +{14\hss}& +{14\hss}& +{\hss}\cr +{c}& +{Ry}& +{4\hss}& +{1\hss}& +{1\hss}& +{{e} +}& +{14\hss}& +{14\hss}& +{16\hss}& +{\hss}\cr +{c}& +{Ry}& +{4\hss}& +{2\hss}& +{1\hss}& +{{e} +}& +{14\hss}& +{14\hss}& +{14\hss}& +{\hss}\cr +{t}& +{Rx}& +{3\hss}& +{1\hss}& +{2\hss}& +{{Rx} +}& +{2\hss}& +{15\hss}& +{15\hss}& +{\hss}\cr +{t}& +{Ry}& +{4\hss}& +{1\hss}& +{2\hss}& +{{Ry} +}& +{2\hss}& +{16\hss}& +{16\hss}& +{\hss}\cr +} +\stateno{15} {Rx} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Rx}& +{3\hss}& +{1\hss}& +{3\hss}& +{{} +}& +{2\hss}& +{0\hss}& +{15\hss}& +{3\hss}\cr +} +\stateno{16} {Ry} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Ry}& +{4\hss}& +{1\hss}& +{3\hss}& +{{} +}& +{2\hss}& +{0\hss}& +{16\hss}& +{4\hss}\cr +} +\stateno{17} {e} {\ShiftandMultipleReduces} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Rx}& +{3\hss}& +{2\hss}& +{2\hss}& +{{} +}& +{7\hss}& +{0\hss}& +{17\hss}& +{4\hss}\cr +{t}& +{Ry}& +{4\hss}& +{2\hss}& +{2\hss}& +{{} +}& +{7\hss}& +{0\hss}& +{17\hss}& +{3\hss}\cr +{c}& +{Rx}& +{3\hss}& +{1\hss}& +{1\hss}& +{{e} +}& +{17\hss}& +{17\hss}& +{18\hss}& +{\hss}\cr +{c}& +{Rx}& +{3\hss}& +{2\hss}& +{1\hss}& +{{e} +}& +{17\hss}& +{17\hss}& +{17\hss}& +{\hss}\cr +{c}& +{Ry}& +{4\hss}& +{1\hss}& +{1\hss}& +{{e} +}& +{17\hss}& +{17\hss}& +{19\hss}& +{\hss}\cr +{c}& +{Ry}& +{4\hss}& +{2\hss}& +{1\hss}& +{{e} +}& +{17\hss}& +{17\hss}& +{17\hss}& +{\hss}\cr +{t}& +{Rx}& +{3\hss}& +{1\hss}& +{2\hss}& +{{Rx} +}& +{7\hss}& +{18\hss}& +{18\hss}& +{\hss}\cr +{t}& +{Ry}& +{4\hss}& +{1\hss}& +{2\hss}& +{{Ry} +}& +{7\hss}& +{19\hss}& +{19\hss}& +{\hss}\cr +} +\stateno{18} {Rx} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Rx}& +{3\hss}& +{1\hss}& +{3\hss}& +{{} +}& +{7\hss}& +{0\hss}& +{18\hss}& +{4\hss}\cr +} +\stateno{19} {Ry} {\Reduceonly} +\halign{ +\span\statetemplate +\statetitle +{t}& +{Ry}& +{4\hss}& +{1\hss}& +{3\hss}& +{{} +}& +{7\hss}& +{0\hss}& +{19\hss}& +{3\hss}\cr +} +@** Index. diff --git a/web/yacco2/grammar-testsuite/pager_1_idx.pdf b/web/yacco2/grammar-testsuite/pager_1_idx.pdf Binary files differnew file mode 100644 index 0000000000..ba8e7478da --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1_idx.pdf diff --git a/web/yacco2/grammar-testsuite/pager_1sym.cpp b/web/yacco2/grammar-testsuite/pager_1sym.cpp new file mode 100644 index 0000000000..ba3da17aae --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1sym.cpp @@ -0,0 +1,153 @@ +/* + File: pager_1sym.cpp + Date and Time: Sat Jan 31 11:58:44 2015 +*/ +#include "pager_1.h" +using namespace NS_testout_T_enum;// enumerate +using namespace NS_testout_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_testout_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_pager_1;// grammar's ns +// first set terminals +// monolithic grammar --- no thread +void +Cpager_1::reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule){ + int reducing_rule = rhs_to_rules_mapping_[Sub_rule_no]; + Per_rule_s_reuse_table* rule_reuse_tbl_ptr = + fsm_rules_reuse_table.per_rule_s_table_[reducing_rule]; + Rule_s_reuse_entry* re(0); + find_a_recycled_rule(rule_reuse_tbl_ptr,&re); + (*Recycled_rule) = re; + fnd_re: switch (Sub_rule_no){ + case rhs1_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs2_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs3_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs4_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs1_Rx_:{ + Rx* sym; + if(re->rule_ == 0){ + sym = new Rx(parser__); + re->rule_ = sym; + }else{ + sym = (Rx*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs2_Rx_:{ + Rx* sym; + if(re->rule_ == 0){ + sym = new Rx(parser__); + re->rule_ = sym; + }else{ + sym = (Rx*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Ry_:{ + Ry* sym; + if(re->rule_ == 0){ + sym = new Ry(parser__); + re->rule_ = sym; + }else{ + sym = (Ry*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs2_Ry_:{ + Ry* sym; + if(re->rule_ == 0){ + sym = new Ry(parser__); + re->rule_ = sym; + }else{ + sym = (Ry*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + default: return; + } +} diff --git a/web/yacco2/grammar-testsuite/pager_1tbl.cpp b/web/yacco2/grammar-testsuite/pager_1tbl.cpp new file mode 100644 index 0000000000..71259dfd9a --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_1tbl.cpp @@ -0,0 +1,353 @@ +/* + File: pager_1tbl.cpp + Date and Time: Sat Jan 31 11:58:44 2015 +*/ +#include "pager_1.h" +using namespace NS_testout_T_enum;// enumerate +using namespace NS_testout_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_testout_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_pager_1;// grammar's ns +// first set terminals +// LR1_eog +yacco2::UCHAR LA1_Cpager_1[] ={ +1 +,0,2 +}; +// LR1_eolr +yacco2::UCHAR LA2_Cpager_1[] ={ +1 +,0,4 +}; +// raw_d +yacco2::UCHAR LA3_Cpager_1[] ={ +1 +,13,16 +}; +// raw_c +yacco2::UCHAR LA4_Cpager_1[] ={ +1 +,13,8 +}; +extern yacco2::State S1_Cpager_1; +extern yacco2::State S2_Cpager_1; +extern yacco2::State S3_Cpager_1; +extern yacco2::State S4_Cpager_1; +extern yacco2::State S5_Cpager_1; +extern yacco2::State S6_Cpager_1; +extern yacco2::State S7_Cpager_1; +extern yacco2::State S8_Cpager_1; +extern yacco2::State S9_Cpager_1; +extern yacco2::State S10_Cpager_1; +extern yacco2::State S11_Cpager_1; +extern yacco2::State S12_Cpager_1; +extern yacco2::State S13_Cpager_1; +extern yacco2::State S14_Cpager_1; +extern yacco2::State S15_Cpager_1; +extern yacco2::State S16_Cpager_1; +extern yacco2::State S17_Cpager_1; +extern yacco2::State S18_Cpager_1; +extern yacco2::State S19_Cpager_1; +struct S1std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[4]; +}; +S1std_Cpager_1 S1st_Cpager_1 = { + 4 + , + {// start of table + {105,(State*)&S2_Cpager_1} // shift sym: raw_a + ,{106,(State*)&S7_Cpager_1} // shift sym: raw_b + ,{269,(State*)&S1_Cpager_1} // accept sym: Rs + ,{270,(State*)&S12_Cpager_1} // shift sym: Re + }// end of shift table +}; +yacco2::State S1_Cpager_1 = //State's vectored into symbol: " No symbol" +{1 +,0,0,0,0,(Shift_tbl*)&S1st_Cpager_1,0,0,0,0}; +struct S2std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S2std_Cpager_1 S2st_Cpager_1 = { + 3 + , + {// start of table + {109,(State*)&S14_Cpager_1} // shift sym: raw_e + ,{271,(State*)&S3_Cpager_1} // shift sym: Rx + ,{272,(State*)&S5_Cpager_1} // shift sym: Ry + }// end of shift table +}; +yacco2::State S2_Cpager_1 = //State's vectored into symbol: "a" +{2 +,0,0,0,0,(Shift_tbl*)&S2st_Cpager_1,0,0,0,0}; +struct S3std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S3std_Cpager_1 S3st_Cpager_1 = { + 1 + , + {// start of table + {108,(State*)&S4_Cpager_1} // shift sym: raw_d + }// end of shift table +}; +yacco2::State S3_Cpager_1 = //State's vectored into symbol: "Rx" +{3 +,0,0,0,0,(Shift_tbl*)&S3st_Cpager_1,0,0,0,0}; +struct S4rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S4rtd_Cpager_1 S4rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cpager_1,Cpager_1::rhs1_Re_} + }// end of reduce table +}; +yacco2::State S4_Cpager_1 = //State's vectored into symbol: "d" +{4 +,0,0,0,0,0,(Reduce_tbl*)&S4rt_Cpager_1,0,0,0}; +struct S5std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S5std_Cpager_1 S5st_Cpager_1 = { + 1 + , + {// start of table + {107,(State*)&S6_Cpager_1} // shift sym: raw_c + }// end of shift table +}; +yacco2::State S5_Cpager_1 = //State's vectored into symbol: "Ry" +{5 +,0,0,0,0,(Shift_tbl*)&S5st_Cpager_1,0,0,0,0}; +struct S6rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S6rtd_Cpager_1 S6rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cpager_1,Cpager_1::rhs3_Re_} + }// end of reduce table +}; +yacco2::State S6_Cpager_1 = //State's vectored into symbol: "c" +{6 +,0,0,0,0,0,(Reduce_tbl*)&S6rt_Cpager_1,0,0,0}; +struct S7std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S7std_Cpager_1 S7st_Cpager_1 = { + 3 + , + {// start of table + {109,(State*)&S17_Cpager_1} // shift sym: raw_e + ,{271,(State*)&S8_Cpager_1} // shift sym: Rx + ,{272,(State*)&S10_Cpager_1} // shift sym: Ry + }// end of shift table +}; +yacco2::State S7_Cpager_1 = //State's vectored into symbol: "b" +{7 +,0,0,0,0,(Shift_tbl*)&S7st_Cpager_1,0,0,0,0}; +struct S8std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S8std_Cpager_1 S8st_Cpager_1 = { + 1 + , + {// start of table + {107,(State*)&S9_Cpager_1} // shift sym: raw_c + }// end of shift table +}; +yacco2::State S8_Cpager_1 = //State's vectored into symbol: "Rx" +{8 +,0,0,0,0,(Shift_tbl*)&S8st_Cpager_1,0,0,0,0}; +struct S9rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S9rtd_Cpager_1 S9rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cpager_1,Cpager_1::rhs2_Re_} + }// end of reduce table +}; +yacco2::State S9_Cpager_1 = //State's vectored into symbol: "c" +{9 +,0,0,0,0,0,(Reduce_tbl*)&S9rt_Cpager_1,0,0,0}; +struct S10std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S10std_Cpager_1 S10st_Cpager_1 = { + 1 + , + {// start of table + {108,(State*)&S11_Cpager_1} // shift sym: raw_d + }// end of shift table +}; +yacco2::State S10_Cpager_1 = //State's vectored into symbol: "Ry" +{10 +,0,0,0,0,(Shift_tbl*)&S10st_Cpager_1,0,0,0,0}; +struct S11rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S11rtd_Cpager_1 S11rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cpager_1,Cpager_1::rhs4_Re_} + }// end of reduce table +}; +yacco2::State S11_Cpager_1 = //State's vectored into symbol: "d" +{11 +,0,0,0,0,0,(Reduce_tbl*)&S11rt_Cpager_1,0,0,0}; +struct S12std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S12std_Cpager_1 S12st_Cpager_1 = { + 1 + , + {// start of table + {1,(State*)&S13_Cpager_1} // shift sym: LR1_eog + }// end of shift table +}; +yacco2::State S12_Cpager_1 = //State's vectored into symbol: "Re" +{12 +,0,0,0,0,(Shift_tbl*)&S12st_Cpager_1,0,0,0,0}; +struct S13rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S13rtd_Cpager_1 S13rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cpager_1,Cpager_1::rhs1_Rs_} + }// end of reduce table +}; +yacco2::State S13_Cpager_1 = //State's vectored into symbol: "eog" +{13 +,0,0,0,0,0,(Reduce_tbl*)&S13rt_Cpager_1,0,0,0}; +struct S14std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S14std_Cpager_1 S14st_Cpager_1 = { + 3 + , + {// start of table + {109,(State*)&S14_Cpager_1} // shift sym: raw_e + ,{271,(State*)&S15_Cpager_1} // shift sym: Rx + ,{272,(State*)&S16_Cpager_1} // shift sym: Ry + }// end of shift table +}; +struct S14rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[2]; +}; +S14rtd_Cpager_1 S14rt_Cpager_1 = { + 2 + , + {// start of table + {(Set_tbl*)&LA3_Cpager_1,Cpager_1::rhs2_Rx_} + ,{(Set_tbl*)&LA4_Cpager_1,Cpager_1::rhs2_Ry_} + }// end of reduce table +}; +yacco2::State S14_Cpager_1 = //State's vectored into symbol: "e" +{14 +,0,0,0,0,(Shift_tbl*)&S14st_Cpager_1,(Reduce_tbl*)&S14rt_Cpager_1,0,0,0}; +struct S15rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S15rtd_Cpager_1 S15rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Cpager_1,Cpager_1::rhs1_Rx_} + }// end of reduce table +}; +yacco2::State S15_Cpager_1 = //State's vectored into symbol: "Rx" +{15 +,0,0,0,0,0,(Reduce_tbl*)&S15rt_Cpager_1,0,0,0}; +struct S16rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S16rtd_Cpager_1 S16rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_1,Cpager_1::rhs1_Ry_} + }// end of reduce table +}; +yacco2::State S16_Cpager_1 = //State's vectored into symbol: "Ry" +{16 +,0,0,0,0,0,(Reduce_tbl*)&S16rt_Cpager_1,0,0,0}; +struct S17std_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S17std_Cpager_1 S17st_Cpager_1 = { + 3 + , + {// start of table + {109,(State*)&S17_Cpager_1} // shift sym: raw_e + ,{271,(State*)&S18_Cpager_1} // shift sym: Rx + ,{272,(State*)&S19_Cpager_1} // shift sym: Ry + }// end of shift table +}; +struct S17rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[2]; +}; +S17rtd_Cpager_1 S17rt_Cpager_1 = { + 2 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_1,Cpager_1::rhs2_Rx_} + ,{(Set_tbl*)&LA3_Cpager_1,Cpager_1::rhs2_Ry_} + }// end of reduce table +}; +yacco2::State S17_Cpager_1 = //State's vectored into symbol: "e" +{17 +,0,0,0,0,(Shift_tbl*)&S17st_Cpager_1,(Reduce_tbl*)&S17rt_Cpager_1,0,0,0}; +struct S18rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S18rtd_Cpager_1 S18rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_1,Cpager_1::rhs1_Rx_} + }// end of reduce table +}; +yacco2::State S18_Cpager_1 = //State's vectored into symbol: "Rx" +{18 +,0,0,0,0,0,(Reduce_tbl*)&S18rt_Cpager_1,0,0,0}; +struct S19rtd_Cpager_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S19rtd_Cpager_1 S19rt_Cpager_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Cpager_1,Cpager_1::rhs1_Ry_} + }// end of reduce table +}; +yacco2::State S19_Cpager_1 = //State's vectored into symbol: "Ry" +{19 +,0,0,0,0,0,(Reduce_tbl*)&S19rt_Cpager_1,0,0,0}; diff --git a/web/yacco2/grammar-testsuite/pager_2.cpp b/web/yacco2/grammar-testsuite/pager_2.cpp new file mode 100644 index 0000000000..711c9f276c --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_2.cpp @@ -0,0 +1,128 @@ +/* + File: pager_2.cpp + Date and Time: Sat Jan 31 11:58:48 2015 +*/ +#include "pager_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_pager_2;// grammar's ns +// first set terminals +fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ + no_rules_entries_ = 10; + per_rule_s_table_[0] = new Per_rule_s_reuse_table(); + per_rule_s_table_[1] = new Per_rule_s_reuse_table(); + per_rule_s_table_[2] = new Per_rule_s_reuse_table(); + per_rule_s_table_[3] = new Per_rule_s_reuse_table(); + per_rule_s_table_[4] = new Per_rule_s_reuse_table(); + per_rule_s_table_[5] = new Per_rule_s_reuse_table(); + per_rule_s_table_[6] = new Per_rule_s_reuse_table(); + per_rule_s_table_[7] = new Per_rule_s_reuse_table(); + per_rule_s_table_[8] = new Per_rule_s_reuse_table(); + per_rule_s_table_[9] = new Per_rule_s_reuse_table(); +} + Cpager_2:: + Cpager_2() + :yacco2::CAbs_fsm + ("pager_2.lex" + ,"1.0" + ,"7 mar 2014" + ,false + ,"Test out David Pager LR(1) resolution page 61." + ,"Sat Jan 31 11:58:48 2015 " + ,S1_Cpager_2){ + + } + +Cpager_2::~Cpager_2(){ + + for(int x = 0;x < 10;++x){ + ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; + } +} + + bool Cpager_2::failed(){ + return false; + } + void Cpager_2::op(){ +} +int Cpager_2::rhs_to_rules_mapping_[25] = { + -1 + ,0 // subrule 1 for rule 1 + ,1 // subrule 2 for rule 2 + ,1 // subrule 3 for rule 2 + ,1 // subrule 4 for rule 2 + ,1 // subrule 5 for rule 2 + ,1 // subrule 6 for rule 2 + ,1 // subrule 7 for rule 2 + ,1 // subrule 8 for rule 2 + ,1 // subrule 9 for rule 2 + ,2 // subrule 10 for rule 3 + ,3 // subrule 11 for rule 4 + ,4 // subrule 12 for rule 5 + ,4 // subrule 13 for rule 5 + ,5 // subrule 14 for rule 6 + ,5 // subrule 15 for rule 6 + ,6 // subrule 16 for rule 7 + ,6 // subrule 17 for rule 7 + ,7 // subrule 18 for rule 8 + ,7 // subrule 19 for rule 8 + ,7 // subrule 20 for rule 8 + ,7 // subrule 21 for rule 8 + ,8 // subrule 22 for rule 9 + ,8 // subrule 23 for rule 9 + ,9 // subrule 24 for rule 10 +}; +Rs::Rs(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs",0,Cpager_2::R_Rs_,P,false,false){ +} + +Rg::Rg(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rg",0,Cpager_2::R_Rg_,P,false,false){ +} + +Rw::Rw(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rw",0,Cpager_2::R_Rw_,P,false,false){ +} + +Rv::Rv(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rv",0,Cpager_2::R_Rv_,P,false,false){ +} + +Rx::Rx(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rx",0,Cpager_2::R_Rx_,P,false,false){ +} + +Ry::Ry(yacco2::Parser* P) + :CAbs_lr1_sym + ("Ry",0,Cpager_2::R_Ry_,P,false,false){ +} + +Ru::Ru(yacco2::Parser* P) + :CAbs_lr1_sym + ("Ru",0,Cpager_2::R_Ru_,P,false,false){ +} + +Re::Re(yacco2::Parser* P) + :CAbs_lr1_sym + ("Re",0,Cpager_2::R_Re_,P,false,false){ +} + +Rc::Rc(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rc",0,Cpager_2::R_Rc_,P,false,false){ +} + +Rp::Rp(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rp",0,Cpager_2::R_Rp_,P,false,false){ +} + diff --git a/web/yacco2/grammar-testsuite/pager_2.fsc b/web/yacco2/grammar-testsuite/pager_2.fsc new file mode 100644 index 0000000000..bd2e2097f3 --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_2.fsc @@ -0,0 +1,23 @@ +/* + File: pager_2.fsc + Date and Time: Sat Jan 31 11:58:48 2015 +*/ +transitive n +grammar-name "pager_2" +name-space "NS_pager_2" +thread-name "Cpager_2" +monolithic y +file-name "pager_2.fsc" +no-of-T 569 +list-of-native-first-set-terminals 4 + raw_u + raw_x + raw_y + raw_z +end-list-of-native-first-set-terminals +list-of-transitive-threads 0 +end-list-of-transitive-threads +list-of-used-threads 0 +end-list-of-used-threads +fsm-comments +"Test out David Pager LR(1) resolution page 61." diff --git a/web/yacco2/grammar-testsuite/pager_2.h b/web/yacco2/grammar-testsuite/pager_2.h new file mode 100644 index 0000000000..15dcdd409f --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_2.h @@ -0,0 +1,135 @@ +/* + File: pager_2.h + Date and Time: Sat Jan 31 11:58:48 2015 +*/ +#ifndef __pager_2_h__ +#define __pager_2_h__ 1 +#include "yacco2.h" +#include "yacco2_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "yacco2_err_symbols.h" +#include "yacco2_terminals.h" +#include "yacco2_characters.h" +// monolithic grammar: no thread +extern yacco2::State S1_Cpager_2; +namespace NS_pager_2 { +using namespace NS_yacco2_T_enum;// enumerate +using namespace yacco2; +struct fsm_rules_reuse_table_type{ + fsm_rules_reuse_table_type(); + int no_rules_entries_; + Per_rule_s_reuse_table* per_rule_s_table_[10]; +}; +class Cpager_2: public yacco2::CAbs_fsm { + public: + enum rules_and_subrules{ + start_of_rule_list = NS_yacco2_T_enum::T_Enum::sum_total_T + ,R_Rs_ = 569//start_of_rule_list + 0 + ,rhs1_Rs_ = 1 + ,R_Rg_ = 570//start_of_rule_list + 2 + ,rhs1_Rg_ = 2 + ,rhs2_Rg_ = 3 + ,rhs3_Rg_ = 4 + ,rhs4_Rg_ = 5 + ,rhs5_Rg_ = 6 + ,rhs6_Rg_ = 7 + ,rhs7_Rg_ = 8 + ,rhs8_Rg_ = 9 + ,R_Rw_ = 571//start_of_rule_list + 4 + ,rhs1_Rw_ = 10 + ,R_Rv_ = 572//start_of_rule_list + 6 + ,rhs1_Rv_ = 11 + ,R_Rx_ = 573//start_of_rule_list + 8 + ,rhs1_Rx_ = 12 + ,rhs2_Rx_ = 13 + ,R_Ry_ = 574//start_of_rule_list + 10 + ,rhs1_Ry_ = 14 + ,rhs2_Ry_ = 15 + ,R_Ru_ = 575//start_of_rule_list + 12 + ,rhs1_Ru_ = 16 + ,rhs2_Ru_ = 17 + ,R_Re_ = 576//start_of_rule_list + 14 + ,rhs1_Re_ = 18 + ,rhs2_Re_ = 19 + ,rhs3_Re_ = 20 + ,rhs4_Re_ = 21 + ,R_Rc_ = 577//start_of_rule_list + 16 + ,rhs1_Rc_ = 22 + ,rhs2_Rc_ = 23 + ,R_Rp_ = 578//start_of_rule_list + 18 + ,rhs1_Rp_ = 24 + }; + //no of la sets = 7 + //no of states = 40 + Cpager_2(); + ~Cpager_2(); + void op(); + bool failed(); + void reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule); + fsm_rules_reuse_table_type fsm_rules_reuse_table; + static int rhs_to_rules_mapping_[25]; + }; +struct Rs; +struct Rg; +struct Rw; +struct Rv; +struct Rx; +struct Ry; +struct Ru; +struct Re; +struct Rc; +struct Rp; +struct Rs:public yacco2::CAbs_lr1_sym { + Rs(yacco2::Parser* P); + public: +}; + +struct Rg:public yacco2::CAbs_lr1_sym { + Rg(yacco2::Parser* P); + public: +}; + +struct Rw:public yacco2::CAbs_lr1_sym { + Rw(yacco2::Parser* P); + public: +}; + +struct Rv:public yacco2::CAbs_lr1_sym { + Rv(yacco2::Parser* P); + public: +}; + +struct Rx:public yacco2::CAbs_lr1_sym { + Rx(yacco2::Parser* P); + public: +}; + +struct Ry:public yacco2::CAbs_lr1_sym { + Ry(yacco2::Parser* P); + public: +}; + +struct Ru:public yacco2::CAbs_lr1_sym { + Ru(yacco2::Parser* P); + public: +}; + +struct Re:public yacco2::CAbs_lr1_sym { + Re(yacco2::Parser* P); + public: +}; + +struct Rc:public yacco2::CAbs_lr1_sym { + Rc(yacco2::Parser* P); + public: +}; + +struct Rp:public yacco2::CAbs_lr1_sym { + Rp(yacco2::Parser* P); + public: +}; + +} // end of namespace + +#endif diff --git a/web/yacco2/grammar-testsuite/pager_2.lex b/web/yacco2/grammar-testsuite/pager_2.lex new file mode 100644 index 0000000000..f34ffe2014 --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_2.lex @@ -0,0 +1,75 @@ +/* +Author: Dave Bone +FILE: pager_2.lex +Date: 7 mar 2014 +Purpose: Test out David Pager lr(1) resolution page 61 +*/ +/@ +@** David Pager Grammar.\fbreak +David Pager\fbreak +The Lane Table Method Of Constructing LR(1) Parsers.\fbreak +@/ +fsm +(fsm-id "pager_2.lex",fsm-filename pager_2,fsm-namespace NS_pager_2 +,fsm-class Cpager_2 +,fsm-version "1.0",fsm-date "7 mar 2014",fsm-debug "false" +,fsm-comments "Test out David Pager LR(1) resolution page 61.") +@"/usr/local/yacco2/compiler/grammars/yacco2_T_includes.T" + +rules{ + +Rs(){ + -> Rg eog +} + +Rg(){ + -> x Rw a + -> x Rv t + -> y Rw b + -> y Rv t + -> z Rw r + -> z Rv b + -> u Ru Rx a + -> u Ru Ry r +} + +Rw(){ + -> Ru Rx Rc +} + +Rv(){ + -> Ru Ry d +} + +Rx(){ + -> k t Ru Rx Rp + -> k t +} + +Ry(){ + -> k t Ru Ry u + -> k t +} + +Ru(){ + -> Ru k t + -> s +} + +Re(){ + -> a + -> b + -> c + -> v +} + +Rc(){ + -> c + -> w +} + +Rp(){ + -> z +} + +} diff --git a/web/yacco2/grammar-testsuite/pager_2.pdf b/web/yacco2/grammar-testsuite/pager_2.pdf Binary files differnew file mode 100644 index 0000000000..10d6a9e0ff --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_2.pdf diff --git a/web/yacco2/grammar-testsuite/pager_2_idx.pdf b/web/yacco2/grammar-testsuite/pager_2_idx.pdf Binary files differnew file mode 100644 index 0000000000..c0093bee25 --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_2_idx.pdf diff --git a/web/yacco2/grammar-testsuite/pager_2sym.cpp b/web/yacco2/grammar-testsuite/pager_2sym.cpp new file mode 100644 index 0000000000..d83adcec29 --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_2sym.cpp @@ -0,0 +1,363 @@ +/* + File: pager_2sym.cpp + Date and Time: Sat Jan 31 11:58:48 2015 +*/ +#include "pager_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_pager_2;// grammar's ns +// first set terminals +// monolithic grammar --- no thread +void +Cpager_2::reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule){ + int reducing_rule = rhs_to_rules_mapping_[Sub_rule_no]; + Per_rule_s_reuse_table* rule_reuse_tbl_ptr = + fsm_rules_reuse_table.per_rule_s_table_[reducing_rule]; + Rule_s_reuse_entry* re(0); + find_a_recycled_rule(rule_reuse_tbl_ptr,&re); + (*Recycled_rule) = re; + fnd_re: switch (Sub_rule_no){ + case rhs1_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs2_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs3_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs4_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs5_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs6_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs7_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 4; + + + return;} + case rhs8_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 4; + + + return;} + case rhs1_Rw_:{ + Rw* sym; + if(re->rule_ == 0){ + sym = new Rw(parser__); + re->rule_ = sym; + }else{ + sym = (Rw*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs1_Rv_:{ + Rv* sym; + if(re->rule_ == 0){ + sym = new Rv(parser__); + re->rule_ = sym; + }else{ + sym = (Rv*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs1_Rx_:{ + Rx* sym; + if(re->rule_ == 0){ + sym = new Rx(parser__); + re->rule_ = sym; + }else{ + sym = (Rx*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 5; + + + return;} + case rhs2_Rx_:{ + Rx* sym; + if(re->rule_ == 0){ + sym = new Rx(parser__); + re->rule_ = sym; + }else{ + sym = (Rx*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Ry_:{ + Ry* sym; + if(re->rule_ == 0){ + sym = new Ry(parser__); + re->rule_ = sym; + }else{ + sym = (Ry*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 5; + + + return;} + case rhs2_Ry_:{ + Ry* sym; + if(re->rule_ == 0){ + sym = new Ry(parser__); + re->rule_ = sym; + }else{ + sym = (Ry*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Ru_:{ + Ru* sym; + if(re->rule_ == 0){ + sym = new Ru(parser__); + re->rule_ = sym; + }else{ + sym = (Ru*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs2_Ru_:{ + Ru* sym; + if(re->rule_ == 0){ + sym = new Ru(parser__); + re->rule_ = sym; + }else{ + sym = (Ru*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs2_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs3_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs4_Re_:{ + Re* sym; + if(re->rule_ == 0){ + sym = new Re(parser__); + re->rule_ = sym; + }else{ + sym = (Re*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Rc_:{ + Rc* sym; + if(re->rule_ == 0){ + sym = new Rc(parser__); + re->rule_ = sym; + }else{ + sym = (Rc*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs2_Rc_:{ + Rc* sym; + if(re->rule_ == 0){ + sym = new Rc(parser__); + re->rule_ = sym; + }else{ + sym = (Rc*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Rp_:{ + Rp* sym; + if(re->rule_ == 0){ + sym = new Rp(parser__); + re->rule_ = sym; + }else{ + sym = (Rp*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + default: return; + } +} diff --git a/web/yacco2/grammar-testsuite/pager_2tbl.cpp b/web/yacco2/grammar-testsuite/pager_2tbl.cpp new file mode 100644 index 0000000000..5bacd6f66b --- /dev/null +++ b/web/yacco2/grammar-testsuite/pager_2tbl.cpp @@ -0,0 +1,699 @@ +/* + File: pager_2tbl.cpp + Date and Time: Sat Jan 31 11:58:48 2015 +*/ +#include "pager_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_pager_2;// grammar's ns +// first set terminals +// raw_a +// raw_c +// raw_w +// raw_z +yacco2::UCHAR LA1_Cpager_2[] ={ +3 +,13,10 +,15,128 +,16,4 +}; +// raw_d +// raw_r +// raw_u +yacco2::UCHAR LA2_Cpager_2[] ={ +2 +,13,16 +,15,36 +}; +// raw_k +yacco2::UCHAR LA3_Cpager_2[] ={ +1 +,14,8 +}; +// LR1_eog +yacco2::UCHAR LA4_Cpager_2[] ={ +1 +,0,2 +}; +// LR1_eolr +yacco2::UCHAR LA5_Cpager_2[] ={ +1 +,0,4 +}; +// raw_a +// raw_b +// raw_r +yacco2::UCHAR LA6_Cpager_2[] ={ +2 +,13,6 +,15,4 +}; +// raw_b +// raw_t +yacco2::UCHAR LA7_Cpager_2[] ={ +2 +,13,4 +,15,16 +}; +extern yacco2::State S1_Cpager_2; +extern yacco2::State S2_Cpager_2; +extern yacco2::State S3_Cpager_2; +extern yacco2::State S4_Cpager_2; +extern yacco2::State S5_Cpager_2; +extern yacco2::State S6_Cpager_2; +extern yacco2::State S7_Cpager_2; +extern yacco2::State S8_Cpager_2; +extern yacco2::State S9_Cpager_2; +extern yacco2::State S10_Cpager_2; +extern yacco2::State S11_Cpager_2; +extern yacco2::State S12_Cpager_2; +extern yacco2::State S13_Cpager_2; +extern yacco2::State S14_Cpager_2; +extern yacco2::State S15_Cpager_2; +extern yacco2::State S16_Cpager_2; +extern yacco2::State S17_Cpager_2; +extern yacco2::State S18_Cpager_2; +extern yacco2::State S19_Cpager_2; +extern yacco2::State S20_Cpager_2; +extern yacco2::State S21_Cpager_2; +extern yacco2::State S22_Cpager_2; +extern yacco2::State S23_Cpager_2; +extern yacco2::State S24_Cpager_2; +extern yacco2::State S25_Cpager_2; +extern yacco2::State S26_Cpager_2; +extern yacco2::State S27_Cpager_2; +extern yacco2::State S28_Cpager_2; +extern yacco2::State S29_Cpager_2; +extern yacco2::State S30_Cpager_2; +extern yacco2::State S31_Cpager_2; +extern yacco2::State S32_Cpager_2; +extern yacco2::State S33_Cpager_2; +extern yacco2::State S34_Cpager_2; +extern yacco2::State S35_Cpager_2; +extern yacco2::State S36_Cpager_2; +extern yacco2::State S37_Cpager_2; +extern yacco2::State S38_Cpager_2; +extern yacco2::State S39_Cpager_2; +extern yacco2::State S40_Cpager_2; +struct S1std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[6]; +}; +S1std_Cpager_2 S1st_Cpager_2 = { + 6 + , + {// start of table + {125,(State*)&S2_Cpager_2} // shift sym: raw_u + ,{128,(State*)&S16_Cpager_2} // shift sym: raw_x + ,{129,(State*)&S21_Cpager_2} // shift sym: raw_y + ,{130,(State*)&S26_Cpager_2} // shift sym: raw_z + ,{569,(State*)&S1_Cpager_2} // accept sym: Rs + ,{570,(State*)&S31_Cpager_2} // shift sym: Rg + }// end of shift table +}; +yacco2::State S1_Cpager_2 = //State's vectored into symbol: " No symbol" +{1 +,0,0,0,0,(Shift_tbl*)&S1st_Cpager_2,0,0,0,0}; +struct S2std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[2]; +}; +S2std_Cpager_2 S2st_Cpager_2 = { + 2 + , + {// start of table + {123,(State*)&S33_Cpager_2} // shift sym: raw_s + ,{575,(State*)&S3_Cpager_2} // shift sym: Ru + }// end of shift table +}; +yacco2::State S2_Cpager_2 = //State's vectored into symbol: "u" +{2 +,0,0,0,0,(Shift_tbl*)&S2st_Cpager_2,0,0,0,0}; +struct S3std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S3std_Cpager_2 S3st_Cpager_2 = { + 3 + , + {// start of table + {115,(State*)&S4_Cpager_2} // shift sym: raw_k + ,{573,(State*)&S12_Cpager_2} // shift sym: Rx + ,{574,(State*)&S14_Cpager_2} // shift sym: Ry + }// end of shift table +}; +yacco2::State S3_Cpager_2 = //State's vectored into symbol: "Ru" +{3 +,0,0,0,0,(Shift_tbl*)&S3st_Cpager_2,0,0,0,0}; +struct S4std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S4std_Cpager_2 S4st_Cpager_2 = { + 1 + , + {// start of table + {124,(State*)&S5_Cpager_2} // shift sym: raw_t + }// end of shift table +}; +yacco2::State S4_Cpager_2 = //State's vectored into symbol: "k" +{4 +,0,0,0,0,(Shift_tbl*)&S4st_Cpager_2,0,0,0,0}; +struct S5std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[2]; +}; +S5std_Cpager_2 S5st_Cpager_2 = { + 2 + , + {// start of table + {123,(State*)&S33_Cpager_2} // shift sym: raw_s + ,{575,(State*)&S6_Cpager_2} // shift sym: Ru + }// end of shift table +}; +struct S5rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[3]; +}; +S5rtd_Cpager_2 S5rt_Cpager_2 = { + 3 + , + {// start of table + {(Set_tbl*)&LA1_Cpager_2,Cpager_2::rhs2_Rx_} + ,{(Set_tbl*)&LA2_Cpager_2,Cpager_2::rhs2_Ry_} + ,{(Set_tbl*)&LA3_Cpager_2,Cpager_2::rhs1_Ru_} + }// end of reduce table +}; +yacco2::State S5_Cpager_2 = //State's vectored into symbol: "t" +{5 +,0,0,0,0,(Shift_tbl*)&S5st_Cpager_2,(Reduce_tbl*)&S5rt_Cpager_2,0,0,0}; +struct S6std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S6std_Cpager_2 S6st_Cpager_2 = { + 3 + , + {// start of table + {115,(State*)&S4_Cpager_2} // shift sym: raw_k + ,{573,(State*)&S7_Cpager_2} // shift sym: Rx + ,{574,(State*)&S10_Cpager_2} // shift sym: Ry + }// end of shift table +}; +yacco2::State S6_Cpager_2 = //State's vectored into symbol: "Ru" +{6 +,0,0,0,0,(Shift_tbl*)&S6st_Cpager_2,0,0,0,0}; +struct S7std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[2]; +}; +S7std_Cpager_2 S7st_Cpager_2 = { + 2 + , + {// start of table + {130,(State*)&S8_Cpager_2} // shift sym: raw_z + ,{578,(State*)&S9_Cpager_2} // shift sym: Rp + }// end of shift table +}; +yacco2::State S7_Cpager_2 = //State's vectored into symbol: "Rx" +{7 +,0,0,0,0,(Shift_tbl*)&S7st_Cpager_2,0,0,0,0}; +struct S8rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S8rtd_Cpager_2 S8rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cpager_2,Cpager_2::rhs1_Rp_} + }// end of reduce table +}; +yacco2::State S8_Cpager_2 = //State's vectored into symbol: "z" +{8 +,0,0,0,0,0,(Reduce_tbl*)&S8rt_Cpager_2,0,0,0}; +struct S9rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S9rtd_Cpager_2 S9rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Cpager_2,Cpager_2::rhs1_Rx_} + }// end of reduce table +}; +yacco2::State S9_Cpager_2 = //State's vectored into symbol: "Rp" +{9 +,0,0,0,0,0,(Reduce_tbl*)&S9rt_Cpager_2,0,0,0}; +struct S10std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S10std_Cpager_2 S10st_Cpager_2 = { + 1 + , + {// start of table + {125,(State*)&S11_Cpager_2} // shift sym: raw_u + }// end of shift table +}; +yacco2::State S10_Cpager_2 = //State's vectored into symbol: "Ry" +{10 +,0,0,0,0,(Shift_tbl*)&S10st_Cpager_2,0,0,0,0}; +struct S11rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S11rtd_Cpager_2 S11rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Cpager_2,Cpager_2::rhs1_Ry_} + }// end of reduce table +}; +yacco2::State S11_Cpager_2 = //State's vectored into symbol: "u" +{11 +,0,0,0,0,0,(Reduce_tbl*)&S11rt_Cpager_2,0,0,0}; +struct S12std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S12std_Cpager_2 S12st_Cpager_2 = { + 1 + , + {// start of table + {105,(State*)&S13_Cpager_2} // shift sym: raw_a + }// end of shift table +}; +yacco2::State S12_Cpager_2 = //State's vectored into symbol: "Rx" +{12 +,0,0,0,0,(Shift_tbl*)&S12st_Cpager_2,0,0,0,0}; +struct S13rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S13rtd_Cpager_2 S13rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_2,Cpager_2::rhs7_Rg_} + }// end of reduce table +}; +yacco2::State S13_Cpager_2 = //State's vectored into symbol: "a" +{13 +,0,0,0,0,0,(Reduce_tbl*)&S13rt_Cpager_2,0,0,0}; +struct S14std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S14std_Cpager_2 S14st_Cpager_2 = { + 1 + , + {// start of table + {122,(State*)&S15_Cpager_2} // shift sym: raw_r + }// end of shift table +}; +yacco2::State S14_Cpager_2 = //State's vectored into symbol: "Ry" +{14 +,0,0,0,0,(Shift_tbl*)&S14st_Cpager_2,0,0,0,0}; +struct S15rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S15rtd_Cpager_2 S15rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_2,Cpager_2::rhs8_Rg_} + }// end of reduce table +}; +yacco2::State S15_Cpager_2 = //State's vectored into symbol: "r" +{15 +,0,0,0,0,0,(Reduce_tbl*)&S15rt_Cpager_2,0,0,0}; +struct S16std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[4]; +}; +S16std_Cpager_2 S16st_Cpager_2 = { + 4 + , + {// start of table + {123,(State*)&S33_Cpager_2} // shift sym: raw_s + ,{571,(State*)&S17_Cpager_2} // shift sym: Rw + ,{572,(State*)&S19_Cpager_2} // shift sym: Rv + ,{575,(State*)&S34_Cpager_2} // shift sym: Ru + }// end of shift table +}; +yacco2::State S16_Cpager_2 = //State's vectored into symbol: "x" +{16 +,0,0,0,0,(Shift_tbl*)&S16st_Cpager_2,0,0,0,0}; +struct S17std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S17std_Cpager_2 S17st_Cpager_2 = { + 1 + , + {// start of table + {105,(State*)&S18_Cpager_2} // shift sym: raw_a + }// end of shift table +}; +yacco2::State S17_Cpager_2 = //State's vectored into symbol: "Rw" +{17 +,0,0,0,0,(Shift_tbl*)&S17st_Cpager_2,0,0,0,0}; +struct S18rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S18rtd_Cpager_2 S18rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_2,Cpager_2::rhs1_Rg_} + }// end of reduce table +}; +yacco2::State S18_Cpager_2 = //State's vectored into symbol: "a" +{18 +,0,0,0,0,0,(Reduce_tbl*)&S18rt_Cpager_2,0,0,0}; +struct S19std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S19std_Cpager_2 S19st_Cpager_2 = { + 1 + , + {// start of table + {124,(State*)&S20_Cpager_2} // shift sym: raw_t + }// end of shift table +}; +yacco2::State S19_Cpager_2 = //State's vectored into symbol: "Rv" +{19 +,0,0,0,0,(Shift_tbl*)&S19st_Cpager_2,0,0,0,0}; +struct S20rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S20rtd_Cpager_2 S20rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_2,Cpager_2::rhs2_Rg_} + }// end of reduce table +}; +yacco2::State S20_Cpager_2 = //State's vectored into symbol: "t" +{20 +,0,0,0,0,0,(Reduce_tbl*)&S20rt_Cpager_2,0,0,0}; +struct S21std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[4]; +}; +S21std_Cpager_2 S21st_Cpager_2 = { + 4 + , + {// start of table + {123,(State*)&S33_Cpager_2} // shift sym: raw_s + ,{571,(State*)&S22_Cpager_2} // shift sym: Rw + ,{572,(State*)&S24_Cpager_2} // shift sym: Rv + ,{575,(State*)&S34_Cpager_2} // shift sym: Ru + }// end of shift table +}; +yacco2::State S21_Cpager_2 = //State's vectored into symbol: "y" +{21 +,0,0,0,0,(Shift_tbl*)&S21st_Cpager_2,0,0,0,0}; +struct S22std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S22std_Cpager_2 S22st_Cpager_2 = { + 1 + , + {// start of table + {106,(State*)&S23_Cpager_2} // shift sym: raw_b + }// end of shift table +}; +yacco2::State S22_Cpager_2 = //State's vectored into symbol: "Rw" +{22 +,0,0,0,0,(Shift_tbl*)&S22st_Cpager_2,0,0,0,0}; +struct S23rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S23rtd_Cpager_2 S23rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_2,Cpager_2::rhs3_Rg_} + }// end of reduce table +}; +yacco2::State S23_Cpager_2 = //State's vectored into symbol: "b" +{23 +,0,0,0,0,0,(Reduce_tbl*)&S23rt_Cpager_2,0,0,0}; +struct S24std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S24std_Cpager_2 S24st_Cpager_2 = { + 1 + , + {// start of table + {124,(State*)&S25_Cpager_2} // shift sym: raw_t + }// end of shift table +}; +yacco2::State S24_Cpager_2 = //State's vectored into symbol: "Rv" +{24 +,0,0,0,0,(Shift_tbl*)&S24st_Cpager_2,0,0,0,0}; +struct S25rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S25rtd_Cpager_2 S25rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_2,Cpager_2::rhs4_Rg_} + }// end of reduce table +}; +yacco2::State S25_Cpager_2 = //State's vectored into symbol: "t" +{25 +,0,0,0,0,0,(Reduce_tbl*)&S25rt_Cpager_2,0,0,0}; +struct S26std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[4]; +}; +S26std_Cpager_2 S26st_Cpager_2 = { + 4 + , + {// start of table + {123,(State*)&S33_Cpager_2} // shift sym: raw_s + ,{571,(State*)&S27_Cpager_2} // shift sym: Rw + ,{572,(State*)&S29_Cpager_2} // shift sym: Rv + ,{575,(State*)&S34_Cpager_2} // shift sym: Ru + }// end of shift table +}; +yacco2::State S26_Cpager_2 = //State's vectored into symbol: "z" +{26 +,0,0,0,0,(Shift_tbl*)&S26st_Cpager_2,0,0,0,0}; +struct S27std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S27std_Cpager_2 S27st_Cpager_2 = { + 1 + , + {// start of table + {122,(State*)&S28_Cpager_2} // shift sym: raw_r + }// end of shift table +}; +yacco2::State S27_Cpager_2 = //State's vectored into symbol: "Rw" +{27 +,0,0,0,0,(Shift_tbl*)&S27st_Cpager_2,0,0,0,0}; +struct S28rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S28rtd_Cpager_2 S28rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_2,Cpager_2::rhs5_Rg_} + }// end of reduce table +}; +yacco2::State S28_Cpager_2 = //State's vectored into symbol: "r" +{28 +,0,0,0,0,0,(Reduce_tbl*)&S28rt_Cpager_2,0,0,0}; +struct S29std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S29std_Cpager_2 S29st_Cpager_2 = { + 1 + , + {// start of table + {106,(State*)&S30_Cpager_2} // shift sym: raw_b + }// end of shift table +}; +yacco2::State S29_Cpager_2 = //State's vectored into symbol: "Rv" +{29 +,0,0,0,0,(Shift_tbl*)&S29st_Cpager_2,0,0,0,0}; +struct S30rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S30rtd_Cpager_2 S30rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Cpager_2,Cpager_2::rhs6_Rg_} + }// end of reduce table +}; +yacco2::State S30_Cpager_2 = //State's vectored into symbol: "b" +{30 +,0,0,0,0,0,(Reduce_tbl*)&S30rt_Cpager_2,0,0,0}; +struct S31std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S31std_Cpager_2 S31st_Cpager_2 = { + 1 + , + {// start of table + {1,(State*)&S32_Cpager_2} // shift sym: LR1_eog + }// end of shift table +}; +yacco2::State S31_Cpager_2 = //State's vectored into symbol: "Rg" +{31 +,0,0,0,0,(Shift_tbl*)&S31st_Cpager_2,0,0,0,0}; +struct S32rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S32rtd_Cpager_2 S32rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA5_Cpager_2,Cpager_2::rhs1_Rs_} + }// end of reduce table +}; +yacco2::State S32_Cpager_2 = //State's vectored into symbol: "eog" +{32 +,0,0,0,0,0,(Reduce_tbl*)&S32rt_Cpager_2,0,0,0}; +struct S33rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S33rtd_Cpager_2 S33rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Cpager_2,Cpager_2::rhs2_Ru_} + }// end of reduce table +}; +yacco2::State S33_Cpager_2 = //State's vectored into symbol: "s" +{33 +,0,0,0,0,0,(Reduce_tbl*)&S33rt_Cpager_2,0,0,0}; +struct S34std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S34std_Cpager_2 S34st_Cpager_2 = { + 3 + , + {// start of table + {115,(State*)&S4_Cpager_2} // shift sym: raw_k + ,{573,(State*)&S35_Cpager_2} // shift sym: Rx + ,{574,(State*)&S39_Cpager_2} // shift sym: Ry + }// end of shift table +}; +yacco2::State S34_Cpager_2 = //State's vectored into symbol: "Ru" +{34 +,0,0,0,0,(Shift_tbl*)&S34st_Cpager_2,0,0,0,0}; +struct S35std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S35std_Cpager_2 S35st_Cpager_2 = { + 3 + , + {// start of table + {107,(State*)&S36_Cpager_2} // shift sym: raw_c + ,{127,(State*)&S37_Cpager_2} // shift sym: raw_w + ,{577,(State*)&S38_Cpager_2} // shift sym: Rc + }// end of shift table +}; +yacco2::State S35_Cpager_2 = //State's vectored into symbol: "Rx" +{35 +,0,0,0,0,(Shift_tbl*)&S35st_Cpager_2,0,0,0,0}; +struct S36rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S36rtd_Cpager_2 S36rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA6_Cpager_2,Cpager_2::rhs1_Rc_} + }// end of reduce table +}; +yacco2::State S36_Cpager_2 = //State's vectored into symbol: "c" +{36 +,0,0,0,0,0,(Reduce_tbl*)&S36rt_Cpager_2,0,0,0}; +struct S37rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S37rtd_Cpager_2 S37rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA6_Cpager_2,Cpager_2::rhs2_Rc_} + }// end of reduce table +}; +yacco2::State S37_Cpager_2 = //State's vectored into symbol: "w" +{37 +,0,0,0,0,0,(Reduce_tbl*)&S37rt_Cpager_2,0,0,0}; +struct S38rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S38rtd_Cpager_2 S38rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA6_Cpager_2,Cpager_2::rhs1_Rw_} + }// end of reduce table +}; +yacco2::State S38_Cpager_2 = //State's vectored into symbol: "Rc" +{38 +,0,0,0,0,0,(Reduce_tbl*)&S38rt_Cpager_2,0,0,0}; +struct S39std_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S39std_Cpager_2 S39st_Cpager_2 = { + 1 + , + {// start of table + {108,(State*)&S40_Cpager_2} // shift sym: raw_d + }// end of shift table +}; +yacco2::State S39_Cpager_2 = //State's vectored into symbol: "Ry" +{39 +,0,0,0,0,(Shift_tbl*)&S39st_Cpager_2,0,0,0,0}; +struct S40rtd_Cpager_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S40rtd_Cpager_2 S40rt_Cpager_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA7_Cpager_2,Cpager_2::rhs1_Rv_} + }// end of reduce table +}; +yacco2::State S40_Cpager_2 = //State's vectored into symbol: "d" +{40 +,0,0,0,0,0,(Reduce_tbl*)&S40rt_Cpager_2,0,0,0}; diff --git a/web/yacco2/grammar-testsuite/sp_1.cpp b/web/yacco2/grammar-testsuite/sp_1.cpp new file mode 100644 index 0000000000..386b362981 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_1.cpp @@ -0,0 +1,75 @@ +/* + File: sp_1.cpp + Date and Time: Sat Jan 31 11:58:53 2015 +*/ +#include "sp_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_sp_1;// grammar's ns +// first set terminals +fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ + no_rules_entries_ = 4; + per_rule_s_table_[0] = new Per_rule_s_reuse_table(); + per_rule_s_table_[1] = new Per_rule_s_reuse_table(); + per_rule_s_table_[2] = new Per_rule_s_reuse_table(); + per_rule_s_table_[3] = new Per_rule_s_reuse_table(); +} + Csp_1:: + Csp_1() + :yacco2::CAbs_fsm + ("sp_1.lex" + ,"1.0" + ,"7 mar 2014" + ,false + ,"Test out Spector LR(1) resolution from page 64." + ,"Sat Jan 31 11:58:53 2015 " + ,S1_Csp_1){ + + } + +Csp_1::~Csp_1(){ + + for(int x = 0;x < 4;++x){ + ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; + } +} + + bool Csp_1::failed(){ + return false; + } + void Csp_1::op(){ +} +int Csp_1::rhs_to_rules_mapping_[8] = { + -1 + ,0 // subrule 1 for rule 1 + ,1 // subrule 2 for rule 2 + ,1 // subrule 3 for rule 2 + ,2 // subrule 4 for rule 3 + ,2 // subrule 5 for rule 3 + ,3 // subrule 6 for rule 4 + ,3 // subrule 7 for rule 4 +}; +Rmm::Rmm(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rmm",0,Csp_1::R_Rmm_,P,false,false){ +} + +Rs::Rs(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs",0,Csp_1::R_Rs_,P,false,false){ +} + +Ra::Ra(yacco2::Parser* P) + :CAbs_lr1_sym + ("Ra",0,Csp_1::R_Ra_,P,false,false){ +} + +Rb::Rb(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rb",0,Csp_1::R_Rb_,P,false,false){ +} + diff --git a/web/yacco2/grammar-testsuite/sp_1.fsc b/web/yacco2/grammar-testsuite/sp_1.fsc new file mode 100644 index 0000000000..2e0ff8ba16 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_1.fsc @@ -0,0 +1,20 @@ +/* + File: sp_1.fsc + Date and Time: Sat Jan 31 11:58:53 2015 +*/ +transitive n +grammar-name "sp_1" +name-space "NS_sp_1" +thread-name "Csp_1" +monolithic y +file-name "sp_1.fsc" +no-of-T 569 +list-of-native-first-set-terminals 1 + raw_a +end-list-of-native-first-set-terminals +list-of-transitive-threads 0 +end-list-of-transitive-threads +list-of-used-threads 0 +end-list-of-used-threads +fsm-comments +"Test out Spector LR(1) resolution from page 64." diff --git a/web/yacco2/grammar-testsuite/sp_1.h b/web/yacco2/grammar-testsuite/sp_1.h new file mode 100644 index 0000000000..61328ce647 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_1.h @@ -0,0 +1,76 @@ +/* + File: sp_1.h + Date and Time: Sat Jan 31 11:58:53 2015 +*/ +#ifndef __sp_1_h__ +#define __sp_1_h__ 1 +#include "yacco2.h" +#include "yacco2_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "yacco2_err_symbols.h" +#include "yacco2_terminals.h" +#include "yacco2_characters.h" +// monolithic grammar: no thread +extern yacco2::State S1_Csp_1; +namespace NS_sp_1 { +using namespace NS_yacco2_T_enum;// enumerate +using namespace yacco2; +struct fsm_rules_reuse_table_type{ + fsm_rules_reuse_table_type(); + int no_rules_entries_; + Per_rule_s_reuse_table* per_rule_s_table_[4]; +}; +class Csp_1: public yacco2::CAbs_fsm { + public: + enum rules_and_subrules{ + start_of_rule_list = NS_yacco2_T_enum::T_Enum::sum_total_T + ,R_Rmm_ = 569//start_of_rule_list + 0 + ,rhs1_Rmm_ = 1 + ,R_Rs_ = 570//start_of_rule_list + 2 + ,rhs1_Rs_ = 2 + ,rhs2_Rs_ = 3 + ,R_Ra_ = 571//start_of_rule_list + 4 + ,rhs1_Ra_ = 4 + ,rhs2_Ra_ = 5 + ,R_Rb_ = 572//start_of_rule_list + 6 + ,rhs1_Rb_ = 6 + ,rhs2_Rb_ = 7 + }; + //no of la sets = 4 + //no of states = 17 + Csp_1(); + ~Csp_1(); + void op(); + bool failed(); + void reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule); + fsm_rules_reuse_table_type fsm_rules_reuse_table; + static int rhs_to_rules_mapping_[8]; + }; +struct Rmm; +struct Rs; +struct Ra; +struct Rb; +struct Rmm:public yacco2::CAbs_lr1_sym { + Rmm(yacco2::Parser* P); + public: +}; + +struct Rs:public yacco2::CAbs_lr1_sym { + Rs(yacco2::Parser* P); + public: +}; + +struct Ra:public yacco2::CAbs_lr1_sym { + Ra(yacco2::Parser* P); + public: +}; + +struct Rb:public yacco2::CAbs_lr1_sym { + Rb(yacco2::Parser* P); + public: +}; + +} // end of namespace + +#endif diff --git a/web/yacco2/grammar-testsuite/sp_1.lex b/web/yacco2/grammar-testsuite/sp_1.lex new file mode 100644 index 0000000000..4acf0be476 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_1.lex @@ -0,0 +1,40 @@ +/* +Author: Dave Bone +FILE: sp_1.lex +Date: 7 mar 2014 +Purpose: Test out compiler/compiler with Kristensen and Madsen grammar - lalr resolution +*/ +/@ +@** Spector Grammar.\fbreak +David Spector\fbreak +Full LR(1) Parser Generator ACM Sigplan Notices, 16(8), August 1981.\fbreak +Test out LR(1) resolution - page 64. +@/ +fsm +(fsm-id "sp_1.lex",fsm-filename sp_1,fsm-namespace NS_sp_1 +,fsm-class Csp_1 +,fsm-version "1.0",fsm-date "7 mar 2014",fsm-debug "false" +,fsm-comments "Test out Spector LR(1) resolution from page 64.") +@"/usr/local/yacco2/compiler/grammars/yacco2_T_includes.T" + +rules{ + +Rmm(){ + -> Rs eog +} + +Rs(){ + -> Ra b + -> Rb c +} + +Ra(){ + -> a Ra c + -> a +} + +Rb(){ + -> a Rb b + -> a +} +} diff --git a/web/yacco2/grammar-testsuite/sp_1.pdf b/web/yacco2/grammar-testsuite/sp_1.pdf Binary files differnew file mode 100644 index 0000000000..a4b3b2dac1 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_1.pdf diff --git a/web/yacco2/grammar-testsuite/sp_1_idx.pdf b/web/yacco2/grammar-testsuite/sp_1_idx.pdf Binary files differnew file mode 100644 index 0000000000..53855b49a7 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_1_idx.pdf diff --git a/web/yacco2/grammar-testsuite/sp_1sym.cpp b/web/yacco2/grammar-testsuite/sp_1sym.cpp new file mode 100644 index 0000000000..187e402c6a --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_1sym.cpp @@ -0,0 +1,125 @@ +/* + File: sp_1sym.cpp + Date and Time: Sat Jan 31 11:58:53 2015 +*/ +#include "sp_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_sp_1;// grammar's ns +// first set terminals +// monolithic grammar --- no thread +void +Csp_1::reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule){ + int reducing_rule = rhs_to_rules_mapping_[Sub_rule_no]; + Per_rule_s_reuse_table* rule_reuse_tbl_ptr = + fsm_rules_reuse_table.per_rule_s_table_[reducing_rule]; + Rule_s_reuse_entry* re(0); + find_a_recycled_rule(rule_reuse_tbl_ptr,&re); + (*Recycled_rule) = re; + fnd_re: switch (Sub_rule_no){ + case rhs1_Rmm_:{ + Rmm* sym; + if(re->rule_ == 0){ + sym = new Rmm(parser__); + re->rule_ = sym; + }else{ + sym = (Rmm*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs2_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Ra_:{ + Ra* sym; + if(re->rule_ == 0){ + sym = new Ra(parser__); + re->rule_ = sym; + }else{ + sym = (Ra*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs2_Ra_:{ + Ra* sym; + if(re->rule_ == 0){ + sym = new Ra(parser__); + re->rule_ = sym; + }else{ + sym = (Ra*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Rb_:{ + Rb* sym; + if(re->rule_ == 0){ + sym = new Rb(parser__); + re->rule_ = sym; + }else{ + sym = (Rb*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs2_Rb_:{ + Rb* sym; + if(re->rule_ == 0){ + sym = new Rb(parser__); + re->rule_ = sym; + }else{ + sym = (Rb*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + default: return; + } +} diff --git a/web/yacco2/grammar-testsuite/sp_1tbl.cpp b/web/yacco2/grammar-testsuite/sp_1tbl.cpp new file mode 100644 index 0000000000..278c35a12b --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_1tbl.cpp @@ -0,0 +1,320 @@ +/* + File: sp_1tbl.cpp + Date and Time: Sat Jan 31 11:58:53 2015 +*/ +#include "sp_1.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_sp_1;// grammar's ns +// first set terminals +// raw_b +yacco2::UCHAR LA1_Csp_1[] ={ +1 +,13,4 +}; +// raw_c +yacco2::UCHAR LA2_Csp_1[] ={ +1 +,13,8 +}; +// LR1_eolr +yacco2::UCHAR LA3_Csp_1[] ={ +1 +,0,4 +}; +// LR1_eog +yacco2::UCHAR LA4_Csp_1[] ={ +1 +,0,2 +}; +extern yacco2::State S1_Csp_1; +extern yacco2::State S2_Csp_1; +extern yacco2::State S3_Csp_1; +extern yacco2::State S4_Csp_1; +extern yacco2::State S5_Csp_1; +extern yacco2::State S6_Csp_1; +extern yacco2::State S7_Csp_1; +extern yacco2::State S8_Csp_1; +extern yacco2::State S9_Csp_1; +extern yacco2::State S10_Csp_1; +extern yacco2::State S11_Csp_1; +extern yacco2::State S12_Csp_1; +extern yacco2::State S13_Csp_1; +extern yacco2::State S14_Csp_1; +extern yacco2::State S15_Csp_1; +extern yacco2::State S16_Csp_1; +extern yacco2::State S17_Csp_1; +struct S1std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[5]; +}; +S1std_Csp_1 S1st_Csp_1 = { + 5 + , + {// start of table + {105,(State*)&S2_Csp_1} // shift sym: raw_a + ,{569,(State*)&S1_Csp_1} // accept sym: Rmm + ,{570,(State*)&S7_Csp_1} // shift sym: Rs + ,{571,(State*)&S9_Csp_1} // shift sym: Ra + ,{572,(State*)&S11_Csp_1} // shift sym: Rb + }// end of shift table +}; +yacco2::State S1_Csp_1 = //State's vectored into symbol: " No symbol" +{1 +,0,0,0,0,(Shift_tbl*)&S1st_Csp_1,0,0,0,0}; +struct S2std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S2std_Csp_1 S2st_Csp_1 = { + 3 + , + {// start of table + {105,(State*)&S13_Csp_1} // shift sym: raw_a + ,{571,(State*)&S3_Csp_1} // shift sym: Ra + ,{572,(State*)&S5_Csp_1} // shift sym: Rb + }// end of shift table +}; +struct S2rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[2]; +}; +S2rtd_Csp_1 S2rt_Csp_1 = { + 2 + , + {// start of table + {(Set_tbl*)&LA1_Csp_1,Csp_1::rhs2_Ra_} + ,{(Set_tbl*)&LA2_Csp_1,Csp_1::rhs2_Rb_} + }// end of reduce table +}; +yacco2::State S2_Csp_1 = //State's vectored into symbol: "a" +{2 +,0,0,0,0,(Shift_tbl*)&S2st_Csp_1,(Reduce_tbl*)&S2rt_Csp_1,0,0,0}; +struct S3std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S3std_Csp_1 S3st_Csp_1 = { + 1 + , + {// start of table + {107,(State*)&S4_Csp_1} // shift sym: raw_c + }// end of shift table +}; +yacco2::State S3_Csp_1 = //State's vectored into symbol: "Ra" +{3 +,0,0,0,0,(Shift_tbl*)&S3st_Csp_1,0,0,0,0}; +struct S4rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S4rtd_Csp_1 S4rt_Csp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Csp_1,Csp_1::rhs1_Ra_} + }// end of reduce table +}; +yacco2::State S4_Csp_1 = //State's vectored into symbol: "c" +{4 +,0,0,0,0,0,(Reduce_tbl*)&S4rt_Csp_1,0,0,0}; +struct S5std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S5std_Csp_1 S5st_Csp_1 = { + 1 + , + {// start of table + {106,(State*)&S6_Csp_1} // shift sym: raw_b + }// end of shift table +}; +yacco2::State S5_Csp_1 = //State's vectored into symbol: "Rb" +{5 +,0,0,0,0,(Shift_tbl*)&S5st_Csp_1,0,0,0,0}; +struct S6rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S6rtd_Csp_1 S6rt_Csp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Csp_1,Csp_1::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S6_Csp_1 = //State's vectored into symbol: "b" +{6 +,0,0,0,0,0,(Reduce_tbl*)&S6rt_Csp_1,0,0,0}; +struct S7std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S7std_Csp_1 S7st_Csp_1 = { + 1 + , + {// start of table + {1,(State*)&S8_Csp_1} // shift sym: LR1_eog + }// end of shift table +}; +yacco2::State S7_Csp_1 = //State's vectored into symbol: "Rs" +{7 +,0,0,0,0,(Shift_tbl*)&S7st_Csp_1,0,0,0,0}; +struct S8rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S8rtd_Csp_1 S8rt_Csp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA3_Csp_1,Csp_1::rhs1_Rmm_} + }// end of reduce table +}; +yacco2::State S8_Csp_1 = //State's vectored into symbol: "eog" +{8 +,0,0,0,0,0,(Reduce_tbl*)&S8rt_Csp_1,0,0,0}; +struct S9std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S9std_Csp_1 S9st_Csp_1 = { + 1 + , + {// start of table + {106,(State*)&S10_Csp_1} // shift sym: raw_b + }// end of shift table +}; +yacco2::State S9_Csp_1 = //State's vectored into symbol: "Ra" +{9 +,0,0,0,0,(Shift_tbl*)&S9st_Csp_1,0,0,0,0}; +struct S10rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S10rtd_Csp_1 S10rt_Csp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Csp_1,Csp_1::rhs1_Rs_} + }// end of reduce table +}; +yacco2::State S10_Csp_1 = //State's vectored into symbol: "b" +{10 +,0,0,0,0,0,(Reduce_tbl*)&S10rt_Csp_1,0,0,0}; +struct S11std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S11std_Csp_1 S11st_Csp_1 = { + 1 + , + {// start of table + {107,(State*)&S12_Csp_1} // shift sym: raw_c + }// end of shift table +}; +yacco2::State S11_Csp_1 = //State's vectored into symbol: "Rb" +{11 +,0,0,0,0,(Shift_tbl*)&S11st_Csp_1,0,0,0,0}; +struct S12rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S12rtd_Csp_1 S12rt_Csp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA4_Csp_1,Csp_1::rhs2_Rs_} + }// end of reduce table +}; +yacco2::State S12_Csp_1 = //State's vectored into symbol: "c" +{12 +,0,0,0,0,0,(Reduce_tbl*)&S12rt_Csp_1,0,0,0}; +struct S13std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S13std_Csp_1 S13st_Csp_1 = { + 3 + , + {// start of table + {105,(State*)&S13_Csp_1} // shift sym: raw_a + ,{571,(State*)&S14_Csp_1} // shift sym: Ra + ,{572,(State*)&S16_Csp_1} // shift sym: Rb + }// end of shift table +}; +struct S13rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[2]; +}; +S13rtd_Csp_1 S13rt_Csp_1 = { + 2 + , + {// start of table + {(Set_tbl*)&LA2_Csp_1,Csp_1::rhs2_Ra_} + ,{(Set_tbl*)&LA1_Csp_1,Csp_1::rhs2_Rb_} + }// end of reduce table +}; +yacco2::State S13_Csp_1 = //State's vectored into symbol: "a" +{13 +,0,0,0,0,(Shift_tbl*)&S13st_Csp_1,(Reduce_tbl*)&S13rt_Csp_1,0,0,0}; +struct S14std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S14std_Csp_1 S14st_Csp_1 = { + 1 + , + {// start of table + {107,(State*)&S15_Csp_1} // shift sym: raw_c + }// end of shift table +}; +yacco2::State S14_Csp_1 = //State's vectored into symbol: "Ra" +{14 +,0,0,0,0,(Shift_tbl*)&S14st_Csp_1,0,0,0,0}; +struct S15rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S15rtd_Csp_1 S15rt_Csp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Csp_1,Csp_1::rhs1_Ra_} + }// end of reduce table +}; +yacco2::State S15_Csp_1 = //State's vectored into symbol: "c" +{15 +,0,0,0,0,0,(Reduce_tbl*)&S15rt_Csp_1,0,0,0}; +struct S16std_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S16std_Csp_1 S16st_Csp_1 = { + 1 + , + {// start of table + {106,(State*)&S17_Csp_1} // shift sym: raw_b + }// end of shift table +}; +yacco2::State S16_Csp_1 = //State's vectored into symbol: "Rb" +{16 +,0,0,0,0,(Shift_tbl*)&S16st_Csp_1,0,0,0,0}; +struct S17rtd_Csp_1{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S17rtd_Csp_1 S17rt_Csp_1 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Csp_1,Csp_1::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S17_Csp_1 = //State's vectored into symbol: "b" +{17 +,0,0,0,0,0,(Reduce_tbl*)&S17rt_Csp_1,0,0,0}; diff --git a/web/yacco2/grammar-testsuite/sp_2.cpp b/web/yacco2/grammar-testsuite/sp_2.cpp new file mode 100644 index 0000000000..6e8ea8576c --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_2.cpp @@ -0,0 +1,75 @@ +/* + File: sp_2.cpp + Date and Time: Sat Jan 31 11:58:57 2015 +*/ +#include "sp_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_sp_2;// grammar's ns +// first set terminals +fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ + no_rules_entries_ = 4; + per_rule_s_table_[0] = new Per_rule_s_reuse_table(); + per_rule_s_table_[1] = new Per_rule_s_reuse_table(); + per_rule_s_table_[2] = new Per_rule_s_reuse_table(); + per_rule_s_table_[3] = new Per_rule_s_reuse_table(); +} + Csp_2:: + Csp_2() + :yacco2::CAbs_fsm + ("sp_2.lex" + ,"1.0" + ,"7 mar 2014" + ,false + ,"Test out Spector LR(1) resolution page 61." + ,"Sat Jan 31 11:58:57 2015 " + ,S1_Csp_2){ + + } + +Csp_2::~Csp_2(){ + + for(int x = 0;x < 4;++x){ + ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; + } +} + + bool Csp_2::failed(){ + return false; + } + void Csp_2::op(){ +} +int Csp_2::rhs_to_rules_mapping_[8] = { + -1 + ,0 // subrule 1 for rule 1 + ,1 // subrule 2 for rule 2 + ,1 // subrule 3 for rule 2 + ,1 // subrule 4 for rule 2 + ,1 // subrule 5 for rule 2 + ,2 // subrule 6 for rule 3 + ,3 // subrule 7 for rule 4 +}; +Rg::Rg(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rg",0,Csp_2::R_Rg_,P,false,false){ +} + +Rs::Rs(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rs",0,Csp_2::R_Rs_,P,false,false){ +} + +Ra::Ra(yacco2::Parser* P) + :CAbs_lr1_sym + ("Ra",0,Csp_2::R_Ra_,P,false,false){ +} + +Rb::Rb(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rb",0,Csp_2::R_Rb_,P,false,false){ +} + diff --git a/web/yacco2/grammar-testsuite/sp_2.fsc b/web/yacco2/grammar-testsuite/sp_2.fsc new file mode 100644 index 0000000000..04643b40a5 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_2.fsc @@ -0,0 +1,21 @@ +/* + File: sp_2.fsc + Date and Time: Sat Jan 31 11:58:57 2015 +*/ +transitive n +grammar-name "sp_2" +name-space "NS_sp_2" +thread-name "Csp_2" +monolithic y +file-name "sp_2.fsc" +no-of-T 569 +list-of-native-first-set-terminals 2 + raw_a + raw_b +end-list-of-native-first-set-terminals +list-of-transitive-threads 0 +end-list-of-transitive-threads +list-of-used-threads 0 +end-list-of-used-threads +fsm-comments +"Test out Spector LR(1) resolution page 61." diff --git a/web/yacco2/grammar-testsuite/sp_2.h b/web/yacco2/grammar-testsuite/sp_2.h new file mode 100644 index 0000000000..2f46c71613 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_2.h @@ -0,0 +1,76 @@ +/* + File: sp_2.h + Date and Time: Sat Jan 31 11:58:57 2015 +*/ +#ifndef __sp_2_h__ +#define __sp_2_h__ 1 +#include "yacco2.h" +#include "yacco2_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "yacco2_err_symbols.h" +#include "yacco2_terminals.h" +#include "yacco2_characters.h" +// monolithic grammar: no thread +extern yacco2::State S1_Csp_2; +namespace NS_sp_2 { +using namespace NS_yacco2_T_enum;// enumerate +using namespace yacco2; +struct fsm_rules_reuse_table_type{ + fsm_rules_reuse_table_type(); + int no_rules_entries_; + Per_rule_s_reuse_table* per_rule_s_table_[4]; +}; +class Csp_2: public yacco2::CAbs_fsm { + public: + enum rules_and_subrules{ + start_of_rule_list = NS_yacco2_T_enum::T_Enum::sum_total_T + ,R_Rg_ = 569//start_of_rule_list + 0 + ,rhs1_Rg_ = 1 + ,R_Rs_ = 570//start_of_rule_list + 2 + ,rhs1_Rs_ = 2 + ,rhs2_Rs_ = 3 + ,rhs3_Rs_ = 4 + ,rhs4_Rs_ = 5 + ,R_Ra_ = 571//start_of_rule_list + 4 + ,rhs1_Ra_ = 6 + ,R_Rb_ = 572//start_of_rule_list + 6 + ,rhs1_Rb_ = 7 + }; + //no of la sets = 4 + //no of states = 15 + Csp_2(); + ~Csp_2(); + void op(); + bool failed(); + void reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule); + fsm_rules_reuse_table_type fsm_rules_reuse_table; + static int rhs_to_rules_mapping_[8]; + }; +struct Rg; +struct Rs; +struct Ra; +struct Rb; +struct Rg:public yacco2::CAbs_lr1_sym { + Rg(yacco2::Parser* P); + public: +}; + +struct Rs:public yacco2::CAbs_lr1_sym { + Rs(yacco2::Parser* P); + public: +}; + +struct Ra:public yacco2::CAbs_lr1_sym { + Ra(yacco2::Parser* P); + public: +}; + +struct Rb:public yacco2::CAbs_lr1_sym { + Rb(yacco2::Parser* P); + public: +}; + +} // end of namespace + +#endif diff --git a/web/yacco2/grammar-testsuite/sp_2.lex b/web/yacco2/grammar-testsuite/sp_2.lex new file mode 100644 index 0000000000..130feb53ad --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_2.lex @@ -0,0 +1,40 @@ +/* +Author: Dave Bone +FILE: sp_2.lex +Date: 7 mar 2014 +Purpose: Test out Spector lr(1) resolution page 61 +*/ +/@ +@** Spector Grammar.\fbreak +David Spector\fbreak +Full LR(1) Parser Generator ACM Sigplan Notices, 16(8), August 1981.\fbreak +Test out LR(1) resolution page 61. +@/ +fsm +(fsm-id "sp_2.lex",fsm-filename sp_2,fsm-namespace NS_sp_2 +,fsm-class Csp_2 +,fsm-version "1.0",fsm-date "7 mar 2014",fsm-debug "false" +,fsm-comments "Test out Spector LR(1) resolution page 61.") +@"/usr/local/yacco2/compiler/grammars/yacco2_T_includes.T" + +rules{ + +Rg(){ + -> Rs eog +} + +Rs(){ + -> a Ra c + -> a Rb d + -> b Ra d + -> b Rb c +} + +Ra(){ + -> f +} + +Rb(){ + -> f +} +} diff --git a/web/yacco2/grammar-testsuite/sp_2.pdf b/web/yacco2/grammar-testsuite/sp_2.pdf Binary files differnew file mode 100644 index 0000000000..dad7e8928b --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_2.pdf diff --git a/web/yacco2/grammar-testsuite/sp_2_idx.pdf b/web/yacco2/grammar-testsuite/sp_2_idx.pdf Binary files differnew file mode 100644 index 0000000000..4a3abd708d --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_2_idx.pdf diff --git a/web/yacco2/grammar-testsuite/sp_2sym.cpp b/web/yacco2/grammar-testsuite/sp_2sym.cpp new file mode 100644 index 0000000000..7869a8aea5 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_2sym.cpp @@ -0,0 +1,125 @@ +/* + File: sp_2sym.cpp + Date and Time: Sat Jan 31 11:58:57 2015 +*/ +#include "sp_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_sp_2;// grammar's ns +// first set terminals +// monolithic grammar --- no thread +void +Csp_2::reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule){ + int reducing_rule = rhs_to_rules_mapping_[Sub_rule_no]; + Per_rule_s_reuse_table* rule_reuse_tbl_ptr = + fsm_rules_reuse_table.per_rule_s_table_[reducing_rule]; + Rule_s_reuse_entry* re(0); + find_a_recycled_rule(rule_reuse_tbl_ptr,&re); + (*Recycled_rule) = re; + fnd_re: switch (Sub_rule_no){ + case rhs1_Rg_:{ + Rg* sym; + if(re->rule_ == 0){ + sym = new Rg(parser__); + re->rule_ = sym; + }else{ + sym = (Rg*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs2_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs3_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs4_Rs_:{ + Rs* sym; + if(re->rule_ == 0){ + sym = new Rs(parser__); + re->rule_ = sym; + }else{ + sym = (Rs*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 3; + + + return;} + case rhs1_Ra_:{ + Ra* sym; + if(re->rule_ == 0){ + sym = new Ra(parser__); + re->rule_ = sym; + }else{ + sym = (Ra*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Rb_:{ + Rb* sym; + if(re->rule_ == 0){ + sym = new Rb(parser__); + re->rule_ = sym; + }else{ + sym = (Rb*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + default: return; + } +} diff --git a/web/yacco2/grammar-testsuite/sp_2tbl.cpp b/web/yacco2/grammar-testsuite/sp_2tbl.cpp new file mode 100644 index 0000000000..6bc32de307 --- /dev/null +++ b/web/yacco2/grammar-testsuite/sp_2tbl.cpp @@ -0,0 +1,267 @@ +/* + File: sp_2tbl.cpp + Date and Time: Sat Jan 31 11:58:57 2015 +*/ +#include "sp_2.h" +using namespace NS_yacco2_T_enum;// enumerate +using namespace NS_yacco2_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_yacco2_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_sp_2;// grammar's ns +// first set terminals +// LR1_eog +yacco2::UCHAR LA1_Csp_2[] ={ +1 +,0,2 +}; +// LR1_eolr +yacco2::UCHAR LA2_Csp_2[] ={ +1 +,0,4 +}; +// raw_c +yacco2::UCHAR LA3_Csp_2[] ={ +1 +,13,8 +}; +// raw_d +yacco2::UCHAR LA4_Csp_2[] ={ +1 +,13,16 +}; +extern yacco2::State S1_Csp_2; +extern yacco2::State S2_Csp_2; +extern yacco2::State S3_Csp_2; +extern yacco2::State S4_Csp_2; +extern yacco2::State S5_Csp_2; +extern yacco2::State S6_Csp_2; +extern yacco2::State S7_Csp_2; +extern yacco2::State S8_Csp_2; +extern yacco2::State S9_Csp_2; +extern yacco2::State S10_Csp_2; +extern yacco2::State S11_Csp_2; +extern yacco2::State S12_Csp_2; +extern yacco2::State S13_Csp_2; +extern yacco2::State S14_Csp_2; +extern yacco2::State S15_Csp_2; +struct S1std_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[4]; +}; +S1std_Csp_2 S1st_Csp_2 = { + 4 + , + {// start of table + {105,(State*)&S2_Csp_2} // shift sym: raw_a + ,{106,(State*)&S7_Csp_2} // shift sym: raw_b + ,{569,(State*)&S1_Csp_2} // accept sym: Rg + ,{570,(State*)&S12_Csp_2} // shift sym: Rs + }// end of shift table +}; +yacco2::State S1_Csp_2 = //State's vectored into symbol: " No symbol" +{1 +,0,0,0,0,(Shift_tbl*)&S1st_Csp_2,0,0,0,0}; +struct S2std_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S2std_Csp_2 S2st_Csp_2 = { + 3 + , + {// start of table + {110,(State*)&S14_Csp_2} // shift sym: raw_f + ,{571,(State*)&S3_Csp_2} // shift sym: Ra + ,{572,(State*)&S5_Csp_2} // shift sym: Rb + }// end of shift table +}; +yacco2::State S2_Csp_2 = //State's vectored into symbol: "a" +{2 +,0,0,0,0,(Shift_tbl*)&S2st_Csp_2,0,0,0,0}; +struct S3std_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S3std_Csp_2 S3st_Csp_2 = { + 1 + , + {// start of table + {107,(State*)&S4_Csp_2} // shift sym: raw_c + }// end of shift table +}; +yacco2::State S3_Csp_2 = //State's vectored into symbol: "Ra" +{3 +,0,0,0,0,(Shift_tbl*)&S3st_Csp_2,0,0,0,0}; +struct S4rtd_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S4rtd_Csp_2 S4rt_Csp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Csp_2,Csp_2::rhs1_Rs_} + }// end of reduce table +}; +yacco2::State S4_Csp_2 = //State's vectored into symbol: "c" +{4 +,0,0,0,0,0,(Reduce_tbl*)&S4rt_Csp_2,0,0,0}; +struct S5std_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S5std_Csp_2 S5st_Csp_2 = { + 1 + , + {// start of table + {108,(State*)&S6_Csp_2} // shift sym: raw_d + }// end of shift table +}; +yacco2::State S5_Csp_2 = //State's vectored into symbol: "Rb" +{5 +,0,0,0,0,(Shift_tbl*)&S5st_Csp_2,0,0,0,0}; +struct S6rtd_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S6rtd_Csp_2 S6rt_Csp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Csp_2,Csp_2::rhs2_Rs_} + }// end of reduce table +}; +yacco2::State S6_Csp_2 = //State's vectored into symbol: "d" +{6 +,0,0,0,0,0,(Reduce_tbl*)&S6rt_Csp_2,0,0,0}; +struct S7std_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[3]; +}; +S7std_Csp_2 S7st_Csp_2 = { + 3 + , + {// start of table + {110,(State*)&S15_Csp_2} // shift sym: raw_f + ,{571,(State*)&S8_Csp_2} // shift sym: Ra + ,{572,(State*)&S10_Csp_2} // shift sym: Rb + }// end of shift table +}; +yacco2::State S7_Csp_2 = //State's vectored into symbol: "b" +{7 +,0,0,0,0,(Shift_tbl*)&S7st_Csp_2,0,0,0,0}; +struct S8std_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S8std_Csp_2 S8st_Csp_2 = { + 1 + , + {// start of table + {108,(State*)&S9_Csp_2} // shift sym: raw_d + }// end of shift table +}; +yacco2::State S8_Csp_2 = //State's vectored into symbol: "Ra" +{8 +,0,0,0,0,(Shift_tbl*)&S8st_Csp_2,0,0,0,0}; +struct S9rtd_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S9rtd_Csp_2 S9rt_Csp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Csp_2,Csp_2::rhs3_Rs_} + }// end of reduce table +}; +yacco2::State S9_Csp_2 = //State's vectored into symbol: "d" +{9 +,0,0,0,0,0,(Reduce_tbl*)&S9rt_Csp_2,0,0,0}; +struct S10std_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S10std_Csp_2 S10st_Csp_2 = { + 1 + , + {// start of table + {107,(State*)&S11_Csp_2} // shift sym: raw_c + }// end of shift table +}; +yacco2::State S10_Csp_2 = //State's vectored into symbol: "Rb" +{10 +,0,0,0,0,(Shift_tbl*)&S10st_Csp_2,0,0,0,0}; +struct S11rtd_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S11rtd_Csp_2 S11rt_Csp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Csp_2,Csp_2::rhs4_Rs_} + }// end of reduce table +}; +yacco2::State S11_Csp_2 = //State's vectored into symbol: "c" +{11 +,0,0,0,0,0,(Reduce_tbl*)&S11rt_Csp_2,0,0,0}; +struct S12std_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[1]; +}; +S12std_Csp_2 S12st_Csp_2 = { + 1 + , + {// start of table + {1,(State*)&S13_Csp_2} // shift sym: LR1_eog + }// end of shift table +}; +yacco2::State S12_Csp_2 = //State's vectored into symbol: "Rs" +{12 +,0,0,0,0,(Shift_tbl*)&S12st_Csp_2,0,0,0,0}; +struct S13rtd_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S13rtd_Csp_2 S13rt_Csp_2 = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Csp_2,Csp_2::rhs1_Rg_} + }// end of reduce table +}; +yacco2::State S13_Csp_2 = //State's vectored into symbol: "eog" +{13 +,0,0,0,0,0,(Reduce_tbl*)&S13rt_Csp_2,0,0,0}; +struct S14rtd_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[2]; +}; +S14rtd_Csp_2 S14rt_Csp_2 = { + 2 + , + {// start of table + {(Set_tbl*)&LA3_Csp_2,Csp_2::rhs1_Ra_} + ,{(Set_tbl*)&LA4_Csp_2,Csp_2::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S14_Csp_2 = //State's vectored into symbol: "f" +{14 +,0,0,0,0,0,(Reduce_tbl*)&S14rt_Csp_2,0,0,0}; +struct S15rtd_Csp_2{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[2]; +}; +S15rtd_Csp_2 S15rt_Csp_2 = { + 2 + , + {// start of table + {(Set_tbl*)&LA4_Csp_2,Csp_2::rhs1_Ra_} + ,{(Set_tbl*)&LA3_Csp_2,Csp_2::rhs1_Rb_} + }// end of reduce table +}; +yacco2::State S15_Csp_2 = //State's vectored into symbol: "f" +{15 +,0,0,0,0,0,(Reduce_tbl*)&S15rt_Csp_2,0,0,0}; diff --git a/web/yacco2/grammar-testsuite/test-out-grammars.sh b/web/yacco2/grammar-testsuite/test-out-grammars.sh new file mode 100755 index 0000000000..72bdf396d7 --- /dev/null +++ b/web/yacco2/grammar-testsuite/test-out-grammars.sh @@ -0,0 +1,120 @@ +#! /bin/sh +#file: test-out-grammars.bat +# verify that o2 works against some lr(0), lr(1), and lalr(1) grammars +#o2=/mnt/c2d0s0/yacco2/bin/o2 +# parms: -t -err +o2=/usr/local/yacco2/bin/o2 +tmp=/tmp/o2 +if [ ! -e "$tmp" ] +then + mkdir $tmp +fi +cd $tmp +prt_pdf=0 +delete_files=1 +cont=n +ccresult=0 + +sw1=$1 +sw2=$2 +sw3=$3 +sw4=$4 + +file_no=$((0)) +file_pos=$((1)) +cc_lex() +{ + file_name_only="`basename $2`" + dir_only="`dirname $2`" + #echo "%%%%%%%%%%%%%%%%target directory $dir_only" + eval "$o2 $sw1 $sw2 $sw3 $sw4 $1" + if test $ccresult -eq 1; then + echo -n "grammar in error: continue y or n: "; + read cont; + if test $cont -eq n; then + echo "Error in grammar exiting"; + exit 1; + fi + fi + for j in $sw1 $sw2 $sw3 $sw4 + do + case $j in + *p) + eval "mpost $file_name_only.mp" + eval "cweave $file_name_only.w" + eval "pdftex $file_name_only.tex" + xref="$file_name_only""_idx" + echo "%%%%%%%%%%%%%%%%% index file: $xref to cweave and pdftex" + eval "cweave $xref.w" + eval "pdftex $xref.tex" + pdftops "$file_name_only.pdf" + pdftops "$xref"".pdf" + esac + done +if test $delete_files -eq 1; then + for k in `ls * `; + do + #echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!Casing on $k" + case $k in + *.cpp|*.h) + eval "cp $k $dir_only/$k"; + #echo "-----Copying--------> $k to $dir_only/$k" + eval "rm -f $k" +;; + *.fsc) + eval "cp $k $dir_only/$k"; + #echo "-------------> Deleting $k" + eval "rm -f $k" ;; + *.scn|*.idx|*.log|*.toc) + #echo "-------------> Deleting $k" + eval "rm -f $k" +;; + Err.w|T.w) # error and terminal documents to be cweave then pdftex printed by xpdf + #echo "-------------> Deleting $k" + #eval "rm -f $k" eof +;; + *.w) + #echo "-------------> Deleting $k" + #eval "rm -f $k" +;; + *.tex) + #echo "-------------> Deleting $k" + eval "rm -f $k" +;; + *.mp) + #echo "-------------> Deleting $k" + #eval "rm -f $k" +;; + *.tex1) + #echo "-------------> Deleting $k" + eval "rm -f $k" +;; + *.[1-9]) + #echo "-------------> Deleting Mpost diagrams $k" + ##eval "rm -f $k" +;; + *.[1-9][0-9]*) + #echo "-------------> Deleting Mpost diagrams $k" + ##eval "rm -f $k" + ;; + esac + done +fi +} + +for i in `find /usr/local/yacco2/grammar-testsuite | grep '.*\.lex$'`; +do + echo "==========> Test Grammar to compile: $i" + file_no=$((++file_no)) + if test $((file_no)) -ge $((file_pos)); then + file_no_ext=${i%%.*} + cc_lex $i $file_no_ext + fi +done + +echo "==========> Run testout program against some data files" +cd /usr/local/yacco2/grammar-testsuite +./testout testout_1.dat +./testout testout_2.dat +./testout testout_3.dat +./testout xxxx
\ No newline at end of file diff --git a/web/yacco2/grammar-testsuite/testout b/web/yacco2/grammar-testsuite/testout Binary files differnew file mode 100755 index 0000000000..46b0bcbce6 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout diff --git a/web/yacco2/grammar-testsuite/testout.cpp b/web/yacco2/grammar-testsuite/testout.cpp new file mode 100644 index 0000000000..142bc1d8eb --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout.cpp @@ -0,0 +1,171 @@ +/*14:*/ +#line 212 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +/*2:*/ +#line 54 "/usr/local//yacco2/grammar-testsuite/testout_comments.w" + +/*3:*/ +#line 11 "/usr/local//yacco2/grammar-testsuite/testout_includes.w" + +#include "testout.h" + +/*:3*/ +#line 55 "/usr/local//yacco2/grammar-testsuite/testout_comments.w" +; + +#line 1 "/usr/local//yacco2/grammar-testsuite/testout_includes.w" + + + + + + + +/*:2*//*5:*/ +#line 13 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +#define Max_buf_size 2*1024 +std::string Holding_file("testout_holding_file.cmd"); +std::string To_parse_file; + +YACCO2_define_trace_variables(); +yacco2::TOKEN_GAGGLE JUNK_tokens; +yacco2::TOKEN_GAGGLE IP_tokens; +yacco2::TOKEN_GAGGLE Error_queue; + +/*:5*//*7:*/ +#line 64 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +void GET_CMD_LINE(int argc,char*argv[] +,const char*Holding +,std::string&File_to_parse +,yacco2::TOKEN_GAGGLE&Errors) +{ +using namespace std; +using namespace NS_testout_err_symbols; +using namespace yacco2; +ofstream ofile; +ofile.open(Holding,ios_base::out|ios::trunc); +if(!ofile){ +CAbs_lr1_sym*sym= new Err_bad_filename(Holding); +sym->set_external_file_id(1); +sym->set_line_no(1); +sym->set_pos_in_line(1); +Errors.push_back(*sym); +return; +} +if(argc==1){ +char cmd_line[Max_buf_size]; +cout<<"Please enter Command line to process: "; +cin.get(cmd_line,Max_buf_size,'\n'); +ofile<<cmd_line; +File_to_parse+= cmd_line; +ofile.close(); +}else{ +for(int x= 1;x<argc;++x){ +ofile<<argv[x]; +File_to_parse+= argv[x]; +} +ofile.close(); +} +tok_can<std::ifstream> Cmd1_tokens(Holding); +ifstream ifile; +ifile.open(File_to_parse.c_str()); +if(!ifile){ +CAbs_lr1_sym*sym= new Err_bad_filename(File_to_parse.c_str()); +sym->set_external_file_id(1); +sym->set_line_no(1); +sym->set_pos_in_line(1); +Errors.push_back(*sym); +return; +} +ifile.close(); +return; +} +/*:7*//*8:*/ +#line 114 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +void DUMP_ERROR_QUEUE(yacco2::TOKEN_GAGGLE&Errors) +{ +using namespace NS_yacco2_k_symbols; +using namespace yacco2; +Errors.push_back(*yacco2::PTR_LR1_eog__); +Errors.push_back(*yacco2::PTR_LR1_eog__); +using namespace NS_testout_err_hdlr; + +Ctestout_err_hdlr fsm; +Parser pass_errors(fsm,&Errors,0); +pass_errors.parse(); +yacco2::Parallel_threads_shutdown(pass_errors); +} + +/*:8*//*9:*/ +#line 148 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +int main(int argc,char*argv[]) +{ +std::cout<<"testout start"<<std::endl; +using namespace yacco2; +/*11:*/ +#line 184 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +yacco2::YACCO2_T__= 1; +yacco2::YACCO2_TH__= 1; +yacco2::YACCO2_MSG__= 1; + + +/*:11*/ +#line 153 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" +; +/*12:*/ +#line 191 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +GET_CMD_LINE(argc,argv,Holding_file.c_str(),To_parse_file,Error_queue); +/*13:*/ +#line 202 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +if(Error_queue.empty()!=true){ +DUMP_ERROR_QUEUE(Error_queue); +return 1; +} + + +/*:13*/ +#line 193 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" +; + + +/*:12*/ +#line 154 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" +; +using namespace NS_pager_1; +tok_can<std::ifstream> cmd_line(To_parse_file.c_str()); +Cpager_1 pager_1_fsm; +Parser testout_parse(pager_1_fsm,&cmd_line,&IP_tokens,0,&Error_queue,&JUNK_tokens,0); +if(testout_parse.parse()==Parser::erred){ +std::cout<<"===============>ERROR OCCURRED"<<std::endl; +/*13:*/ +#line 202 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + +if(Error_queue.empty()!=true){ +DUMP_ERROR_QUEUE(Error_queue); +return 1; +} + + +/*:13*/ +#line 161 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" +; +} + +exit: +std::cout<<"Exiting testout"<<std::endl; +return 0; +} + +/*:9*/ +#line 213 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" +; + +#line 15 "./testout.w" +/*:14*/ diff --git a/web/yacco2/grammar-testsuite/testout.fsc b/web/yacco2/grammar-testsuite/testout.fsc new file mode 100644 index 0000000000..b9e6b732b8 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout.fsc @@ -0,0 +1,19 @@ +/* +file: /yacco2/grammar-testsuite/testout.fsc +*/ +file-of-T-alphabet "/yacco2/grammar-testsuite/testout_T_enumeration.fsc" +emitfile "/yacco2/grammar-testsuite/testout_fsc.cpp" +preamble +#include "yacco2.h" +#include "testout_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "testout_terminals.h" +#include "yacco2_characters.h" +using namespace NS_testout_T_enum; +using namespace NS_testout_err_symbols; +using namespace NS_yacco2_k_symbols; +using namespace NS_testout_terminals; +using namespace NS_yacco2_characters; +end-preamble +"/yacco2/grammar-testsuite/pager_1.fsc" +"/yacco2/grammar-testsuite/testout_err_hdlr.fsc" diff --git a/web/yacco2/grammar-testsuite/testout.h b/web/yacco2/grammar-testsuite/testout.h new file mode 100644 index 0000000000..9b45fe9294 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout.h @@ -0,0 +1,39 @@ +/*4:*/ +#line 26 "/usr/local//yacco2/grammar-testsuite/testout_includes.w" + + +#line 27 "/usr/local//yacco2/grammar-testsuite/testout_includes.w" + +#ifndef testout__ +#define testout__ 1 +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#include "yacco2.h" +#include "testout_T_enumeration.h" +#include "yacco2_characters.h" +#include "yacco2_k_symbols.h" +#include "testout_terminals.h" +#include "testout_err_symbols.h" +#include "pager_1.h" +#include "testout_err_hdlr.h" + +using namespace std; +using namespace NS_testout_T_enum; +using namespace NS_yacco2_k_symbols; +using namespace NS_testout_terminals; +using namespace NS_testout_err_symbols; +using namespace yacco2; +#endif +#line 1 "/usr/local//yacco2/grammar-testsuite/testout_prog.w" + + + + + + + + +/*:4*/ diff --git a/web/yacco2/grammar-testsuite/testout.w b/web/yacco2/grammar-testsuite/testout.w new file mode 100644 index 0000000000..a588e24688 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout.w @@ -0,0 +1,15 @@ +@q file: testout.w@> +@q% Copyright Dave Bone 1998 - 2015@> +@q% /*@> +@q% This Source Code Form is subject to the terms of the Mozilla Public@> +@q% License, v. 2.0. If a copy of the MPL was not distributed with this@> +@q% file, You can obtain one at http://mozilla.org/MPL/2.0/.@> +@q% */@> +\input "eplain" +\input "supp-pdf" +\input "/usr/local/yacco2/diagrams/o2mac.tex" +@i "/usr/local/yacco2/license.w" +@i "/usr/local//yacco2/grammar-testsuite/testout_comments.w" +@i "/usr/local//yacco2/grammar-testsuite/testout_includes.w" +@i "/usr/local//yacco2/grammar-testsuite/testout_prog.w" +@** Index.
\ No newline at end of file diff --git a/web/yacco2/grammar-testsuite/testout_1.dat b/web/yacco2/grammar-testsuite/testout_1.dat new file mode 100644 index 0000000000..b30fd9d1f8 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_1.dat @@ -0,0 +1 @@ +aeeeeed
\ No newline at end of file diff --git a/web/yacco2/grammar-testsuite/testout_2.dat b/web/yacco2/grammar-testsuite/testout_2.dat new file mode 100644 index 0000000000..c123665cf1 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_2.dat @@ -0,0 +1 @@ +aeeeec
\ No newline at end of file diff --git a/web/yacco2/grammar-testsuite/testout_3.dat b/web/yacco2/grammar-testsuite/testout_3.dat new file mode 100644 index 0000000000..3774b9f589 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_3.dat @@ -0,0 +1 @@ +aeeexz
\ No newline at end of file diff --git a/web/yacco2/grammar-testsuite/testout_T_enumeration.T b/web/yacco2/grammar-testsuite/testout_T_enumeration.T new file mode 100644 index 0000000000..39484d6eda --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_T_enumeration.T @@ -0,0 +1,39 @@ +/* + Copyright Dave Bone 1998 - 2014 + All Rights Reserved. + No part of this document may be reproduced without written consent from the author. + +File: testout_T_enumeration.lex +Date: 25 July 2014 +Author: Dave Bone +Purpose: + Supplies emitted enumeration file name and namespace. The lr1 compiler/compiler + generates the "enum" type for the 4 classes of terminals: + 1) lr1 constants + 2) raw characters + 3) errors + 4) terminals + Note: + The enumerated type is emitted which is referenced in the other + emitted grammars via the "#include" directive having a symbol ordering: + 0 <= Lr1_K < raw chars < error terminals < Terminals < grammar's Rules + The subrules of a grammar's rule are locally enumerated within the grammar + starting from 1. + + This order is per emitted grammar. That is to say, each parallel grammar has + its own generated lr1 table using the enumerated terminal class symbols with + its enumerated rules starting 1 after the high bound of the enumerated terminal + classes. + After the parameters, a { k-body } can follow. This k-body + is used for global definitions of contants: + { + constant-defs + C++ syntax directed code for constant definitions + *** + } + +*/ +T-enumeration +(file-name testout_T_enumeration +,name-space NS_testout_T_enum) { +} diff --git a/web/yacco2/grammar-testsuite/testout_T_enumeration.fsc b/web/yacco2/grammar-testsuite/testout_T_enumeration.fsc new file mode 100644 index 0000000000..48cd0374ca --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_T_enumeration.fsc @@ -0,0 +1,275 @@ +/* + File: testout_T_enumeration.fsc + Date and Time: Mon Jun 9 08:45:19 2014 +*/ +T-alphabet +LR1_questionable_shift_operator +LR1_eog +LR1_eolr +LR1_parallel_operator +LR1_reduce_operator +LR1_invisible_shift_operator +LR1_all_shift_operator +LR1_fset_transience_operator +raw_nul +raw_soh +raw_stx +raw_etx +raw_eot +raw_enq +raw_ack +raw_bel +raw_bs +raw_ht +raw_lf +raw_vt +raw_ff +raw_cr +raw_so +raw_si +raw_dle +raw_dc1 +raw_dc2 +raw_dc3 +raw_dc4 +raw_nak +raw_syn +raw_etb +raw_can +raw_em +raw_sub +raw_esc +raw_fs +raw_gs +raw_rs +raw_us +raw_sp +raw_exclam +raw_dbl_quote +raw_no_sign +raw_dollar_sign +raw_percent +raw_ampersign +raw_right_quote +raw_open_bracket +raw_close_bracket +raw_asteric +raw_plus +raw_comma +raw_minus +raw_period +raw_slash +raw_0 +raw_1 +raw_2 +raw_3 +raw_4 +raw_5 +raw_6 +raw_7 +raw_8 +raw_9 +raw_colon +raw_semi_colon +raw_less_than +raw_eq +raw_gt_than +raw_question_mark +raw_at_sign +raw_A +raw_B +raw_C +raw_D +raw_E +raw_F +raw_G +raw_H +raw_I +raw_J +raw_K +raw_L +raw_M +raw_N +raw_O +raw_P +raw_Q +raw_R +raw_S +raw_T +raw_U +raw_V +raw_W +raw_X +raw_Y +raw_Z +raw_open_sq_bracket +raw_back_slash +raw_close_sq_bracket +raw_up_arrow +raw_under_score +raw_left_quote +raw_a +raw_b +raw_c +raw_d +raw_e +raw_f +raw_g +raw_h +raw_i +raw_j +raw_k +raw_l +raw_m +raw_n +raw_o +raw_p +raw_q +raw_r +raw_s +raw_t +raw_u +raw_v +raw_w +raw_x +raw_y +raw_z +raw_open_brace +raw_vertical_line +raw_close_brace +raw_tilde +raw_del +raw_x80 +raw_x81 +raw_x82 +raw_x83 +raw_x84 +raw_x85 +raw_x86 +raw_x87 +raw_x88 +raw_x89 +raw_x8a +raw_x8b +raw_x8c +raw_x8d +raw_x8e +raw_x8f +raw_x90 +raw_x91 +raw_x92 +raw_x93 +raw_x94 +raw_x95 +raw_x96 +raw_x97 +raw_x98 +raw_x99 +raw_x9a +raw_x9b +raw_x9c +raw_x9d +raw_x9e +raw_x9f +raw_xa0 +raw_xa1 +raw_xa2 +raw_xa3 +raw_xa4 +raw_xa5 +raw_xa6 +raw_xa7 +raw_xa8 +raw_xa9 +raw_xaa +raw_xab +raw_xac +raw_xad +raw_xae +raw_xaf +raw_xb0 +raw_xb1 +raw_xb2 +raw_xb3 +raw_xb4 +raw_xb5 +raw_xb6 +raw_xb7 +raw_xb8 +raw_xb9 +raw_xba +raw_xbb +raw_xbc +raw_xbd +raw_xbe +raw_xbf +raw_xc0 +raw_xc1 +raw_xc2 +raw_xc3 +raw_xc4 +raw_xc5 +raw_xc6 +raw_xc7 +raw_xc8 +raw_xc9 +raw_xca +raw_xcb +raw_xcc +raw_xcd +raw_xce +raw_xcf +raw_xd0 +raw_xd1 +raw_xd2 +raw_xd3 +raw_xd4 +raw_xd5 +raw_xd6 +raw_xd7 +raw_xd8 +raw_xd9 +raw_xda +raw_xdb +raw_xdc +raw_xdd +raw_xde +raw_xdf +raw_xe0 +raw_xe1 +raw_xe2 +raw_xe3 +raw_xe4 +raw_xe5 +raw_xe6 +raw_xe7 +raw_xe8 +raw_xe9 +raw_xea +raw_xeb +raw_xec +raw_xed +raw_xee +raw_xef +raw_xf0 +raw_xf1 +raw_xf2 +raw_xf3 +raw_xf4 +raw_xf5 +raw_xf6 +raw_xf7 +raw_xf8 +raw_xf9 +raw_xfa +raw_xfb +raw_xfc +raw_xfd +raw_xfe +raw_xff +T_testout_ok +Err_no_cmd_lne_data +Err_no_filename +Err_bad_filename +Err_bad_T_inputted +end-T-alphabet diff --git a/web/yacco2/grammar-testsuite/testout_T_enumeration.h b/web/yacco2/grammar-testsuite/testout_T_enumeration.h new file mode 100644 index 0000000000..29f521ab72 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_T_enumeration.h @@ -0,0 +1,292 @@ +/* + File: testout_T_enumeration.h + Date and Time: Sat Jan 31 11:59:00 2015 +*/ +#ifndef __testout_T_enumeration_h__ +#define __testout_T_enumeration_h__ 1 +namespace NS_testout_T_enum { + struct T_Enum { + enum enumerated_terminals { + sum_total_T = 269 + ,no_of_terminals = 1 + ,no_of_raw_chars = 256 + ,no_of_lr1_constants = 8 + ,no_of_error_terminals = 4 + ,start_LRK=0,end_LRK=7 + ,start_RC=8,end_RC=263 + ,start_T=264,end_T=264 + ,start_ERR=265,end_ERR=268 + ,start_R=269 + ,T_LR1_questionable_shift_operator_ = 0 + ,T_LR1_eog_ = 1 + ,T_LR1_eolr_ = 2 + ,T_LR1_parallel_operator_ = 3 + ,T_LR1_reduce_operator_ = 4 + ,T_LR1_invisible_shift_operator_ = 5 + ,T_LR1_all_shift_operator_ = 6 + ,T_LR1_fset_transience_operator_ = 7 + ,T_raw_nul_ = 8 + ,T_raw_soh_ = 9 + ,T_raw_stx_ = 10 + ,T_raw_etx_ = 11 + ,T_raw_eot_ = 12 + ,T_raw_enq_ = 13 + ,T_raw_ack_ = 14 + ,T_raw_bel_ = 15 + ,T_raw_bs_ = 16 + ,T_raw_ht_ = 17 + ,T_raw_lf_ = 18 + ,T_raw_vt_ = 19 + ,T_raw_ff_ = 20 + ,T_raw_cr_ = 21 + ,T_raw_so_ = 22 + ,T_raw_si_ = 23 + ,T_raw_dle_ = 24 + ,T_raw_dc1_ = 25 + ,T_raw_dc2_ = 26 + ,T_raw_dc3_ = 27 + ,T_raw_dc4_ = 28 + ,T_raw_nak_ = 29 + ,T_raw_syn_ = 30 + ,T_raw_etb_ = 31 + ,T_raw_can_ = 32 + ,T_raw_em_ = 33 + ,T_raw_sub_ = 34 + ,T_raw_esc_ = 35 + ,T_raw_fs_ = 36 + ,T_raw_gs_ = 37 + ,T_raw_rs_ = 38 + ,T_raw_us_ = 39 + ,T_raw_sp_ = 40 + ,T_raw_exclam_ = 41 + ,T_raw_dbl_quote_ = 42 + ,T_raw_no_sign_ = 43 + ,T_raw_dollar_sign_ = 44 + ,T_raw_percent_ = 45 + ,T_raw_ampersign_ = 46 + ,T_raw_right_quote_ = 47 + ,T_raw_open_bracket_ = 48 + ,T_raw_close_bracket_ = 49 + ,T_raw_asteric_ = 50 + ,T_raw_plus_ = 51 + ,T_raw_comma_ = 52 + ,T_raw_minus_ = 53 + ,T_raw_period_ = 54 + ,T_raw_slash_ = 55 + ,T_raw_0_ = 56 + ,T_raw_1_ = 57 + ,T_raw_2_ = 58 + ,T_raw_3_ = 59 + ,T_raw_4_ = 60 + ,T_raw_5_ = 61 + ,T_raw_6_ = 62 + ,T_raw_7_ = 63 + ,T_raw_8_ = 64 + ,T_raw_9_ = 65 + ,T_raw_colon_ = 66 + ,T_raw_semi_colon_ = 67 + ,T_raw_less_than_ = 68 + ,T_raw_eq_ = 69 + ,T_raw_gt_than_ = 70 + ,T_raw_question_mark_ = 71 + ,T_raw_at_sign_ = 72 + ,T_raw_A_ = 73 + ,T_raw_B_ = 74 + ,T_raw_C_ = 75 + ,T_raw_D_ = 76 + ,T_raw_E_ = 77 + ,T_raw_F_ = 78 + ,T_raw_G_ = 79 + ,T_raw_H_ = 80 + ,T_raw_I_ = 81 + ,T_raw_J_ = 82 + ,T_raw_K_ = 83 + ,T_raw_L_ = 84 + ,T_raw_M_ = 85 + ,T_raw_N_ = 86 + ,T_raw_O_ = 87 + ,T_raw_P_ = 88 + ,T_raw_Q_ = 89 + ,T_raw_R_ = 90 + ,T_raw_S_ = 91 + ,T_raw_T_ = 92 + ,T_raw_U_ = 93 + ,T_raw_V_ = 94 + ,T_raw_W_ = 95 + ,T_raw_X_ = 96 + ,T_raw_Y_ = 97 + ,T_raw_Z_ = 98 + ,T_raw_open_sq_bracket_ = 99 + ,T_raw_back_slash_ = 100 + ,T_raw_close_sq_bracket_ = 101 + ,T_raw_up_arrow_ = 102 + ,T_raw_under_score_ = 103 + ,T_raw_left_quote_ = 104 + ,T_raw_a_ = 105 + ,T_raw_b_ = 106 + ,T_raw_c_ = 107 + ,T_raw_d_ = 108 + ,T_raw_e_ = 109 + ,T_raw_f_ = 110 + ,T_raw_g_ = 111 + ,T_raw_h_ = 112 + ,T_raw_i_ = 113 + ,T_raw_j_ = 114 + ,T_raw_k_ = 115 + ,T_raw_l_ = 116 + ,T_raw_m_ = 117 + ,T_raw_n_ = 118 + ,T_raw_o_ = 119 + ,T_raw_p_ = 120 + ,T_raw_q_ = 121 + ,T_raw_r_ = 122 + ,T_raw_s_ = 123 + ,T_raw_t_ = 124 + ,T_raw_u_ = 125 + ,T_raw_v_ = 126 + ,T_raw_w_ = 127 + ,T_raw_x_ = 128 + ,T_raw_y_ = 129 + ,T_raw_z_ = 130 + ,T_raw_open_brace_ = 131 + ,T_raw_vertical_line_ = 132 + ,T_raw_close_brace_ = 133 + ,T_raw_tilde_ = 134 + ,T_raw_del_ = 135 + ,T_raw_x80_ = 136 + ,T_raw_x81_ = 137 + ,T_raw_x82_ = 138 + ,T_raw_x83_ = 139 + ,T_raw_x84_ = 140 + ,T_raw_x85_ = 141 + ,T_raw_x86_ = 142 + ,T_raw_x87_ = 143 + ,T_raw_x88_ = 144 + ,T_raw_x89_ = 145 + ,T_raw_x8a_ = 146 + ,T_raw_x8b_ = 147 + ,T_raw_x8c_ = 148 + ,T_raw_x8d_ = 149 + ,T_raw_x8e_ = 150 + ,T_raw_x8f_ = 151 + ,T_raw_x90_ = 152 + ,T_raw_x91_ = 153 + ,T_raw_x92_ = 154 + ,T_raw_x93_ = 155 + ,T_raw_x94_ = 156 + ,T_raw_x95_ = 157 + ,T_raw_x96_ = 158 + ,T_raw_x97_ = 159 + ,T_raw_x98_ = 160 + ,T_raw_x99_ = 161 + ,T_raw_x9a_ = 162 + ,T_raw_x9b_ = 163 + ,T_raw_x9c_ = 164 + ,T_raw_x9d_ = 165 + ,T_raw_x9e_ = 166 + ,T_raw_x9f_ = 167 + ,T_raw_xa0_ = 168 + ,T_raw_xa1_ = 169 + ,T_raw_xa2_ = 170 + ,T_raw_xa3_ = 171 + ,T_raw_xa4_ = 172 + ,T_raw_xa5_ = 173 + ,T_raw_xa6_ = 174 + ,T_raw_xa7_ = 175 + ,T_raw_xa8_ = 176 + ,T_raw_xa9_ = 177 + ,T_raw_xaa_ = 178 + ,T_raw_xab_ = 179 + ,T_raw_xac_ = 180 + ,T_raw_xad_ = 181 + ,T_raw_xae_ = 182 + ,T_raw_xaf_ = 183 + ,T_raw_xb0_ = 184 + ,T_raw_xb1_ = 185 + ,T_raw_xb2_ = 186 + ,T_raw_xb3_ = 187 + ,T_raw_xb4_ = 188 + ,T_raw_xb5_ = 189 + ,T_raw_xb6_ = 190 + ,T_raw_xb7_ = 191 + ,T_raw_xb8_ = 192 + ,T_raw_xb9_ = 193 + ,T_raw_xba_ = 194 + ,T_raw_xbb_ = 195 + ,T_raw_xbc_ = 196 + ,T_raw_xbd_ = 197 + ,T_raw_xbe_ = 198 + ,T_raw_xbf_ = 199 + ,T_raw_xc0_ = 200 + ,T_raw_xc1_ = 201 + ,T_raw_xc2_ = 202 + ,T_raw_xc3_ = 203 + ,T_raw_xc4_ = 204 + ,T_raw_xc5_ = 205 + ,T_raw_xc6_ = 206 + ,T_raw_xc7_ = 207 + ,T_raw_xc8_ = 208 + ,T_raw_xc9_ = 209 + ,T_raw_xca_ = 210 + ,T_raw_xcb_ = 211 + ,T_raw_xcc_ = 212 + ,T_raw_xcd_ = 213 + ,T_raw_xce_ = 214 + ,T_raw_xcf_ = 215 + ,T_raw_xd0_ = 216 + ,T_raw_xd1_ = 217 + ,T_raw_xd2_ = 218 + ,T_raw_xd3_ = 219 + ,T_raw_xd4_ = 220 + ,T_raw_xd5_ = 221 + ,T_raw_xd6_ = 222 + ,T_raw_xd7_ = 223 + ,T_raw_xd8_ = 224 + ,T_raw_xd9_ = 225 + ,T_raw_xda_ = 226 + ,T_raw_xdb_ = 227 + ,T_raw_xdc_ = 228 + ,T_raw_xdd_ = 229 + ,T_raw_xde_ = 230 + ,T_raw_xdf_ = 231 + ,T_raw_xe0_ = 232 + ,T_raw_xe1_ = 233 + ,T_raw_xe2_ = 234 + ,T_raw_xe3_ = 235 + ,T_raw_xe4_ = 236 + ,T_raw_xe5_ = 237 + ,T_raw_xe6_ = 238 + ,T_raw_xe7_ = 239 + ,T_raw_xe8_ = 240 + ,T_raw_xe9_ = 241 + ,T_raw_xea_ = 242 + ,T_raw_xeb_ = 243 + ,T_raw_xec_ = 244 + ,T_raw_xed_ = 245 + ,T_raw_xee_ = 246 + ,T_raw_xef_ = 247 + ,T_raw_xf0_ = 248 + ,T_raw_xf1_ = 249 + ,T_raw_xf2_ = 250 + ,T_raw_xf3_ = 251 + ,T_raw_xf4_ = 252 + ,T_raw_xf5_ = 253 + ,T_raw_xf6_ = 254 + ,T_raw_xf7_ = 255 + ,T_raw_xf8_ = 256 + ,T_raw_xf9_ = 257 + ,T_raw_xfa_ = 258 + ,T_raw_xfb_ = 259 + ,T_raw_xfc_ = 260 + ,T_raw_xfd_ = 261 + ,T_raw_xfe_ = 262 + ,T_raw_xff_ = 263 + ,T_T_testout_ok_ = 264 + ,T_Err_no_cmd_lne_data_ = 265 + ,T_Err_no_filename_ = 266 + ,T_Err_bad_filename_ = 267 + ,T_Err_bad_T_inputted_ = 268 + }; // close defining enum list + }; // close defining T_enum +} // end of namespace +#endif diff --git a/web/yacco2/grammar-testsuite/testout_T_includes.T b/web/yacco2/grammar-testsuite/testout_T_includes.T new file mode 100644 index 0000000000..3f8e1c200f --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_T_includes.T @@ -0,0 +1,15 @@ +/* + Copyright Dave Bone 1998 - 2014 + All Rights Reserved. + No part of this document may be reproduced without written consent from the author. + +File: testout_T_includes.T +Purpose: Terminal alphabet definitions used by testsuite grammars. +Author: Dave Bone +Date: 25 May 2014 +*/ +@"/yacco2/grammar-testsuite/testout_T_enumeration.T" +@"/yacco2/library/grammars/yacco2_k_symbols.T" +@"/yacco2/library/grammars/yacco2_characters.T" +@"/yacco2/grammar-testsuite/testout_terminals.T" +@"/yacco2/grammar-testsuite/testout_err_symbols.T" diff --git a/web/yacco2/grammar-testsuite/testout_comments.w b/web/yacco2/grammar-testsuite/testout_comments.w new file mode 100644 index 0000000000..e46305151b --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_comments.w @@ -0,0 +1,56 @@ +@q file: testout_comments.w@> +@q% Copyright Dave Bone 1998 - 2015@> +@q% /*@> +@q% This Source Code Form is subject to the terms of the Mozilla Public@> +@q% License, v. 2.0. If a copy of the MPL was not distributed with this@> +@q% file, You can obtain one at http://mozilla.org/MPL/2.0/.@> +@q% */@> + +@** Comments.\fbreak +There are 3 principle reasons for this program:\fbreak +\ptindent{1) To verify that \O2{} parses a lr(1) grammar, and its parse tables accepts the language expessed} +\ptindent{2) To give a glimpse into what the compiler writer ``will do'' in creating a translator/compiler} +\ptindent{3) An example for your own learning} +This ``will do'' activity prepares the Terminal vocabulary, and shows +a simple way to fetch the input file to parse, and use the built in ``error reporting'' +facilities within your own compiler/translator context. +\fbreak + +The development cycle one needs to create a compiler/translator is:\fbreak +\ptindent{1) write/compile your grammar(s) using \O2} +\ptindent{2) using an editor, create your compiler's fsc file for \O2linker's consumption} +\ptindent{3) write/compile your compiler and any other external functions} +\ptindent{4) link your compiler/translator} +Have a look at {\bf{\Whereyacco2/grammar-testsuite/makefile\_testout\_APPLE}} bash script +detailing the documentation generation and compiling/linking activities. +This example is in ``literate programming'' genre and u can read the ``testout*.w'' files. +If u prefer or u do not have \Cweb{} installed, u can write raw \Cpp code instead. +The gened \Cpp{} files *.h and *.cpp are also in {\bf{../grammar-testsuite}} +to model from. +\fbreak + +The grammar used is from David Pager --- ``The Lane Table Method Of Constructing LR(1) Parsers'' +discussing lr(1) resolution page 61. +To testout pager\_1.lex grammar, u can input one of the following files to {\it{testout}}:\fbreak +\ptindent{1) ./grammar-testsuite/testout\_1.dat} +\ptindent{2) ./grammar-testsuite/testout\_2.dat} +\ptindent{3) x --- no file} +\ptindent{4) ./grammar-testsuite/testout\_error.dat} +An example of running the program:\fbreak +\ptindent{{\bf {cd \Whereyacco2/yacco2/grammar-testsuite}}} +\ptindent{{\bf {./testout testout\_1.dat}}} +Various \Yacco2 tracings are turned on to demo their activity. +Please read wlibrary's pdf document for more details on their +capabilities and meaning or ``o2book.pdf'' reference manual. +Added to the tracing are file/line number source coordinates. +At least u can go back to \Yacco2's library +code when things need adjusting. +``{\bf {1lrtracings.log}}'' contains the dynamic tracings when running the program.\fbreak +\fbreak +General routines to get things going:\fbreak +\ptindent{1) get file-to-parse and put into holding file} +\ptindent{2) parse the command line containing the file to parse} +\ptindent{3) use pager\_1 grammar to parse input file's contents} +@<accrue testout code@>+= +@<Include files@>; + diff --git a/web/yacco2/grammar-testsuite/testout_err_hdlr.cpp b/web/yacco2/grammar-testsuite/testout_err_hdlr.cpp new file mode 100644 index 0000000000..57bd604357 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_hdlr.cpp @@ -0,0 +1,118 @@ +/* + File: testout_err_hdlr.cpp + Date and Time: Sat Jan 31 11:59:00 2015 +*/ +#include "testout_err_hdlr.h" +using namespace NS_testout_T_enum;// enumerate +using namespace NS_testout_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_testout_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_testout_err_hdlr;// grammar's ns +// first set terminals +fsm_rules_reuse_table_type::fsm_rules_reuse_table_type(){ + no_rules_entries_ = 3; + per_rule_s_table_[0] = new Per_rule_s_reuse_table(); + per_rule_s_table_[1] = new Per_rule_s_reuse_table(); + per_rule_s_table_[2] = new Per_rule_s_reuse_table(); +} + Ctestout_err_hdlr:: + Ctestout_err_hdlr() + :yacco2::CAbs_fsm + ("testout_err_hdlr.lex" + ,"1.0" + ,"8 Jul 2003" + ,false + ,"Logic sequencer: Print out errors from testout grammars - pager_1." + ,"Sat Jan 31 11:59:00 2015 " + ,S1_Ctestout_err_hdlr){ + + } + +Ctestout_err_hdlr::~Ctestout_err_hdlr(){ + + for(int x = 0;x < 3;++x){ + ///delete fsm_rules_reuse_table.per_rule_s_table_[x]; + } +} + + bool Ctestout_err_hdlr::failed(){ + return false; + } + void Ctestout_err_hdlr::op(){ +} +int Ctestout_err_hdlr::rhs_to_rules_mapping_[8] = { + -1 + ,0 // subrule 1 for rule 1 + ,0 // subrule 2 for rule 1 + ,1 // subrule 3 for rule 2 + ,1 // subrule 4 for rule 2 + ,2 // subrule 5 for rule 3 + ,2 // subrule 6 for rule 3 + ,2 // subrule 7 for rule 3 +}; +Rtestout_err_hdlr::Rtestout_err_hdlr(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rtestout_err_hdlr",0,Ctestout_err_hdlr::R_Rtestout_err_hdlr_,P,false,false){ +} + +Rerrors::Rerrors(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rerrors",0,Ctestout_err_hdlr::R_Rerrors_,P,false,false){ +} + +Rerror::Rerror(yacco2::Parser* P) + :CAbs_lr1_sym + ("Rerror",0,Ctestout_err_hdlr::R_Rerror_,P,false,false){ +} + +void Rerror::sr1(){ + struct SF{ + Err_no_filename* p1__; + State* s1__; + bool abort1__; + Rule_s_reuse_entry* rule_s_reuse_entry1__; + }; + SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1); + + error_where(sf->p1__); + yacco2::lrclog << "\t" << sf->p1__->id__ << std::endl; + std::cout << "\t" << sf->p1__->id__ << std::endl; + +} + +void Rerror::sr2(){ + struct SF{ + Err_bad_filename* p1__; + State* s1__; + bool abort1__; + Rule_s_reuse_entry* rule_s_reuse_entry1__; + }; + SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1); + + error_where(sf->p1__); + yacco2::lrclog << "\t" << sf->p1__->id__ + << " filename: \"" << sf->p1__->file_name()->c_str() + << "\" does not exist" << std::endl; + std::cout << "\t" << sf->p1__->id__ + << " filename: \"" << sf->p1__->file_name()->c_str() + << "\" does not exist" << std::endl; + +} + +void Rerror::sr3(){ + struct SF{ + CAbs_lr1_sym* p1__; + State* s1__; + bool abort1__; + Rule_s_reuse_entry* rule_s_reuse_entry1__; + }; + SF* sf = (SF*)rule_info__.parser__->parse_stack__.sf_by_top(1); + + error_where(sf->p1__); + yacco2::lrclog << "\t" << sf->p1__->id__ << std::endl; + std::cout << "\t" << sf->p1__->id__ << std::endl; + +} + diff --git a/web/yacco2/grammar-testsuite/testout_err_hdlr.fsc b/web/yacco2/grammar-testsuite/testout_err_hdlr.fsc new file mode 100644 index 0000000000..4aacc17c94 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_hdlr.fsc @@ -0,0 +1,23 @@ +/* + File: testout_err_hdlr.fsc + Date and Time: Sat Jan 31 11:59:00 2015 +*/ +transitive n +grammar-name "testout_err_hdlr" +name-space "NS_testout_err_hdlr" +thread-name "Ctestout_err_hdlr" +monolithic y +file-name "testout_err_hdlr.fsc" +no-of-T 269 +list-of-native-first-set-terminals 4 + LR1_eog + LR1_all_shift_operator + Err_no_filename + Err_bad_filename +end-list-of-native-first-set-terminals +list-of-transitive-threads 0 +end-list-of-transitive-threads +list-of-used-threads 0 +end-list-of-used-threads +fsm-comments +"Logic sequencer: Print out errors from testout grammars - pager_1." diff --git a/web/yacco2/grammar-testsuite/testout_err_hdlr.h b/web/yacco2/grammar-testsuite/testout_err_hdlr.h new file mode 100644 index 0000000000..ebc6be9b4b --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_hdlr.h @@ -0,0 +1,130 @@ +/* + File: testout_err_hdlr.h + Date and Time: Sat Jan 31 11:59:00 2015 +*/ +#ifndef __testout_err_hdlr_h__ +#define __testout_err_hdlr_h__ 1 +#include "yacco2.h" +#include "testout_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "testout_err_symbols.h" +#include "testout_terminals.h" +#include "yacco2_characters.h" +// monolithic grammar: no thread +extern yacco2::State S1_Ctestout_err_hdlr; +namespace NS_testout_err_hdlr { +using namespace NS_testout_T_enum;// enumerate +using namespace yacco2; +struct fsm_rules_reuse_table_type{ + fsm_rules_reuse_table_type(); + int no_rules_entries_; + Per_rule_s_reuse_table* per_rule_s_table_[3]; +}; +class Ctestout_err_hdlr: public yacco2::CAbs_fsm { + public: + enum rules_and_subrules{ + start_of_rule_list = NS_testout_T_enum::T_Enum::sum_total_T + ,R_Rtestout_err_hdlr_ = 269//start_of_rule_list + 0 + ,rhs1_Rtestout_err_hdlr_ = 1 + ,rhs2_Rtestout_err_hdlr_ = 2 + ,R_Rerrors_ = 270//start_of_rule_list + 2 + ,rhs1_Rerrors_ = 3 + ,rhs2_Rerrors_ = 4 + ,R_Rerror_ = 271//start_of_rule_list + 4 + ,rhs1_Rerror_ = 5 + ,rhs2_Rerror_ = 6 + ,rhs3_Rerror_ = 7 + }; + //no of la sets = 2 + //no of states = 9 + Ctestout_err_hdlr(); + ~Ctestout_err_hdlr(); + void op(); + bool failed(); + void reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule); + fsm_rules_reuse_table_type fsm_rules_reuse_table; + static int rhs_to_rules_mapping_[8]; + }; +struct Rtestout_err_hdlr; +struct Rerrors; +struct Rerror; +struct Rtestout_err_hdlr:public yacco2::CAbs_lr1_sym { + Rtestout_err_hdlr(yacco2::Parser* P); + public: +}; + +struct Rerrors:public yacco2::CAbs_lr1_sym { + Rerrors(yacco2::Parser* P); + public: +}; + +struct Rerror:public yacco2::CAbs_lr1_sym { + Rerror(yacco2::Parser* P); + + void error_where(CAbs_lr1_sym* E_sym){ + std::string ext_fle; + if(E_sym->tok_co_ords__.external_file_id__<yacco2::FILE_TBL__.size()){ + ext_fle = yacco2::FILE_TBL__[E_sym->tok_co_ords__.external_file_id__]; +}else{ + ext_fle = "File not found"; +} + std::string line_of_data; + std::ifstream ifile; + ifile.open(ext_fle.c_str()); + if(ifile.good()){ + yacco2::UINT lno(1);yacco2::UINT dlno(E_sym->tok_co_ords__.line_no__); + for(;lno<=dlno;++lno){ + getline(ifile,line_of_data); + if(lno == dlno) break; + line_of_data.clear(); + } + } + + std::string space(" "); + std::string::size_type f = line_of_data.find_first_of('\t'); + for(;f != std::string::npos;){ + line_of_data.replace(f,1,space); + f = line_of_data.find_first_of('\t'); + } + + yacco2::lrclog << "Error in file#: " << E_sym->tok_co_ords__.external_file_id__ + << " \"" << ext_fle.c_str() << "\"" << std::endl; + yacco2::lrclog << line_of_data.c_str() << std::endl; + std::cout << "Error in file#: " << E_sym->tok_co_ords__.external_file_id__ + << " \"" << ext_fle.c_str() << "\"" << std::endl; + std::cout << line_of_data.c_str() << std::endl; + for(int pos = 1;pos < E_sym->tok_co_ords__.pos_in_line__;++pos){ + yacco2::lrclog << ' '; + std::cout << ' '; + } + yacco2::lrclog << '^' << std::endl; + yacco2::lrclog << "\tfpos: " << E_sym->tok_co_ords__.rc_pos__ + << " line#: " << E_sym->tok_co_ords__.line_no__ + << " cpos: " << E_sym->tok_co_ords__.pos_in_line__ + << std::endl; + std::cout << '^' << std::endl; + std::cout << "\tfpos: " << E_sym->tok_co_ords__.rc_pos__ + << " line#: " << E_sym->tok_co_ords__.line_no__ + << " cpos: " << E_sym->tok_co_ords__.pos_in_line__ + << std::endl; + if(E_sym->tok_co_ords__.who_file__ != 0){ + yacco2::lrclog << "\twho thru it: " << E_sym->tok_co_ords__.who_file__ + << " line#: " << E_sym->tok_co_ords__.who_line_no__ + << std::endl; + std::cout << "\twho thru it: " << E_sym->tok_co_ords__.who_file__ + << " line#: " << E_sym->tok_co_ords__.who_line_no__ + << std::endl; + } + ifile.close(); + }; + + public: + void sr1(); + void sr2(); + void sr3(); +}; + +} // end of namespace + +#endif diff --git a/web/yacco2/grammar-testsuite/testout_err_hdlr.lex b/web/yacco2/grammar-testsuite/testout_err_hdlr.lex new file mode 100644 index 0000000000..6887960cec --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_hdlr.lex @@ -0,0 +1,123 @@ +/* + Copyright Dave Bone 1998 - 2014 + All Rights Reserved. + No part of this document may be reproduced without written consent from the author. + +FILE: o2_err_hdlr.lex +Date: 8 Jul 2003 +Purpose: grammar to process errors from yacco2 +Conduit: none +Change: 11 Mar 2004 - replace tab with space so that + displaced error lines up properly +*/ +/@ +@i "/yacco2/copyright.w" +@** |o2_err_hdlr| grammar.\fbreak +Grammar that processes for printing posted errors from yacco2. +@/ +fsm +(fsm-id "testout_err_hdlr.lex",fsm-filename testout_err_hdlr,fsm-namespace NS_testout_err_hdlr +,fsm-class Ctestout_err_hdlr +,fsm-version "1.0",fsm-date "8 Jul 2003",fsm-debug "false" +,fsm-comments "Logic sequencer: Print out errors from testout grammars - pager_1.") +@"/usr/local/yacco2/grammar-testsuite/testout_T_includes.T" +rules{ +Rtestout_err_hdlr (){ + -> Rerrors eog + -> eog +} + +Rerrors (){ + -> Rerror + -> Rerrors Rerror +} + +Rerror ( +lhs{ + user-declaration + void error_where(CAbs_lr1_sym* E_sym){ + std::string ext_fle; + if(E_sym->tok_co_ords__.external_file_id__<yacco2::FILE_TBL__.size()){ + ext_fle = yacco2::FILE_TBL__[E_sym->tok_co_ords__.external_file_id__]; +}else{ + ext_fle = "File not found"; +} + std::string line_of_data; + std::ifstream ifile; + ifile.open(ext_fle.c_str()); + if(ifile.good()){ + yacco2::UINT lno(1);yacco2::UINT dlno(E_sym->tok_co_ords__.line_no__); + for(;lno<=dlno;++lno){ + getline(ifile,line_of_data); + if(lno == dlno) break; + line_of_data.clear(); + } + } + + std::string space(" "); + std::string::size_type f = line_of_data.find_first_of('\t'); + for(;f != std::string::npos;){ + line_of_data.replace(f,1,space); + f = line_of_data.find_first_of('\t'); + } + + yacco2::lrclog << "Error in file#: " << E_sym->tok_co_ords__.external_file_id__ + << " \"" << ext_fle.c_str() << "\"" << std::endl; + yacco2::lrclog << line_of_data.c_str() << std::endl; + std::cout << "Error in file#: " << E_sym->tok_co_ords__.external_file_id__ + << " \"" << ext_fle.c_str() << "\"" << std::endl; + std::cout << line_of_data.c_str() << std::endl; + for(int pos = 1;pos < E_sym->tok_co_ords__.pos_in_line__;++pos){ + yacco2::lrclog << ' '; + std::cout << ' '; + } + yacco2::lrclog << '^' << std::endl; + yacco2::lrclog << "\tfpos: " << E_sym->tok_co_ords__.rc_pos__ + << " line#: " << E_sym->tok_co_ords__.line_no__ + << " cpos: " << E_sym->tok_co_ords__.pos_in_line__ + << std::endl; + std::cout << '^' << std::endl; + std::cout << "\tfpos: " << E_sym->tok_co_ords__.rc_pos__ + << " line#: " << E_sym->tok_co_ords__.line_no__ + << " cpos: " << E_sym->tok_co_ords__.pos_in_line__ + << std::endl; + if(E_sym->tok_co_ords__.who_file__ != 0){ + yacco2::lrclog << "\twho thru it: " << E_sym->tok_co_ords__.who_file__ + << " line#: " << E_sym->tok_co_ords__.who_line_no__ + << std::endl; + std::cout << "\twho thru it: " << E_sym->tok_co_ords__.who_file__ + << " line#: " << E_sym->tok_co_ords__.who_line_no__ + << std::endl; + } + ifile.close(); + }; + *** +} +){ + -> "no filename" { + op + error_where(sf->p1__); + yacco2::lrclog << "\t" << sf->p1__->id__ << std::endl; + std::cout << "\t" << sf->p1__->id__ << std::endl; + *** + } + -> "bad filename" { + op + error_where(sf->p1__); + yacco2::lrclog << "\t" << sf->p1__->id__ + << " filename: \"" << sf->p1__->file_name()->c_str() + << "\" does not exist" << std::endl; + std::cout << "\t" << sf->p1__->id__ + << " filename: \"" << sf->p1__->file_name()->c_str() + << "\" does not exist" << std::endl; + *** + } + -> |+| {// catch balance of errors + op + error_where(sf->p1__); + yacco2::lrclog << "\t" << sf->p1__->id__ << std::endl; + std::cout << "\t" << sf->p1__->id__ << std::endl; + *** + } +} +}// end of rules diff --git a/web/yacco2/grammar-testsuite/testout_err_hdlrsym.cpp b/web/yacco2/grammar-testsuite/testout_err_hdlrsym.cpp new file mode 100644 index 0000000000..2ee6b75477 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_hdlrsym.cpp @@ -0,0 +1,128 @@ +/* + File: testout_err_hdlrsym.cpp + Date and Time: Sat Jan 31 11:59:00 2015 +*/ +#include "testout_err_hdlr.h" +using namespace NS_testout_T_enum;// enumerate +using namespace NS_testout_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_testout_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_testout_err_hdlr;// grammar's ns +// first set terminals +// monolithic grammar --- no thread +void +Ctestout_err_hdlr::reduce_rhs_of_rule + (yacco2::UINT Sub_rule_no,yacco2::Rule_s_reuse_entry** Recycled_rule){ + int reducing_rule = rhs_to_rules_mapping_[Sub_rule_no]; + Per_rule_s_reuse_table* rule_reuse_tbl_ptr = + fsm_rules_reuse_table.per_rule_s_table_[reducing_rule]; + Rule_s_reuse_entry* re(0); + find_a_recycled_rule(rule_reuse_tbl_ptr,&re); + (*Recycled_rule) = re; + fnd_re: switch (Sub_rule_no){ + case rhs1_Rtestout_err_hdlr_:{ + Rtestout_err_hdlr* sym; + if(re->rule_ == 0){ + sym = new Rtestout_err_hdlr(parser__); + re->rule_ = sym; + }else{ + sym = (Rtestout_err_hdlr*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs2_Rtestout_err_hdlr_:{ + Rtestout_err_hdlr* sym; + if(re->rule_ == 0){ + sym = new Rtestout_err_hdlr(parser__); + re->rule_ = sym; + }else{ + sym = (Rtestout_err_hdlr*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs1_Rerrors_:{ + Rerrors* sym; + if(re->rule_ == 0){ + sym = new Rerrors(parser__); + re->rule_ = sym; + }else{ + sym = (Rerrors*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + return;} + case rhs2_Rerrors_:{ + Rerrors* sym; + if(re->rule_ == 0){ + sym = new Rerrors(parser__); + re->rule_ = sym; + }else{ + sym = (Rerrors*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 2; + + + return;} + case rhs1_Rerror_:{ + Rerror* sym; + if(re->rule_ == 0){ + sym = new Rerror(parser__); + re->rule_ = sym; + }else{ + sym = (Rerror*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + sym->sr1(); + return;} + case rhs2_Rerror_:{ + Rerror* sym; + if(re->rule_ == 0){ + sym = new Rerror(parser__); + re->rule_ = sym; + }else{ + sym = (Rerror*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + sym->sr2(); + return;} + case rhs3_Rerror_:{ + Rerror* sym; + if(re->rule_ == 0){ + sym = new Rerror(parser__); + re->rule_ = sym; + }else{ + sym = (Rerror*)re->rule_; + } + // no rule's constructor directive + (*Recycled_rule)->rule_ = sym; + sym->rule_info__.rhs_no_of_parms__ = 1; + + + sym->sr3(); + return;} + default: return; + } +} diff --git a/web/yacco2/grammar-testsuite/testout_err_hdlrtbl.cpp b/web/yacco2/grammar-testsuite/testout_err_hdlrtbl.cpp new file mode 100644 index 0000000000..3e5c80c3fb --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_hdlrtbl.cpp @@ -0,0 +1,176 @@ +/* + File: testout_err_hdlrtbl.cpp + Date and Time: Sat Jan 31 11:59:00 2015 +*/ +#include "testout_err_hdlr.h" +using namespace NS_testout_T_enum;// enumerate +using namespace NS_testout_err_symbols;// error symbols +using namespace NS_yacco2_k_symbols;// lrk +using namespace NS_testout_terminals;// terminals +using namespace NS_yacco2_characters;// rc +using namespace yacco2;// yacco2 library +using namespace NS_testout_err_hdlr;// grammar's ns +// first set terminals +// LR1_eolr +yacco2::UCHAR LA1_Ctestout_err_hdlr[] ={ +1 +,0,4 +}; +// LR1_eog +// LR1_all_shift_operator +// Err_no_filename +// Err_bad_filename +yacco2::UCHAR LA2_Ctestout_err_hdlr[] ={ +2 +,0,66 +,33,12 +}; +extern yacco2::State S1_Ctestout_err_hdlr; +extern yacco2::State S2_Ctestout_err_hdlr; +extern yacco2::State S3_Ctestout_err_hdlr; +extern yacco2::State S4_Ctestout_err_hdlr; +extern yacco2::State S5_Ctestout_err_hdlr; +extern yacco2::State S6_Ctestout_err_hdlr; +extern yacco2::State S7_Ctestout_err_hdlr; +extern yacco2::State S8_Ctestout_err_hdlr; +extern yacco2::State S9_Ctestout_err_hdlr; +struct S1std_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[7]; +}; +S1std_Ctestout_err_hdlr S1st_Ctestout_err_hdlr = { + 7 + , + {// start of table + {1,(State*)&S2_Ctestout_err_hdlr} // shift sym: LR1_eog + ,{6,(State*)&S3_Ctestout_err_hdlr} // shift sym: LR1_all_shift_operator + ,{266,(State*)&S4_Ctestout_err_hdlr} // shift sym: Err_no_filename + ,{267,(State*)&S5_Ctestout_err_hdlr} // shift sym: Err_bad_filename + ,{269,(State*)&S1_Ctestout_err_hdlr} // accept sym: Rtestout_err_hdlr + ,{270,(State*)&S6_Ctestout_err_hdlr} // shift sym: Rerrors + ,{271,(State*)&S9_Ctestout_err_hdlr} // shift sym: Rerror + }// end of shift table +}; +yacco2::Shift_entry S1ase_Ctestout_err_hdlr = {6,(State*)&S3_Ctestout_err_hdlr}; +yacco2::State S1_Ctestout_err_hdlr = //State's vectored into symbol: " No symbol" +{1 +,0,(Shift_entry*)&S1ase_Ctestout_err_hdlr +,0,0,(Shift_tbl*)&S1st_Ctestout_err_hdlr,0,0,0,0}; +struct S2rtd_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S2rtd_Ctestout_err_hdlr S2rt_Ctestout_err_hdlr = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Ctestout_err_hdlr,Ctestout_err_hdlr::rhs2_Rtestout_err_hdlr_} + }// end of reduce table +}; +yacco2::State S2_Ctestout_err_hdlr = //State's vectored into symbol: "eog" +{2 +,0,0,0,0,0,(Reduce_tbl*)&S2rt_Ctestout_err_hdlr,0,0,0}; +struct S3rtd_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S3rtd_Ctestout_err_hdlr S3rt_Ctestout_err_hdlr = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Ctestout_err_hdlr,Ctestout_err_hdlr::rhs3_Rerror_} + }// end of reduce table +}; +yacco2::State S3_Ctestout_err_hdlr = //State's vectored into symbol: "|+|" +{3 +,0,0,0,0,0,(Reduce_tbl*)&S3rt_Ctestout_err_hdlr,0,0,0}; +struct S4rtd_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S4rtd_Ctestout_err_hdlr S4rt_Ctestout_err_hdlr = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Ctestout_err_hdlr,Ctestout_err_hdlr::rhs1_Rerror_} + }// end of reduce table +}; +yacco2::State S4_Ctestout_err_hdlr = //State's vectored into symbol: "no filename" +{4 +,0,0,0,0,0,(Reduce_tbl*)&S4rt_Ctestout_err_hdlr,0,0,0}; +struct S5rtd_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S5rtd_Ctestout_err_hdlr S5rt_Ctestout_err_hdlr = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Ctestout_err_hdlr,Ctestout_err_hdlr::rhs2_Rerror_} + }// end of reduce table +}; +yacco2::State S5_Ctestout_err_hdlr = //State's vectored into symbol: "bad filename" +{5 +,0,0,0,0,0,(Reduce_tbl*)&S5rt_Ctestout_err_hdlr,0,0,0}; +struct S6std_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Shift_entry shift_entries_[5]; +}; +S6std_Ctestout_err_hdlr S6st_Ctestout_err_hdlr = { + 5 + , + {// start of table + {1,(State*)&S7_Ctestout_err_hdlr} // shift sym: LR1_eog + ,{6,(State*)&S3_Ctestout_err_hdlr} // shift sym: LR1_all_shift_operator + ,{266,(State*)&S4_Ctestout_err_hdlr} // shift sym: Err_no_filename + ,{267,(State*)&S5_Ctestout_err_hdlr} // shift sym: Err_bad_filename + ,{271,(State*)&S8_Ctestout_err_hdlr} // shift sym: Rerror + }// end of shift table +}; +yacco2::Shift_entry S6ase_Ctestout_err_hdlr = {6,(State*)&S3_Ctestout_err_hdlr}; +yacco2::State S6_Ctestout_err_hdlr = //State's vectored into symbol: "Rerrors" +{6 +,0,(Shift_entry*)&S6ase_Ctestout_err_hdlr +,0,0,(Shift_tbl*)&S6st_Ctestout_err_hdlr,0,0,0,0}; +struct S7rtd_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S7rtd_Ctestout_err_hdlr S7rt_Ctestout_err_hdlr = { + 1 + , + {// start of table + {(Set_tbl*)&LA1_Ctestout_err_hdlr,Ctestout_err_hdlr::rhs1_Rtestout_err_hdlr_} + }// end of reduce table +}; +yacco2::State S7_Ctestout_err_hdlr = //State's vectored into symbol: "eog" +{7 +,0,0,0,0,0,(Reduce_tbl*)&S7rt_Ctestout_err_hdlr,0,0,0}; +struct S8rtd_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S8rtd_Ctestout_err_hdlr S8rt_Ctestout_err_hdlr = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Ctestout_err_hdlr,Ctestout_err_hdlr::rhs2_Rerrors_} + }// end of reduce table +}; +yacco2::State S8_Ctestout_err_hdlr = //State's vectored into symbol: "Rerror" +{8 +,0,0,0,0,0,(Reduce_tbl*)&S8rt_Ctestout_err_hdlr,0,0,0}; +struct S9rtd_Ctestout_err_hdlr{ + yacco2::USINT no_entries_; + yacco2::Reduce_entry reduce_entries_[1]; +}; +S9rtd_Ctestout_err_hdlr S9rt_Ctestout_err_hdlr = { + 1 + , + {// start of table + {(Set_tbl*)&LA2_Ctestout_err_hdlr,Ctestout_err_hdlr::rhs1_Rerrors_} + }// end of reduce table +}; +yacco2::State S9_Ctestout_err_hdlr = //State's vectored into symbol: "Rerror" +{9 +,0,0,0,0,0,(Reduce_tbl*)&S9rt_Ctestout_err_hdlr,0,0,0}; diff --git a/web/yacco2/grammar-testsuite/testout_err_symbols.T b/web/yacco2/grammar-testsuite/testout_err_symbols.T new file mode 100644 index 0000000000..82bb8ee5c7 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_symbols.T @@ -0,0 +1,45 @@ +/* + Copyright Dave Bone 1998 - 2014 + All Rights Reserved. + No part of this document may be reproduced without written consent from the author. + +File: testout_err_symbols.lex +Date: 7 July 2003 +Author: Dave Bone +*/ +/@ +@i "/yacco2/copyright.w" +@** Testout Error symbols vocabulary.\fbreak +@/ + +error-symbols +(file-name testout_err_symbols +,name-space NS_testout_err_symbols) +{ +"no cmd-lne-data" (sym-class Err_no_cmd_lne_data) +"no filename" (sym-class Err_no_filename) +"bad filename" +(sym-class Err_bad_filename { + user-declaration + public: + Err_bad_filename(std::string& File_name); + Err_bad_filename(const char* File_name); + std::string* file_name(); + private: + std::string file_name_; + *** + user-implementation + Err_bad_filename:: + Err_bad_filename(std::string& File_name) + T_CTOR("bad filename",T_Enum::T_Err_bad_filename_,0,false,false) + {file_name_ += File_name.c_str();} + Err_bad_filename:: + Err_bad_filename(const char* File_name) + T_CTOR("bad filename",T_Enum::T_Err_bad_filename_,0,false,false) + {file_name_ += File_name;} + std::string* Err_bad_filename::file_name(){return &file_name_;} + *** + } +) +"Bad T inputted" (sym-class Err_bad_T_inputted) +} diff --git a/web/yacco2/grammar-testsuite/testout_err_symbols.cpp b/web/yacco2/grammar-testsuite/testout_err_symbols.cpp new file mode 100644 index 0000000000..ff00ae5b55 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_symbols.cpp @@ -0,0 +1,26 @@ +/* + File: testout_err_symbols.cpp + Date and Time: Mon Jun 9 08:45:19 2014 +*/ +#include "testout_err_symbols.h" + using namespace NS_testout_err_symbols; + using namespace NS_testout_T_enum; +Err_no_cmd_lne_data:: +Err_no_cmd_lne_data() + T_CTOR("no cmd-lne-data",T_Enum::T_Err_no_cmd_lne_data_,0,false,false){} +Err_no_filename:: +Err_no_filename() + T_CTOR("no filename",T_Enum::T_Err_no_filename_,0,false,false){} + + Err_bad_filename:: + Err_bad_filename(std::string& File_name) + T_CTOR("bad filename",T_Enum::T_Err_bad_filename_,0,false,false) + {file_name_ += File_name.c_str();} + Err_bad_filename:: + Err_bad_filename(const char* File_name) + T_CTOR("bad filename",T_Enum::T_Err_bad_filename_,0,false,false) + {file_name_ += File_name;} + std::string* Err_bad_filename::file_name(){return &file_name_;} + Err_bad_T_inputted:: +Err_bad_T_inputted() + T_CTOR("Bad T inputted",T_Enum::T_Err_bad_T_inputted_,0,false,false){} diff --git a/web/yacco2/grammar-testsuite/testout_err_symbols.h b/web/yacco2/grammar-testsuite/testout_err_symbols.h new file mode 100644 index 0000000000..95e4b08933 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_err_symbols.h @@ -0,0 +1,32 @@ +/* + File: testout_err_symbols.h + Date and Time: Mon Jun 9 08:45:19 2014 +*/ +#include "yacco2.h" +#include "testout_T_enumeration.h" +#include "yacco2_k_symbols.h" +#ifndef __testout_err_symbols_h__ +#define __testout_err_symbols_h__ 1 +namespace NS_testout_err_symbols{ + using namespace NS_testout_T_enum; + struct Err_no_cmd_lne_data:public yacco2::CAbs_lr1_sym{ + Err_no_cmd_lne_data(); + }; + struct Err_no_filename:public yacco2::CAbs_lr1_sym{ + Err_no_filename(); + }; + struct Err_bad_filename:public yacco2::CAbs_lr1_sym{ + + public: + Err_bad_filename(std::string& File_name); + Err_bad_filename(const char* File_name); + std::string* file_name(); + private: + std::string file_name_; + + }; + struct Err_bad_T_inputted:public yacco2::CAbs_lr1_sym{ + Err_bad_T_inputted(); + }; +}//namespace +#endif diff --git a/web/yacco2/grammar-testsuite/testout_error.dat b/web/yacco2/grammar-testsuite/testout_error.dat new file mode 100644 index 0000000000..a1095a9b92 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_error.dat @@ -0,0 +1 @@ +aeezeec
\ No newline at end of file diff --git a/web/yacco2/grammar-testsuite/testout_fsc.cpp b/web/yacco2/grammar-testsuite/testout_fsc.cpp new file mode 100644 index 0000000000..e3f17ed899 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_fsc.cpp @@ -0,0 +1,40 @@ +// +// File: /yacco2/grammar-testsuite/testout_fsc.cpp +// Generated by linker.exe +// Date and Time: Mon Jun 9 08:47:15 2014 +// + +// Preamble code + + +#include "yacco2.h" + +#include "testout_T_enumeration.h" + +#include "yacco2_k_symbols.h" + +#include "testout_terminals.h" + +#include "yacco2_characters.h" + +using namespace NS_testout_T_enum; + +using namespace NS_testout_err_symbols; + +using namespace NS_yacco2_k_symbols; + +using namespace NS_testout_terminals; + +using namespace NS_yacco2_characters; + + +// thread include and namespace +// BIT MAPS +#define TOTAL_NO_BIT_WORDS 2*1024*50 +int yacco2::TOTAL_NO_BIT_WORDS__(TOTAL_NO_BIT_WORDS); +yacco2::ULINT bit_maps[TOTAL_NO_BIT_WORDS]; +void* yacco2::BIT_MAPS_FOR_SALE__ = (void*)&bit_maps; +int yacco2::BIT_MAP_IDX__(0); +// There are NO THREADS emitted +void* yacco2::THDS_STABLE__ = 0; +void* yacco2::T_ARRAY_HAVING_THD_IDS__ = 0; diff --git a/web/yacco2/grammar-testsuite/testout_holding_file.cmd b/web/yacco2/grammar-testsuite/testout_holding_file.cmd new file mode 100644 index 0000000000..5ee608e743 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_holding_file.cmd @@ -0,0 +1 @@ +xxxx
\ No newline at end of file diff --git a/web/yacco2/grammar-testsuite/testout_includes.w b/web/yacco2/grammar-testsuite/testout_includes.w new file mode 100644 index 0000000000..761e53c1a6 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_includes.w @@ -0,0 +1,50 @@ +@q file: testout_includes.w@> +@q% Copyright Dave Bone 1998 - 2015@> +@q% /*@> +@q% This Source Code Form is subject to the terms of the Mozilla Public@> +@q% License, v. 2.0. If a copy of the MPL was not distributed with this@> +@q% file, You can obtain one at http://mozilla.org/MPL/2.0/.@> +@q% */@> +@*1 Include files.\fbreak +To start things off, these are the Standard Template Library (STL) containers +needed by Yacco2's parse library definitions. +@<Include files@>= +#include "testout.h" + +@*2 Create header file for testout environment.\fbreak +The include files format is:\fbreak +\ptindent{1) system related definitions} +\ptindent{2) the grammar vocabulary framework} +\ptindent{3) grammars used} +\ptindent{4) namespace use for convenience in your \Cpp{} code} +Note the namespace turn-ons for Error and Meta-terminal vocabularies. +Your own language will define your vocabularies with their own namespaces. +Have a look at their definition files: |testout_err_symbols.T| +and |testout_terminals.T| and possibly re-read ``o2book.pdf'' for a refresher on their Ws. +This example is skeletal for teaching purposes whereas your own vocabulary will be meater. +Also note the 2 grammar headers: |pager_1.h| and the error handler |testout_err_hdlr.h|. +@(testout.h@>= +@h +#ifndef testout__ +#define testout__ 1 +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#include "yacco2.h" +#include "testout_T_enumeration.h" +#include "yacco2_characters.h" +#include "yacco2_k_symbols.h" +#include "testout_terminals.h" +#include "testout_err_symbols.h" +#include "pager_1.h" +#include "testout_err_hdlr.h" + +using namespace std; +using namespace NS_testout_T_enum; +using namespace NS_yacco2_k_symbols; +using namespace NS_testout_terminals; +using namespace NS_testout_err_symbols; +using namespace yacco2; +#endif diff --git a/web/yacco2/grammar-testsuite/testout_prog.w b/web/yacco2/grammar-testsuite/testout_prog.w new file mode 100644 index 0000000000..14491e43b4 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_prog.w @@ -0,0 +1,214 @@ +@q file: testout_prog.w@> +@q% Copyright Dave Bone 1998 - 2015@> +@q% /*@> +@q% This Source Code Form is subject to the terms of the Mozilla Public@> +@q% License, v. 2.0. If a copy of the MPL was not distributed with this@> +@q% file, You can obtain one at http://mozilla.org/MPL/2.0/.@> +@q% */@> + +@** Define variables.\fbreak +\ptindent{1) Holding file to start things off --- command line data is put into this file} +\ptindent{2) Define the \O2's tracing variable by macro} +\ptindent{3) \O2's token containers needed} +@<accrue testout code@>+= +#define Max_buf_size 2*1024 +std::string Holding_file("testout_holding_file.cmd"); +std::string To_parse_file; + +YACCO2_define_trace_variables(); +yacco2::TOKEN_GAGGLE JUNK_tokens; +yacco2::TOKEN_GAGGLE IP_tokens; +yacco2::TOKEN_GAGGLE Error_queue; + +@** Local Routines.\fbreak +|GET_CMD_LINE| is a basic copy of |O2|'s command line routine. +It is changed as it just fetches the file to process. There are no other parameters to deal with. +Have a read and compare |O2|'s routine against this one to see the variances. +\O2's routines are written up in |common_externs.pdf| in the ``./docs'' folder. + +|DUMP_ERROR_QUEUE| ditto's |O2|'s error processing routine. +Testout's difference to \O2{} is the use of its own error handler grammar. +This is due to the different T vocabulary defined over \O2's vocabulary. +This was done to show u what u'll be doing for your own compiler development +as your T vocabulary will definitely be different from \O2. +Have a look at the |testout_err_hdlr| grammar and see +how it resolves the external file associated with the error T. +The Error T processing is basicly a template using your specific grammar + relative to its own language/Terminal Vocabulary. + +As O2's |o2_error_hdlr.lex| grammar deals with its own specific errors, +this is why there is not a generic error template grammar that uses only the \ALLshift{} +to trace all the T errors as anonymous entities. +One could do this but u'll find that this is not too creative. +Look at |o2_error_hdlr.lex|'s subrule with tandom errors --- ``file-inclusion'' ``bad filename'' +as an example. + + +Your own error reporting is open to your own code and style to format + and notification. + U might want to compare |testout_terminals.T| and |testout_err_symbols.T| + definitions against \O2's vocabulary: + |yacco2_terminals.T| and |yacco2_err_symbols.T| to get a feel on + the range of Tes within \O2. What they stand for, and the different + definition templates used: canned to full \Cpp{} definition / implementation. + + +@*1 |GET_CMD_LINE| --- go fetch the fodder.\fbreak +To note: the ``File\_to\_parse'' parameter is passed in as a reference which +gets filled with the command line input. +The file's existence check is done and +if it exists, downstream parsing uses it passed in reference variable +for the input tok\_can container +to parse its contents. + +@<accrue testout code@>+= +void GET_CMD_LINE(int argc,char*argv[]@/ +,const char*Holding@/ +,std::string& File_to_parse@/ +,yacco2::TOKEN_GAGGLE&Errors) +{ +using namespace std; +using namespace NS_testout_err_symbols; +using namespace yacco2; +ofstream ofile; +ofile.open(Holding,ios_base::out|ios::trunc); +if(!ofile){ +CAbs_lr1_sym*sym= new Err_bad_filename(Holding); +sym->set_external_file_id(1); +sym->set_line_no(1); +sym->set_pos_in_line(1); +Errors.push_back(*sym); +return; +} +if(argc==1){ +char cmd_line[Max_buf_size]; +cout<<"Please enter Command line to process: "; +cin.get(cmd_line,Max_buf_size,'\n'); +ofile<<cmd_line; +File_to_parse+=cmd_line; +ofile.close(); +}else{ +for(int x= 1;x<argc;++x){ +ofile<<argv[x]; +File_to_parse+=argv[x]; +} +ofile.close(); +} +tok_can<std::ifstream> Cmd1_tokens(Holding);//sets the table of files controlled by yacco2 for parsing T gpsing +ifstream ifile; +ifile.open(File_to_parse.c_str()); +if(!ifile){ +CAbs_lr1_sym*sym= new Err_bad_filename(File_to_parse.c_str()); +sym->set_external_file_id(1); +sym->set_line_no(1); +sym->set_pos_in_line(1); +Errors.push_back(*sym); +return; +} +ifile.close(); +return; +} +@*1 |DUMP_ERROR_QUEUE| --- the teller of horror.\fbreak +The 2 |yacco2::PTR_LR1_eog__| added to the end-of-the-container allows +the grammar's |start_rule| to be accepted. +@<accrue testout code@>+= +void DUMP_ERROR_QUEUE(yacco2::TOKEN_GAGGLE&Errors) +{ +using namespace NS_yacco2_k_symbols; +using namespace yacco2; +Errors.push_back(*yacco2::PTR_LR1_eog__); +Errors.push_back(*yacco2::PTR_LR1_eog__); +using namespace NS_testout_err_hdlr; + +Ctestout_err_hdlr fsm; +Parser pass_errors(fsm,&Errors,0); +pass_errors.parse(); +yacco2::Parallel_threads_shutdown(pass_errors); +} + +@** Mainline.\fbreak +The mainline code demonstrates various ways to do ``literate programming: +a mixture of Literate programming code modules and standard ``c'' code. + +{\bf{Note}:} I checked the returned code from the parser |Parser::erred| +as to whether a parse error occurred. +This is the proper way to do things but u'll see my lazyness in \O2's program +listing to just check the ``Error queue''. +If u misused the |RSVP_FSM| macro from a monolithic grammar's |failed| directive to do this, +the parser did abort, the |failed| directive fired but the ``Error queue'' is empty as +the error T is placed within the ``Accept queue'' which is the context for a +threaded grammar to return a result back to a calling grammar. + +To see that |failed| works within the monolithic context, use ``testout\_error.dat'' +file as input. +\fbreak + +{\bf{So be forwarned}}. I guess this should be checked for by \O2{} +and to thrown an error when compiling the grammar but for the moment it does not. +@<accrue testout code@>+= +int main(int argc, char* argv[]) +{ + std::cout << "testout start" << std::endl; +using namespace yacco2; +@<turn on some \O2's tracing@>; +@<get command line...@>; + using namespace NS_pager_1; + tok_can<std::ifstream> cmd_line(To_parse_file.c_str()); + Cpager_1 pager_1_fsm; + Parser testout_parse(pager_1_fsm,&cmd_line,&IP_tokens,0,&Error_queue,&JUNK_tokens,0); + if (testout_parse.parse() == Parser::erred){ + std::cout << "===============>ERROR OCCURRED" << std::endl; + @<if error queue not empty then deal with posted errors@>; + } + +exit:@/ +std::cout << "Exiting testout" << std::endl; + return 0; +} + +@*1 Some Programming sections. +@*2 Turn on some of \O2's dynamic tracing variables.\fbreak +Tracings:\fbreak +\ptindent{T - terminals} +\ptindent{TH - threads if their fsm-debug options turned on} +\ptindent{MSG - messages between grammars} +\ptindent{MU - trace mutex activity} +Notice that MU was turned off but kept as a comment. +Due to how |Cweb| deals with comments, the underscore ``\_'' must be escaped. +Have a look in the ``testout\_prog.w'' file where u'll see this. + +You will not see any ``MSG'' or ``TH'' tracings as there was not a threaded grammar +called. +So why do u include them? +Just to pique your interest to \O2's delights. +@<turn on some \O2's tracing@>= +yacco2::YACCO2_T__ = 1; +yacco2::YACCO2_TH__ = 1; +yacco2::YACCO2_MSG__ = 1; +//yacco2::YACCO2\_MU\_TRACING\_\_ = 1; + +@*2 Get command line, parse it, and place contents into a holding file.\fbreak +@<get command line, parse it, and place contents into a holding file@>= + GET_CMD_LINE(argc,argv,Holding_file.c_str(),To_parse_file,Error_queue); + @<if error queue not empty then deal with posted errors@>; + + +@*2 Do we have errors?.\fbreak +Check that error queue for those errors. +Note, |DUMP_ERROR_QUEUE| will also flush out + any launched threads for the good housekeeping or is it +housetrained seal +award? Trying to do my best in the realm of short lived winddowns. +@<if error queue not empty then deal with posted errors@>= +if(Error_queue.empty()!=true){ + DUMP_ERROR_QUEUE(Error_queue); + return 1; +} + + +@*1 Testout implementation.\fbreak +Start the code output to |testout.cpp| +by appending its include file. +@(testout.cpp@>= +@<accrue testout code@>; + diff --git a/web/yacco2/grammar-testsuite/testout_terminals.T b/web/yacco2/grammar-testsuite/testout_terminals.T new file mode 100644 index 0000000000..20e185e92b --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_terminals.T @@ -0,0 +1,17 @@ +/* + Copyright Dave Bone 1998 - 2014 + All Rights Reserved. + No part of this document may be reproduced without written consent from the author. + + file: testout_terminals.lex +*/ +/@ +@i "/yacco2/copyright.w" +@** Testout Terminal vocabulary.\fbreak +The one T definition is defined as \O2{} does not allow an empty definition. +@/ +terminals +(file-name testout_terminals +,name-space NS_testout_terminals){ +"testout-ok" (sym-class T_testout_ok) +} // end of terminals diff --git a/web/yacco2/grammar-testsuite/testout_terminals.cpp b/web/yacco2/grammar-testsuite/testout_terminals.cpp new file mode 100644 index 0000000000..897c02f179 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_terminals.cpp @@ -0,0 +1,10 @@ +/* + File: testout_terminals.cpp + Date and Time: Mon Jun 9 08:45:19 2014 +*/ +#include "testout_terminals.h" + using namespace NS_testout_terminals; + using namespace NS_testout_T_enum; +T_testout_ok:: +T_testout_ok() + T_CTOR("testout-ok",T_Enum::T_T_testout_ok_,0,false,false){} diff --git a/web/yacco2/grammar-testsuite/testout_terminals.h b/web/yacco2/grammar-testsuite/testout_terminals.h new file mode 100644 index 0000000000..3e90674fa2 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_terminals.h @@ -0,0 +1,17 @@ +/* + File: testout_terminals.h + Date and Time: Mon Jun 9 08:45:19 2014 +*/ +#include "yacco2.h" +#include "testout_T_enumeration.h" +#include "yacco2_k_symbols.h" +#include "testout_err_symbols.h" +#ifndef __testout_terminals_h__ +#define __testout_terminals_h__ 1 +namespace NS_testout_terminals{ + using namespace NS_testout_T_enum; + struct T_testout_ok:public yacco2::CAbs_lr1_sym{ + T_testout_ok(); + }; +}//namespace +#endif diff --git a/web/yacco2/grammar-testsuite/testout_types.w b/web/yacco2/grammar-testsuite/testout_types.w new file mode 100644 index 0000000000..edcb52ddd8 --- /dev/null +++ b/web/yacco2/grammar-testsuite/testout_types.w @@ -0,0 +1,34 @@ +@q file: testout_types.w@> +@q% Copyright Dave Bone 1998 - 2015@> +@q% /*@> +@q% This Source Code Form is subject to the terms of the Mozilla Public@> +@q% License, v. 2.0. If a copy of the MPL was not distributed with this@> +@q% file, You can obtain one at http://mozilla.org/MPL/2.0/.@> +@q% */@> +\input "eplain" +\input "supp-pdf" +\input"/yacco2/diagrams/o2mac.tex" +@*2 Global definitions and files.\fbreak +Basic preamble include files used by all others. +@(globals.h@>= +// file: globals.h +// prelude files using yacco2: for o2, o2linker utilities +#ifndef globals_h__ +#define globals_h__ 1 +#include <stdarg.h> +#include <stdlib.h> +#include <string.h> +#include <limits.h> + +#include "yacco2.h" +#include "testout_T_enumeration.h" +#include "testout_err_symbols.h" +#include "yacco2_characters.h" +#include "yacco2_k_symbols.h" +#include "testout_terminals.h" +using namespace std; +using namespace NS_testout_T_enum; +using namespace NS_yacco2_k_symbols; +using namespace NS_testout_terminals; +using namespace yacco2; +#endif diff --git a/web/yacco2/grammar-testsuite/yacco2_T_enumeration.h b/web/yacco2/grammar-testsuite/yacco2_T_enumeration.h new file mode 100644 index 0000000000..155d8317f3 --- /dev/null +++ b/web/yacco2/grammar-testsuite/yacco2_T_enumeration.h @@ -0,0 +1,592 @@ +/* + File: yacco2_T_enumeration.h + Date and Time: Sat Jan 31 11:58:57 2015 +*/ +#ifndef __yacco2_T_enumeration_h__ +#define __yacco2_T_enumeration_h__ 1 +namespace NS_yacco2_T_enum { + struct T_Enum { + enum enumerated_terminals { + sum_total_T = 569 + ,no_of_terminals = 114 + ,no_of_raw_chars = 256 + ,no_of_lr1_constants = 8 + ,no_of_error_terminals = 191 + ,start_LRK=0,end_LRK=7 + ,start_RC=8,end_RC=263 + ,start_T=264,end_T=377 + ,start_ERR=378,end_ERR=568 + ,start_R=569 + ,T_LR1_questionable_shift_operator_ = 0 + ,T_LR1_eog_ = 1 + ,T_LR1_eolr_ = 2 + ,T_LR1_parallel_operator_ = 3 + ,T_LR1_reduce_operator_ = 4 + ,T_LR1_invisible_shift_operator_ = 5 + ,T_LR1_all_shift_operator_ = 6 + ,T_LR1_fset_transience_operator_ = 7 + ,T_raw_nul_ = 8 + ,T_raw_soh_ = 9 + ,T_raw_stx_ = 10 + ,T_raw_etx_ = 11 + ,T_raw_eot_ = 12 + ,T_raw_enq_ = 13 + ,T_raw_ack_ = 14 + ,T_raw_bel_ = 15 + ,T_raw_bs_ = 16 + ,T_raw_ht_ = 17 + ,T_raw_lf_ = 18 + ,T_raw_vt_ = 19 + ,T_raw_ff_ = 20 + ,T_raw_cr_ = 21 + ,T_raw_so_ = 22 + ,T_raw_si_ = 23 + ,T_raw_dle_ = 24 + ,T_raw_dc1_ = 25 + ,T_raw_dc2_ = 26 + ,T_raw_dc3_ = 27 + ,T_raw_dc4_ = 28 + ,T_raw_nak_ = 29 + ,T_raw_syn_ = 30 + ,T_raw_etb_ = 31 + ,T_raw_can_ = 32 + ,T_raw_em_ = 33 + ,T_raw_sub_ = 34 + ,T_raw_esc_ = 35 + ,T_raw_fs_ = 36 + ,T_raw_gs_ = 37 + ,T_raw_rs_ = 38 + ,T_raw_us_ = 39 + ,T_raw_sp_ = 40 + ,T_raw_exclam_ = 41 + ,T_raw_dbl_quote_ = 42 + ,T_raw_no_sign_ = 43 + ,T_raw_dollar_sign_ = 44 + ,T_raw_percent_ = 45 + ,T_raw_ampersign_ = 46 + ,T_raw_right_quote_ = 47 + ,T_raw_open_bracket_ = 48 + ,T_raw_close_bracket_ = 49 + ,T_raw_asteric_ = 50 + ,T_raw_plus_ = 51 + ,T_raw_comma_ = 52 + ,T_raw_minus_ = 53 + ,T_raw_period_ = 54 + ,T_raw_slash_ = 55 + ,T_raw_0_ = 56 + ,T_raw_1_ = 57 + ,T_raw_2_ = 58 + ,T_raw_3_ = 59 + ,T_raw_4_ = 60 + ,T_raw_5_ = 61 + ,T_raw_6_ = 62 + ,T_raw_7_ = 63 + ,T_raw_8_ = 64 + ,T_raw_9_ = 65 + ,T_raw_colon_ = 66 + ,T_raw_semi_colon_ = 67 + ,T_raw_less_than_ = 68 + ,T_raw_eq_ = 69 + ,T_raw_gt_than_ = 70 + ,T_raw_question_mark_ = 71 + ,T_raw_at_sign_ = 72 + ,T_raw_A_ = 73 + ,T_raw_B_ = 74 + ,T_raw_C_ = 75 + ,T_raw_D_ = 76 + ,T_raw_E_ = 77 + ,T_raw_F_ = 78 + ,T_raw_G_ = 79 + ,T_raw_H_ = 80 + ,T_raw_I_ = 81 + ,T_raw_J_ = 82 + ,T_raw_K_ = 83 + ,T_raw_L_ = 84 + ,T_raw_M_ = 85 + ,T_raw_N_ = 86 + ,T_raw_O_ = 87 + ,T_raw_P_ = 88 + ,T_raw_Q_ = 89 + ,T_raw_R_ = 90 + ,T_raw_S_ = 91 + ,T_raw_T_ = 92 + ,T_raw_U_ = 93 + ,T_raw_V_ = 94 + ,T_raw_W_ = 95 + ,T_raw_X_ = 96 + ,T_raw_Y_ = 97 + ,T_raw_Z_ = 98 + ,T_raw_open_sq_bracket_ = 99 + ,T_raw_back_slash_ = 100 + ,T_raw_close_sq_bracket_ = 101 + ,T_raw_up_arrow_ = 102 + ,T_raw_under_score_ = 103 + ,T_raw_left_quote_ = 104 + ,T_raw_a_ = 105 + ,T_raw_b_ = 106 + ,T_raw_c_ = 107 + ,T_raw_d_ = 108 + ,T_raw_e_ = 109 + ,T_raw_f_ = 110 + ,T_raw_g_ = 111 + ,T_raw_h_ = 112 + ,T_raw_i_ = 113 + ,T_raw_j_ = 114 + ,T_raw_k_ = 115 + ,T_raw_l_ = 116 + ,T_raw_m_ = 117 + ,T_raw_n_ = 118 + ,T_raw_o_ = 119 + ,T_raw_p_ = 120 + ,T_raw_q_ = 121 + ,T_raw_r_ = 122 + ,T_raw_s_ = 123 + ,T_raw_t_ = 124 + ,T_raw_u_ = 125 + ,T_raw_v_ = 126 + ,T_raw_w_ = 127 + ,T_raw_x_ = 128 + ,T_raw_y_ = 129 + ,T_raw_z_ = 130 + ,T_raw_open_brace_ = 131 + ,T_raw_vertical_line_ = 132 + ,T_raw_close_brace_ = 133 + ,T_raw_tilde_ = 134 + ,T_raw_del_ = 135 + ,T_raw_x80_ = 136 + ,T_raw_x81_ = 137 + ,T_raw_x82_ = 138 + ,T_raw_x83_ = 139 + ,T_raw_x84_ = 140 + ,T_raw_x85_ = 141 + ,T_raw_x86_ = 142 + ,T_raw_x87_ = 143 + ,T_raw_x88_ = 144 + ,T_raw_x89_ = 145 + ,T_raw_x8a_ = 146 + ,T_raw_x8b_ = 147 + ,T_raw_x8c_ = 148 + ,T_raw_x8d_ = 149 + ,T_raw_x8e_ = 150 + ,T_raw_x8f_ = 151 + ,T_raw_x90_ = 152 + ,T_raw_x91_ = 153 + ,T_raw_x92_ = 154 + ,T_raw_x93_ = 155 + ,T_raw_x94_ = 156 + ,T_raw_x95_ = 157 + ,T_raw_x96_ = 158 + ,T_raw_x97_ = 159 + ,T_raw_x98_ = 160 + ,T_raw_x99_ = 161 + ,T_raw_x9a_ = 162 + ,T_raw_x9b_ = 163 + ,T_raw_x9c_ = 164 + ,T_raw_x9d_ = 165 + ,T_raw_x9e_ = 166 + ,T_raw_x9f_ = 167 + ,T_raw_xa0_ = 168 + ,T_raw_xa1_ = 169 + ,T_raw_xa2_ = 170 + ,T_raw_xa3_ = 171 + ,T_raw_xa4_ = 172 + ,T_raw_xa5_ = 173 + ,T_raw_xa6_ = 174 + ,T_raw_xa7_ = 175 + ,T_raw_xa8_ = 176 + ,T_raw_xa9_ = 177 + ,T_raw_xaa_ = 178 + ,T_raw_xab_ = 179 + ,T_raw_xac_ = 180 + ,T_raw_xad_ = 181 + ,T_raw_xae_ = 182 + ,T_raw_xaf_ = 183 + ,T_raw_xb0_ = 184 + ,T_raw_xb1_ = 185 + ,T_raw_xb2_ = 186 + ,T_raw_xb3_ = 187 + ,T_raw_xb4_ = 188 + ,T_raw_xb5_ = 189 + ,T_raw_xb6_ = 190 + ,T_raw_xb7_ = 191 + ,T_raw_xb8_ = 192 + ,T_raw_xb9_ = 193 + ,T_raw_xba_ = 194 + ,T_raw_xbb_ = 195 + ,T_raw_xbc_ = 196 + ,T_raw_xbd_ = 197 + ,T_raw_xbe_ = 198 + ,T_raw_xbf_ = 199 + ,T_raw_xc0_ = 200 + ,T_raw_xc1_ = 201 + ,T_raw_xc2_ = 202 + ,T_raw_xc3_ = 203 + ,T_raw_xc4_ = 204 + ,T_raw_xc5_ = 205 + ,T_raw_xc6_ = 206 + ,T_raw_xc7_ = 207 + ,T_raw_xc8_ = 208 + ,T_raw_xc9_ = 209 + ,T_raw_xca_ = 210 + ,T_raw_xcb_ = 211 + ,T_raw_xcc_ = 212 + ,T_raw_xcd_ = 213 + ,T_raw_xce_ = 214 + ,T_raw_xcf_ = 215 + ,T_raw_xd0_ = 216 + ,T_raw_xd1_ = 217 + ,T_raw_xd2_ = 218 + ,T_raw_xd3_ = 219 + ,T_raw_xd4_ = 220 + ,T_raw_xd5_ = 221 + ,T_raw_xd6_ = 222 + ,T_raw_xd7_ = 223 + ,T_raw_xd8_ = 224 + ,T_raw_xd9_ = 225 + ,T_raw_xda_ = 226 + ,T_raw_xdb_ = 227 + ,T_raw_xdc_ = 228 + ,T_raw_xdd_ = 229 + ,T_raw_xde_ = 230 + ,T_raw_xdf_ = 231 + ,T_raw_xe0_ = 232 + ,T_raw_xe1_ = 233 + ,T_raw_xe2_ = 234 + ,T_raw_xe3_ = 235 + ,T_raw_xe4_ = 236 + ,T_raw_xe5_ = 237 + ,T_raw_xe6_ = 238 + ,T_raw_xe7_ = 239 + ,T_raw_xe8_ = 240 + ,T_raw_xe9_ = 241 + ,T_raw_xea_ = 242 + ,T_raw_xeb_ = 243 + ,T_raw_xec_ = 244 + ,T_raw_xed_ = 245 + ,T_raw_xee_ = 246 + ,T_raw_xef_ = 247 + ,T_raw_xf0_ = 248 + ,T_raw_xf1_ = 249 + ,T_raw_xf2_ = 250 + ,T_raw_xf3_ = 251 + ,T_raw_xf4_ = 252 + ,T_raw_xf5_ = 253 + ,T_raw_xf6_ = 254 + ,T_raw_xf7_ = 255 + ,T_raw_xf8_ = 256 + ,T_raw_xf9_ = 257 + ,T_raw_xfa_ = 258 + ,T_raw_xfb_ = 259 + ,T_raw_xfc_ = 260 + ,T_raw_xfd_ = 261 + ,T_raw_xfe_ = 262 + ,T_raw_xff_ = 263 + ,T_T_option_t_ = 264 + ,T_T_option_p_ = 265 + ,T_T_option_err_ = 266 + ,T_T_esc_seq_ = 267 + ,T_T_eol_ = 268 + ,T_T_basic_char_ = 269 + ,T_T_raw_char_ = 270 + ,T_T_comment_ = 271 + ,T_T_ws_ = 272 + ,T_T_angled_string_ = 273 + ,T_T_c_literal_ = 274 + ,T_T_c_string_ = 275 + ,T_T_xc_str_ = 276 + ,T_T_unquoted_string_ = 277 + ,T_T_file_inclusion_ = 278 + ,T_T_identifier_ = 279 + ,T_T_int_no_ = 280 + ,T_T_raw_characters_ = 281 + ,T_T_lr1_constant_symbols_ = 282 + ,T_T_error_symbols_ = 283 + ,T_T_eocode_ = 284 + ,T_T_AD_ = 285 + ,T_T_AB_ = 286 + ,T_T_parallel_la_boundary_ = 287 + ,T_T_arbitrator_code_ = 288 + ,T_T_parallel_parser_ = 289 + ,T_T_parallel_thread_function_ = 290 + ,T_T_parallel_control_monitor_ = 291 + ,T_T_fsm_ = 292 + ,T_T_fsm_id_ = 293 + ,T_T_fsm_filename_ = 294 + ,T_T_fsm_namespace_ = 295 + ,T_T_fsm_class_ = 296 + ,T_T_fsm_version_ = 297 + ,T_T_fsm_date_ = 298 + ,T_T_fsm_debug_ = 299 + ,T_T_fsm_comments_ = 300 + ,T_T_terminals_ = 301 + ,T_T_enumeration_ = 302 + ,T_T_file_name_ = 303 + ,T_T_name_space_ = 304 + ,T_T_sym_class_ = 305 + ,T_T_rules_ = 306 + ,T_T_lhs_ = 307 + ,T_T_user_declaration_ = 308 + ,T_T_user_prefix_declaration_ = 309 + ,T_T_user_suffix_declaration_ = 310 + ,T_T_constructor_ = 311 + ,T_T_destructor_ = 312 + ,T_T_op_ = 313 + ,T_T_failed_ = 314 + ,T_T_user_implementation_ = 315 + ,T_T_user_imp_tbl_ = 316 + ,T_T_user_imp_sym_ = 317 + ,T_T_constant_defs_ = 318 + ,T_T_terminals_refs_ = 319 + ,T_T_terminals_sufx_ = 320 + ,T_T_lrk_sufx_ = 321 + ,T_T_selector_ = 322 + ,T_T_NULL_ = 323 + ,T_T_2colon_ = 324 + ,T_T_block_ = 325 + ,T_T_syntax_code_ = 326 + ,T_T_fsm_class_phrase_ = 327 + ,T_T_fsm_phrase_ = 328 + ,T_T_parallel_parser_phrase_ = 329 + ,T_T_enum_phrase_ = 330 + ,T_T_terminal_def_ = 331 + ,T_table_entry_ = 332 + ,T_T_sym_tbl_report_card_ = 333 + ,T_T_terminals_phrase_ = 334 + ,T_T_error_symbols_phrase_ = 335 + ,T_T_lr1_k_phrase_ = 336 + ,T_T_rc_phrase_ = 337 + ,T_T_rule_lhs_phrase_ = 338 + ,T_T_parallel_monitor_phrase_ = 339 + ,T_rule_def_ = 340 + ,T_T_rules_phrase_ = 341 + ,T_T_subrule_def_ = 342 + ,T_T_subrules_phrase_ = 343 + ,T_T_in_stbl_ = 344 + ,T_refered_T_ = 345 + ,T_rule_in_stbl_ = 346 + ,T_refered_rule_ = 347 + ,T_T_transitive_ = 348 + ,T_T_grammar_name_ = 349 + ,T_T_thread_name_ = 350 + ,T_T_monolithic_ = 351 + ,T_T_no_of_T_ = 352 + ,T_T_list_of_native_first_set_terminals_ = 353 + ,T_T_end_list_of_native_first_set_terminals_ = 354 + ,T_T_list_of_transitive_threads_ = 355 + ,T_T_end_list_of_transitive_threads_ = 356 + ,T_T_emitfile_ = 357 + ,T_T_preamble_ = 358 + ,T_T_end_preamble_ = 359 + ,T_T_T_alphabet_ = 360 + ,T_T_end_T_alphabet_ = 361 + ,T_T_file_of_T_alphabet_ = 362 + ,T_T_attributes_ = 363 + ,T_tth_in_stbl_ = 364 + ,T_thread_attributes_ = 365 + ,T_th_in_stbl_ = 366 + ,T_kw_in_stbl_ = 367 + ,T_T_la_expr_src_ = 368 + ,T_T_eosubrule_ = 369 + ,T_T_called_thread_eosubrule_ = 370 + ,T_T_null_call_thread_eosubrule_ = 371 + ,T_T_cweb_comment_ = 372 + ,T_T_grammar_phrase_ = 373 + ,T_T_cweb_marker_ = 374 + ,T_T_lint_ = 375 + ,T_T_list_of_used_threads_ = 376 + ,T_T_end_list_of_used_threads_ = 377 + ,T_Err_nested_files_exceeded_ = 378 + ,T_Err_no_end_of_code_ = 379 + ,T_Err_no_cmd_lne_data_ = 380 + ,T_Err_no_filename_ = 381 + ,T_Err_bad_filename_ = 382 + ,T_Err_bad_fsmheader_filename_ = 383 + ,T_Err_bad_fsmcpp_filename_ = 384 + ,T_Err_bad_fsmsym_filename_ = 385 + ,T_Err_bad_fsmtbl_filename_ = 386 + ,T_Err_bad_enum_filename_ = 387 + ,T_Err_bad_errors_hdrfilename_ = 388 + ,T_Err_bad_errors_impfilename_ = 389 + ,T_Err_bad_cmd_lne_opt_ = 390 + ,T_Err_bad_int_no_ = 391 + ,T_Err_bad_int_no_range_ = 392 + ,T_Err_no_int_present_ = 393 + ,T_Err_bad_eos_ = 394 + ,T_Err_bad_esc_ = 395 + ,T_Err_comment_overrun_ = 396 + ,T_Err_bad_char_ = 397 + ,T_Err_bad_univ_seq_ = 398 + ,T_Err_improper_closing_of_rules_ = 399 + ,T_Err_no_identifier_present_ = 400 + ,T_Err_no_directive_present_ = 401 + ,T_Err_duplicate_directive_ = 402 + ,T_Err_no_syntax_code_present_ = 403 + ,T_Err_no_open_parenthesis_ = 404 + ,T_Err_no_close_parenthesis_ = 405 + ,T_Err_no_fsm_id_present_ = 406 + ,T_Err_no_fsm_id_string_ = 407 + ,T_Err_no_fsm_filename_present_ = 408 + ,T_Err_no_fsm_filename_id_present_ = 409 + ,T_Err_no_comma_present_ = 410 + ,T_Err_no_fsm_namespace_present_ = 411 + ,T_Err_no_fsm_namespace_id_present_ = 412 + ,T_Err_no_fsm_class_present_ = 413 + ,T_Err_no_fsm_version_present_ = 414 + ,T_Err_no_fsm_version_string_ = 415 + ,T_Err_no_fsm_date_present_ = 416 + ,T_Err_no_fsm_date_string_ = 417 + ,T_Err_no_fsm_debug_present_ = 418 + ,T_Err_no_fsm_debug_string_ = 419 + ,T_Err_no_fsm_comments_present_ = 420 + ,T_Err_no_fsm_comments_string_ = 421 + ,T_Err_fsm_debug_string_not_true_or_false_ = 422 + ,T_Err_no_pp_thread_function_present_ = 423 + ,T_Err_no_pp_ctrl_mntor_kw_present_ = 424 + ,T_Err_no_pp_fnct_id_present_ = 425 + ,T_Err_no_pp_bndry_present_ = 426 + ,T_Err_no_pp_la_bndary_expr_present_ = 427 + ,T_Err_no_syntax_code_end_present_ = 428 + ,T_Err_no_pp_code_present_ = 429 + ,T_Err_no_pp_code_stc_present_ = 430 + ,T_Err_not_arbitration_code_kw_ = 431 + ,T_Err_no_open_brace_ = 432 + ,T_Err_no_close_brace_ = 433 + ,T_Err_no_constant_defs_present_ = 434 + ,T_Err_no_filename_present_ = 435 + ,T_Err_no_filename_id_present_ = 436 + ,T_Err_no_namespace_present_ = 437 + ,T_Err_no_namespace_id_present_ = 438 + ,T_Err_no_kdefs_code_present_ = 439 + ,T_Err_no_kdefs_kw_present_ = 440 + ,T_Err_no_tdef_code_present_ = 441 + ,T_Err_no_sym_defs_present_ = 442 + ,T_Err_no_terminal_key_present_ = 443 + ,T_Err_dup_entry_in_alphabet_ = 444 + ,T_Err_already_defined_AB_ = 445 + ,T_Err_already_defined_AD_ = 446 + ,T_Err_improper_directive_ = 447 + ,T_Err_no_sym_class_present_ = 448 + ,T_Err_no_sym_class_id_present_ = 449 + ,T_Err_zero_len_sym_ = 450 + ,T_Err_sym_tbl_full_ = 451 + ,T_Err_sym_tbl_char_pool_full_ = 452 + ,T_Err_dup_entry_in_sym_table_ = 453 + ,T_Err_subscript_out_of_range_ = 454 + ,T_Err_sym_tbl_nested_scope_stk_overflow_ = 455 + ,T_Err_sym_tbl_nested_scope_stk_underflow_ = 456 + ,T_Err_sym_tbl_context_buf_overflow_ = 457 + ,T_Err_report_card_ptr_0_ = 458 + ,T_Err_cannot_define_term_after_sufx_dir_ = 459 + ,T_Err_dup_sufx_directive_ = 460 + ,T_Err_terminals_refs_def_after_terminals_ = 461 + ,T_Err_terminals_refs_dup_def_ = 462 + ,T_Err_no_rule_name_present_ = 463 + ,T_Err_no_sub_rule_present_ = 464 + ,T_Err_subrule_use_undefined_T_ = 465 + ,T_Err_stbl_entry_unknown_ = 466 + ,T_Err_subrule_overrun_ = 467 + ,T_Err_stble_has_entry_but_not_a_rule_ = 468 + ,T_Err_file_of_T_alphabet_kw_not_present_ = 469 + ,T_Err_emitfile_kw_not_present_ = 470 + ,T_Err_preamble_kw_not_present_ = 471 + ,T_Err_preamble_srce_code_not_present_ = 472 + ,T_Err_end_preamble_kw_not_present_ = 473 + ,T_Err_cmd_line_chaffe_ = 474 + ,T_Err_T_alphabet_kw_not_present_ = 475 + ,T_Err_T_alphabet_file_not_present_ = 476 + ,T_Err_end_T_alphabet_kw_not_present_ = 477 + ,T_Err_no_terminals_in_T_alphabet_list_ = 478 + ,T_Err_rotten_chr_in_T_alphabet_ = 479 + ,T_Err_transitive_kw_not_present_ = 480 + ,T_Err_grammar_name_kw_not_present_ = 481 + ,T_Err_namespace_kw_not_present_ = 482 + ,T_Err_filename_kw_not_present_ = 483 + ,T_Err_threadname_kw_not_present_ = 484 + ,T_Err_monolithic_kw_not_present_ = 485 + ,T_Err_no_of_T_kw_not_present_ = 486 + ,T_Err_list_of_terminals_kw_not_present_ = 487 + ,T_Err_no_list_of_trans_threads_kw_ = 488 + ,T_Err_no_terminals_present_in_T_alphabet_ = 489 + ,T_Err_transitive_value_bad_ = 490 + ,T_Err_monolithic_value_bad_ = 491 + ,T_Err_grammar_name_value_not_present_ = 492 + ,T_Err_namespace_value_not_present_ = 493 + ,T_Err_threadname_value_not_present_ = 494 + ,T_Err_filename_value_not_present_ = 495 + ,T_Err_no_of_T_value_not_present_ = 496 + ,T_Err_no_of_terminals_not_present_ = 497 + ,T_Err_end_list_native_T_kw_not_present_ = 498 + ,T_Err_end_list_of_transitive_threads_kw_not_present_ = 499 + ,T_Err_no_of_native_Ts_in_list_not_equal_ = 500 + ,T_Err_no_of_threads_in_list_not_equal_ = 501 + ,T_Err_thread_refed_but_not_defined_ = 502 + ,T_Err_bad_T_in_list_ = 503 + ,T_Err_bad_th_in_list_ = 504 + ,T_Err_already_defined_in_fsc_file_ = 505 + ,T_Err_bad_thread_subscript_ = 506 + ,T_Err_not_a_keyword_ = 507 + ,T_Err_no_of_threads_not_present_ = 508 + ,T_Err_bad_T_alphabet_ = 509 + ,T_Err_fsc_file_does_not_exist_ = 510 + ,T_Err_filename_file_does_not_exist_ = 511 + ,T_Err_T_alphabet_file_does_not_exist_ = 512 + ,T_Err_emitfile_file_does_not_exist_ = 513 + ,T_Err_emitfile_file_not_present_ = 514 + ,T_Err_fsc_cntl_file_not_present_ = 515 + ,T_Err_file_of_T_alphabet_not_present_ = 516 + ,T_Err_epsilon_pass_thru_ = 517 + ,T_Err_epsilon_pass_thru_no_Ts_ = 518 + ,T_Err_rule_not_in_stbl_ = 519 + ,T_Err_T_not_in_stbl_ = 520 + ,T_Err_bad_directive_ = 521 + ,T_Err_bad_term_in_la_expr_ = 522 + ,T_Err_empty_set_removal_in_la_expr_ = 523 + ,T_Err_bad_operator_in_la_expr_ = 524 + ,T_Err_not_a_lhs_kw_ = 525 + ,T_Err_pp_la_boundary_attribute_not_fnd_ = 526 + ,T_Err_already_processed_fsm_phase_ = 527 + ,T_Err_already_processed_pp_phase_ = 528 + ,T_Err_already_processed_T_enum_phase_ = 529 + ,T_Err_already_processed_error_phase_ = 530 + ,T_Err_already_processed_rc_phase_ = 531 + ,T_Err_already_processed_lrk_phase_ = 532 + ,T_Err_already_processed_T_phase_ = 533 + ,T_Err_already_processed_rule_phase_ = 534 + ,T_Err_not_T_for_rtned_token_from_th_ = 535 + ,T_Err_not_id_for_ns_in_th_stmt_ = 536 + ,T_Err_not_id_for_th_name_in_th_stmt_ = 537 + ,T_Err_bad_th_qualifier_ = 538 + ,T_Err_not_dbl_colon_in_th_stmt_ = 539 + ,T_Err_not_T_or_R_in_subrule_expr_ = 540 + ,T_Err_not_T_or_R_or_eos_in_subrule_expr_ = 541 + ,T_Err_not_eos_in_subrule_expr_ = 542 + ,T_Err_invalid_logical_name_ = 543 + ,T_Err_invalid_logical_value_ = 544 + ,T_Err_duplicate_logical_name_ = 545 + ,T_Err_missing_terminals_refs_kw_ = 546 + ,T_Err_missing_terminals_sufx_kw_ = 547 + ,T_Err_not_a_terminal_definition_ = 548 + ,T_Err_missing_lrk_sufx_kw_ = 549 + ,T_ERR_sick_grammar_ = 550 + ,T_ERR_no_fsm_phrase_ = 551 + ,T_ERR_no_T_enum_phrase_ = 552 + ,T_ERR_no_lrk_phrase_ = 553 + ,T_ERR_no_rc_phrase_ = 554 + ,T_ERR_no_errors_phrase_ = 555 + ,T_ERR_no_terminals_phrase_ = 556 + ,T_ERR_no_rules_phrase_ = 557 + ,T_Err_used_rule_but_undefined_ = 558 + ,T_Err_rule_already_defined_ = 559 + ,T_Err_la_expr_calc_empty_set_ = 560 + ,T_Err_no_close_brace_ending_rules_defs_ = 561 + ,T_Err_use_of_T_outside_Rules_construct_ = 562 + ,T_Err_not_kw_defining_grammar_construct_ = 563 + ,T_Err_use_of_N_outside_Rules_construct_ = 564 + ,T_Err_misplaced_or_misspelt_Rule_or_T_ = 565 + ,T_Err_not_a_Rule_ = 566 + ,T_Err_empty_file_ = 567 + ,T_Err_not_lhs_pcnrl_mntr_ = 568 + }; // close defining enum list + }; // close defining T_enum +} // end of namespace +#endif |