summaryrefslogtreecommitdiff
path: root/web/yacco2/grammar-testsuite/pager_1.lex
blob: c0035e17b0967211f5ecd47db7973300442e8cd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
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
}

}