1;---------------------
2; LALR(1) parse tables
3;---------------------
4;
5; Suitable for input to the Common Lisp program
6;
7; LR(1)AndLALR(1)Parser.lsp
8;
9
10; TERMINALS
11;
12
13(|a| |b| $)
14
15; PRODUCTIONS
16;
17; Productions are numbered starting with 1.
18; All alternates were expanded into separate productions.
19
20(
21 ( (1) (S -> S |a| S |b|) )
22 ( (2) (S -> EPSILON) )
23)
24
25; GOTO GRAPH
26;
27; Not needed for the parser, but here for reference and debugging.
28; **********
29; Goto graph of the LR(1) or LALR(1) grammar of the form
30;
31; (
32; ( <-- List of links.
33; (6 |a| 4) <-- Transition in Goto graph from state 6 to
34; state 4 on symbol a.
35; (1 |a| 2) <-- Transition from state 1 to state 2 on a.
36; )
37;
38; ( <-- List of sets of items.
39; ( 0 <-- State number 0.
40; 3668 <-- Hash value of core.
41; (
42; (SP -> DOT S |,| $) ----+
43; ( S -> DOT S |a| S |b| |,| $) |
44; ( S -> DOT EPSILON |,| $) +---- Set of items for state 0
45; ( S -> DOT S |a| S |b| |,| |a|) |
46; ( S -> DOT EPSILON |,| |a|) |
47; ) ----+
48; )
49
50(
51 (
52 (-1 NIL 0)
53 (0 S 1)
54 (1 |a| 2)
55 (2 S 3)
56 (3 |a| 2)
57 (3 |b| 5)
58 )
59 (
60 (1
61 3542
62 (SP -> S DOT |,| $)
63 (S -> S DOT |a| S |b| |,| $)
64 (S -> S DOT |a| S |b| |,| |a|)
65 )
66 (0
67 3668
68 (SP -> DOT S |,| $)
69 (S -> DOT S |a| S |b| |,| $)
70 (S -> DOT EPSILON |,| $)
71 (S -> DOT S |a| S |b| |,| |a|)
72 (S -> DOT EPSILON |,| |a|)
73 )
74 (5
75 4692
76 (S -> S |a| S |b| DOT |,| |b|)
77 (S -> S |a| S |b| DOT |,| $)
78 (S -> S |a| S |b| DOT |,| |a|)
79 )
80 (2
81 5168
82 (S -> S |a| DOT S |b| |,| |b|)
83 (S -> S |a| DOT S |b| |,| $)
84 (S -> S |a| DOT S |b| |,| |a|)
85 (S -> DOT S |a| S |b| |,| |b|)
86 (S -> DOT EPSILON |,| |b|)
87 (S -> DOT S |a| S |b| |,| |a|)
88 (S -> DOT EPSILON |,| |a|)
89 )
90 (3
91 5308
92 (S -> S |a| S DOT |b| |,| |b|)
93 (S -> S |a| S DOT |b| |,| $)
94 (S -> S |a| S DOT |b| |,| |a|)
95 (S -> S DOT |a| S |b| |,| |b|)
96 (S -> S DOT |a| S |b| |,| |a|)
97 )
98 )
99)
100
101; ACTION TABLE
102;
103; (state
104; (item)
105; ...
106
107(
108 ( (0)
109 (
110 ($ (R 2))
111 (|a| (R 2))
112 (DEFAULT (ERROR))
113 )
114 )
115 ( (1)
116 (
117 ($ (ACC NIL))
118 (|a| (S 2))
119 (DEFAULT (ERROR))
120 )
121 )
122 ( (2)
123 (
124 (|b| (R 2))
125 (|a| (R 2))
126 (DEFAULT (ERROR))
127 )
128 )
129 ( (3)
130 (
131 (|b| (S 5))
132 (|a| (S 2))
133 (DEFAULT (ERROR))
134 )
135 )
136 ( (5)
137 (
138 (|b| (R 1))
139 ($ (R 1))
140 (|a| (R 1))
141 (DEFAULT (ERROR))
142 )
143 )
144)
145
146; GOTO TABLE
147;
148; (state
149; (item)
150; ...
151
152(
153 ( (0)
154 (
155 (S 1)
156 (DEFAULT (ERROR))
157 )
158 )
159 ( (2)
160 (
161 (S 3)
162 (DEFAULT (ERROR))
163 )
164 )
165)
166
167
168; ERROR MESSAGE TABLE
169;
170; If the action table has an error state, the other non-error
171; actions show which symbol was failed to appear next on the input.
172;
173; The user can modify these minimal error messages.
174
175
176
177(
178
179 ((0) ("error - expecting one of the symbols |a| $"))
180 ((1) ("error - expecting one of the symbols |a| $"))
181 ((2) ("error - expecting one of the symbols |a| |b|"))
182 ((3) ("error - expecting one of the symbols |a| |b|"))
183 ((5) ("error - expecting one of the symbols |a| $ |b|"))
184)