Debian Codegraph @

documentation/manual/algorithm/demos/rr1

raw
1 %stype char *
2 %token WORD
3
4 %%
5
6 sequence:
7 // empty
8 {
9 cout << "empty sequence\n";
10 }
11 |
12 maybeword
13 |
14 sequence WORD
15 {
16 cout << "added word " << $2 << endl;
17 }
18 ;
19
20 maybeword:
21 // empty
22 {
23 cout << "empty maybeword\n";
24 }
25 |
26 WORD
27 {
28 cout << "single word " << $1 << endl;
29 }
30 ;