/* $echo FILE: LR1_tst.lex $echo My grammar to test out merges. $echo This grammar tests out mergers against the reduce / reduce states $echo There are 2 sets of rules RAx and RBx where x is 1 or 2 that produce reduce / reduce $echo conflict states $echo Okay */ /@ @** |LR1_tst| grammar.\fbreak This grammar tests out mergers against the reduce / reduce states. There are 2 sets of rules RAx and RBx where x is 1 or 2 that produce reduce / reduce conflict states. The objectives are:\fbreak \INDENT{.3in}{1) is the grammar LR1? which it is} \INDENT{.3in}{2) proper splitting of conflict states by merging into differenct closure states} @/ fsm (fsm-id "lr1_tst.lex",fsm-filename lr1_tst,fsm-namespace NS_lr1_tst ,fsm-class Clr1_tst_fsm { user-imp-sym // test out Clr1\_tst\_fsm fsm user-imp-sym emit code *** user-imp-tbl // test out Clr1\_tst\_fsm fsm user-imp-tbl emit code *** constructor // test out Clr1\_tst\_fsm fsm constructor emit code *** destructor // test out Clr1\_tst\_fsm fsm destructor emit code *** failed // test out Clr1\_tst\_fsm fsm failed emit code return true; *** op // test out Clr1\_tst\_fsm fsm op emit code *** user-declaration // test out Clr1\_tst\_fsm fsm user-declaration code public: *** user-implementation // test out Clr1\_tst\_fsm fsm user-implementation code *** } ,fsm-version "1.0",fsm-date "12 Nov. 2006" ,fsm-debug "true" ,fsm-comments "test out lr1 compatibility against 2 sets of reduce /reduce conflict states") parallel-parser ( parallel-thread-function TH_lr1_tst *** parallel-la-boundary eolr *** ) @"/usr/local/yacco2/compiler/grammars/yacco2_T_includes.T" rules { Rlr1_tst( lhs { constructor // test out Rlr1\_tst rule constructor emit code *** destructor // test out Rlr1\_tst rule destructor emit code *** op // test out Rlr1\_tst rule op emit code *** user-declaration // test out Rlr1\_tst rule user-declaration code public: *** user-implementation // test out Rlr1\_tst rule user-implementation code *** } ){ -> u RAabBab eog { op // test out subrule u RAabBab eog op emit code *** } -> v RAbaBab eog -> w RAabBba eog -> x RAbaBba eog } RAabBab(){ -> RAab m -> RBab n } RAbaBab(){ -> RAba m -> RBab n } RAabBba(){ -> RAab m -> RBba n } RAbaBba(){ -> RAba m -> RBba n } RAab(){ -> RA1 a -> RA2 b } RAba(){ -> RA1 b -> RA2 a } RBab(){ -> RB1 a -> RB2 b } RBba(){ -> RB1 b -> RB2 a } RA1(){ -> a } RA2(){ -> a } RB1(){ -> b } RB2(){ -> b } } // end of grammar