1: actions
2: 0 : {'id': ('s', 11), '(': ('s', 9)}
3: 1 : {'+': ('s', 3), '<EOF>': ('a', None)}
4: 2 : {'+': ('s', 3), ')': ('s', 10)}
5: 3 : {'id': ('s', 11), '(': ('s', 9)}
6: 4 : {'<EOF>': ('r', 1), '*': ('s', 6), '+': ('r', 1), ')': ('r', 1)}
7: 5 : {'<EOF>': ('r', 2), '*': ('s', 6), '+': ('r', 2), ')': ('r', 2)}
8: 6 : {'id': ('s', 11), '(': ('s', 9)}
9: 7 : {'<EOF>': ('r', 3), '*': ('r', 3), '+': ('r', 3), ')': ('r', 3)}
10: 8 : {'<EOF>': ('r', 4), '*': ('r', 4), '+': ('r', 4), ')': ('r', 4)}
11: 9 : {'id': ('s', 11), '(': ('s', 9)}
12: 10 : {'<EOF>': ('r', 5), '*': ('r', 5), '+': ('r', 5), ')': ('r', 5)}
13: 11 : {'<EOF>': ('r', 6), '*': ('r', 6), '+': ('r', 6), ')': ('r', 6)}
14: gotos
15: 0 : {'F': 8, 'T': 5, 'E': 1}
16: 1 : {}
17: 2 : {}
18: 3 : {'F': 8, 'T': 4}
19: 4 : {}
20: 5 : {}
21: 6 : {'F': 7}
22: 7 : {}
23: 8 : {}
24: 9 : {'F': 8, 'T': 5, 'E': 2}
25: 10 : {}
26: 11 : {}
27: calling fdummy with args (('id', 3),)
28: calling fdummy with args (('F', 3),)
29: calling fdummy with args (('T', 3),)
30: calling fdummy with args (('id', 4),)
31: calling fdummy with args (('F', 4),)
32: calling fdummy with args (('id', 2),)
33: multiplying 4 with 2
34: calling fdummy with args (('T', 8),)
35: handling parens, returning whats in between
36: calling fdummy with args (('F', 8),)
37: adding 3 with 8
38: handling parens, returning whats in between
39: calling fdummy with args (('F', 11),)
40: calling fdummy with args (('id', 2),)
41: multiplying 11 with 2
42: calling fdummy with args (('id', 5),)
43: multiplying 22 with 5
44: calling fdummy with args (('T', 110),)
45: Accept
46: RESULT= ('E', 110)
47: bootgram= [('G', ['Plist'], <function just_copy at 80ba6d0>), ('Plist', ['Plist', 'P'], <function add_production_to_list at 8147900>), ('Plist', ['P'], <function new_production_list at 812d308>), ('P', ['NAME', '=', 'RHS', '{', 'NAME', '}', 'NEWLINE'], <function build_production at 8159310>), ('RHS', ['RHS', 'SYM'], <function add_symbol_to_list at 815aaf0>), ('RHS', ['SYM'], <function new_symbol_list at 80a0de0>), ('SYM', ['NAME'], <function name_as_symbol at 80ba690>), ('SYM', ['STRING'], <function string_as_symbol at 80ba6b0>)]
48: actions
49: 0 : {'NAME': ('s', 5)}
50: 1 : {'<EOF>': ('a', None)}
51: 2 : {'<EOF>': ('r', 1), 'NAME': ('s', 5)}
52: 3 : {'<EOF>': ('r', 2), 'NAME': ('r', 2)}
53: 4 : {'<EOF>': ('r', 3), 'NAME': ('r', 3)}
54: 5 : {'=': ('s', 6)}
55: 6 : {'NAME': ('s', 14), 'STRING': ('s', 15)}
56: 7 : {'{': ('s', 8), 'NAME': ('s', 14), 'STRING': ('s', 15)}
57: 8 : {'NAME': ('s', 9)}
58: 9 : {'}': ('s', 10)}
59: 10 : {'NEWLINE': ('s', 11)}
60: 11 : {'<EOF>': ('r', 4), 'NAME': ('r', 4)}
61: 12 : {'{': ('r', 5), 'NAME': ('r', 5), 'STRING': ('r', 5)}
62: 13 : {'{': ('r', 6), 'NAME': ('r', 6), 'STRING': ('r', 6)}
63: 14 : {'{': ('r', 7), 'NAME': ('r', 7), 'STRING': ('r', 7)}
64: 15 : {'{': ('r', 8), 'NAME': ('r', 8), 'STRING': ('r', 8)}
65: gotos
66: 0 : {'G': 1, 'Plist': 2, 'P': 4}
67: 1 : {}
68: 2 : {'P': 3}
69: 3 : {}
70: 4 : {}
71: 5 : {}
72: 6 : {'RHS': 7, 'SYM': 13}
73: 7 : {'SYM': 12}
74: 8 : {}
75: 9 : {}
76: 10 : {}
77: 11 : {}
78: 12 : {}
79: 13 : {}
80: 14 : {}
81: 15 : {}
82:
83: ---------------------------------------------------
84: TABLES FOR MANUALLY CONSTRUCTED GRAMMAR GENERATED
85: ---------------------------------------------------
86:
87: tokens= [('NAME', 'G'), ('=', '='), ('NAME', 'Plist'), ('{', '{'), ('NAME', 'just_copy'), ('}', '}'), ('NEWLINE', '\012'), ('NAME', 'Plist'), ('=', '='), ('NAME', 'Plist'), ('NAME', 'P'), ('{', '{'), ('NAME', 'add_production_to_list'), ('}', '}'), ('NEWLINE', '\012'), ('NAME', 'Plist'), ('=', '='), ('NAME', 'P'), ('{', '{'), ('NAME', 'new_production_list'), ('}', '}'), ('NEWLINE', '\012'), ('NAME', 'P'), ('=', '='), ('NAME', 'NAME'), ('STRING', '='), ('NAME', 'RHS'), ('STRING', '{'), ('NAME', 'NAME'), ('STRING', '}'), ('NAME', 'NEWLINE'), ('{', '{'), ('NAME', 'build_production'), ('}', '}'), ('NEWLINE', '\012'), ('NAME', 'RHS'), ('=', '='), ('NAME', 'RHS'), ('NAME', 'SYM'), ('{', '{'), ('NAME', 'add_symbol_to_list'), ('}', '}'), ('NEWLINE', '\012'), ('NAME', 'RHS'), ('=', '='), ('NAME', 'SYM'), ('{', '{'), ('NAME', 'new_symbol_list'), ('}', '}'), ('NEWLINE', '\012'), ('NAME', 'SYM'), ('=', '='), ('NAME', 'NAME'), ('{', '{'), ('NAME', 'name_as_symbol'), ('}', '}'), ('NEWLINE', '\012'), ('NAME', 'SYM'), ('=', '='), ('NAME', 'STRING'), ('{', '{'), ('NAME', 'string_as_symbol'), ('}', '}'), ('NEWLINE', '\012')]
88: G = Plist { just_copy }
89: Plist = Plist P { add_production_to_list }
90: Plist = P { new_production_list }
91: P = NAME = RHS { NAME } NEWLINE { build_production }
92: RHS = RHS SYM { add_symbol_to_list }
93: RHS = SYM { new_symbol_list }
94: SYM = NAME { name_as_symbol }
95: SYM = STRING { string_as_symbol }
96:
97: Accept
98: RESULT= ['G' -> ['Plist'] {'func': 'just_copy'}, 'Plist' -> ['Plist', 'P'] {'func': 'add_production_to_list'}, 'Plist' -> ['P'] {'func': 'new_production_list'}, 'P' -> ['NAME', '=', 'RHS', '{', 'NAME', '}', 'NEWLINE'] {'func': 'build_production'}, 'RHS' -> ['RHS', 'SYM'] {'func': 'add_symbol_to_list'}, 'RHS' -> ['SYM'] {'func': 'new_symbol_list'}, 'SYM' -> ['NAME'] {'func': 'name_as_symbol'}, 'SYM' -> ['STRING'] {'func': 'string_as_symbol'}]
99: BOUND= ['G' -> ['Plist'] {'func': <function just_copy at 80ba6d0>}, 'Plist' -> ['Plist', 'P'] {'func': <function add_production_to_list at 8147900>}, 'Plist' -> ['P'] {'func': <function new_production_list at 812d308>}, 'P' -> ['NAME', '=', 'RHS', '{', 'NAME', '}', 'NEWLINE'] {'func': <function build_production at 8159310>}, 'RHS' -> ['RHS', 'SYM'] {'func': <function add_symbol_to_list at 815aaf0>}, 'RHS' -> ['SYM'] {'func': <function new_symbol_list at 80a0de0>}, 'SYM' -> ['NAME'] {'func': <function name_as_symbol at 80ba690>}, 'SYM' -> ['STRING'] {'func': <function string_as_symbol at 80ba6b0>}]
100: 0 : 'G' -> ['Plist'] {'func': <function just_copy at 80ba6d0>}
101: 1 : 'Plist' -> ['Plist', 'P'] {'func': <function add_production_to_list at 8147900>}
102: 2 : 'Plist' -> ['P'] {'func': <function new_production_list at 812d308>}
103: 3 : 'P' -> ['NAME', '=', 'RHS', '{', 'NAME', '}', 'NEWLINE'] {'func': <function build_production at 8159310>}
104: 4 : 'RHS' -> ['RHS', 'SYM'] {'func': <function add_symbol_to_list at 815aaf0>}
105: 5 : 'RHS' -> ['SYM'] {'func': <function new_symbol_list at 80a0de0>}
106: 6 : 'SYM' -> ['NAME'] {'func': <function name_as_symbol at 80ba690>}
107: 7 : 'SYM' -> ['STRING'] {'func': <function string_as_symbol at 80ba6b0>}
108: Symbols set('SYM', 'Plist', '=', 'NEWLINE', 'RHS', '}', 'STRING', 'NAME', 'P', '{')
109: Terminals set('STRING', '}', 'NEWLINE', 'NAME', '=', '{')
110: NonTerminals set('G', 'Plist', 'SYM', 'RHS', 'P')
111: Directly Derive epsilon set()
112: Derive epsilon set()
113: First Sets:
114: -1 -> set(-1)
115: Plist -> set('NAME')
116: } -> set('}')
117: { -> set('{')
118: P -> set('NAME')
119: <EPS> -> set('<EPS>')
120: NAME -> set('NAME')
121: = -> set('=')
122: SYM -> set('STRING', 'NAME')
123: <EOF> -> set('<EOF>')
124: NEWLINE -> set('NEWLINE')
125: RHS -> set('STRING', 'NAME')
126: G -> set('NAME')
127: STRING -> set('STRING')
128: Follow Sets:
129: G -> set('<EOF>')
130: Plist -> set('<EOF>', 'NAME')
131: SYM -> set('{', 'STRING', 'NAME')
132: RHS -> set('{', 'STRING', 'NAME')
133: P -> set('<EOF>', 'NAME')
134: found 4 more kernels
135: found 2 more kernels
136: found 4 more kernels
137: found 2 more kernels
138: found 1 more kernels
139: found 1 more kernels
140: found 1 more kernels
141: initLALR1items, kernels done, calculating propagations and spontaneous lookaheads
142: . . . . . . . . . . . . . . . . done init LALR1items
143: done with lalr1items, reorganizing the data
144: actions
145: 0 : {'NAME': ('s', 5)}
146: 1 : {'<EOF>': ('a', None)}
147: 2 : {'<EOF>': ('r', 1), 'NAME': ('s', 5)}
148: 3 : {'<EOF>': ('r', 2), 'NAME': ('r', 2)}
149: 4 : {'<EOF>': ('r', 3), 'NAME': ('r', 3)}
150: 5 : {'=': ('s', 6)}
151: 6 : {'NAME': ('s', 14), 'STRING': ('s', 15)}
152: 7 : {'{': ('s', 8), 'NAME': ('s', 14), 'STRING': ('s', 15)}
153: 8 : {'NAME': ('s', 9)}
154: 9 : {'}': ('s', 10)}
155: 10 : {'NEWLINE': ('s', 11)}
156: 11 : {'<EOF>': ('r', 4), 'NAME': ('r', 4)}
157: 12 : {'{': ('r', 5), 'NAME': ('r', 5), 'STRING': ('r', 5)}
158: 13 : {'{': ('r', 6), 'NAME': ('r', 6), 'STRING': ('r', 6)}
159: 14 : {'{': ('r', 7), 'NAME': ('r', 7), 'STRING': ('r', 7)}
160: 15 : {'{': ('r', 8), 'NAME': ('r', 8), 'STRING': ('r', 8)}
161: gotos
162: 0 : {'G': 1, 'Plist': 2, 'P': 4}
163: 1 : {}
164: 2 : {'P': 3}
165: 3 : {}
166: 4 : {}
167: 5 : {}
168: 6 : {'RHS': 7, 'SYM': 13}
169: 7 : {'SYM': 12}
170: 8 : {}
171: 9 : {}
172: 10 : {}
173: 11 : {}
174: 12 : {}
175: 13 : {}
176: 14 : {}
177: 15 : {}
178:
179: --------------------------------------------------------
180: TABLES FOR AUTOMATICALLY CONSTRUCTED GRAMMAR GENERATED
181: --------------------------------------------------------
182:
183: Accept
184: RESULT= ['G' -> ['Plist'] {'func': 'just_copy'}, 'Plist' -> ['Plist', 'P'] {'func': 'add_production_to_list'}, 'Plist' -> ['P'] {'func': 'new_production_list'}, 'P' -> ['NAME', '=', 'RHS', '{', 'NAME', '}', 'NEWLINE'] {'func': 'build_production'}, 'RHS' -> ['RHS', 'SYM'] {'func': 'add_symbol_to_list'}, 'RHS' -> ['SYM'] {'func': 'new_symbol_list'}, 'SYM' -> ['NAME'] {'func': 'name_as_symbol'}, 'SYM' -> ['STRING'] {'func': 'string_as_symbol'}]
185: --------------------------------------------------------
186: IF THAT WORKED, WE HAVE A BOOTSTRAP
187: --------------------------------------------------------
188: Accept
189: RESULT= ['G' -> ['S'] {'func': 'dummy'}, 'S' -> ['if', 'E', 'then', 'S', 'else', 'S'] {'func': 'dummy'}, 'S' -> ['if', 'E', 'then', 'S'] {'func': 'dummy'}, 'S' -> ['X'] {'func': 'dummy'}, 'E' -> ['X'] {'func': 'dummy'}]
190: BOUND= ['G' -> ['S'] {'func': <function dummy at 814eef8>}, 'S' -> ['if', 'E', 'then', 'S', 'else', 'S'] {'func': <function dummy at 814eef8>}, 'S' -> ['if', 'E', 'then', 'S'] {'func': <function dummy at 814eef8>}, 'S' -> ['X'] {'func': <function dummy at 814eef8>}, 'E' -> ['X'] {'func': <function dummy at 814eef8>}]
191: 0 : 'G' -> ['S'] {'func': <function dummy at 814eef8>}
192: 1 : 'S' -> ['if', 'E', 'then', 'S', 'else', 'S'] {'func': <function dummy at 814eef8>}
193: 2 : 'S' -> ['if', 'E', 'then', 'S'] {'func': <function dummy at 814eef8>}
194: 3 : 'S' -> ['X'] {'func': <function dummy at 814eef8>}
195: 4 : 'E' -> ['X'] {'func': <function dummy at 814eef8>}
196: Symbols set('if', 'X', 'E', 'else', 'S', 'then')
197: Terminals set('if', 'then', 'X', 'else')
198: NonTerminals set('S', 'G', 'E')
199: Directly Derive epsilon set()
200: Derive epsilon set()
201: First Sets:
202: if -> set('if')
203: -1 -> set(-1)
204: <EOF> -> set('<EOF>')
205: X -> set('X')
206: G -> set('if', 'X')
207: <EPS> -> set('<EPS>')
208: E -> set('X')
209: else -> set('else')
210: S -> set('if', 'X')
211: then -> set('then')
212: Follow Sets:
213: G -> set('<EOF>')
214: E -> set('then')
215: S -> set('else', '<EOF>')
216: found 4 more kernels
217: found 2 more kernels
218: found 1 more kernels
219: found 1 more kernels
220: found 1 more kernels
221: found 1 more kernels
222: initLALR1items, kernels done, calculating propagations and spontaneous lookaheads
223: . . . . . . . . . . . done init LALR1items
224: done with lalr1items, reorganizing the data
225: Shift/Reduce Conflict, Use Shift [6,'else']: ('r', 3) -> ('s', 7)
226: actions
227: 0 : {'if': ('s', 3), 'X': ('s', 9)}
228: 1 : {'<EOF>': ('a', None)}
229: 2 : {'<EOF>': ('r', 1)}
230: 3 : {'X': ('s', 10)}
231: 4 : {'then': ('s', 5)}
232: 5 : {'if': ('s', 3), 'X': ('s', 9)}
233: 6 : {'else': ('s', 7), '<EOF>': ('r', 3)}
234: 7 : {'if': ('s', 3), 'X': ('s', 9)}
235: 8 : {'else': ('r', 2), '<EOF>': ('r', 2)}
236: 9 : {'else': ('r', 4), '<EOF>': ('r', 4)}
237: 10 : {'then': ('r', 5)}
238: gotos
239: 0 : {'S': 2, 'G': 1}
240: 1 : {}
241: 2 : {}
242: 3 : {'E': 4}
243: 4 : {}
244: 5 : {'S': 6}
245: 6 : {}
246: 7 : {'S': 8}
247: 8 : {}
248: 9 : {}
249: 10 : {}
250: [('if', 'if'), ('X', 'X'), ('then', 'then'), ('X', 'X'), ('else', 'else'), ('X', 'X')]
251: dummy:reduce 'E' -> ['X'] {'func': <function dummy at 814eef8>} args= (('X', 'X'),)
252: dummy:reduce 'S' -> ['X'] {'func': <function dummy at 814eef8>} args= (('X', 'X'),)
253: dummy:reduce 'S' -> ['X'] {'func': <function dummy at 814eef8>} args= (('X', 'X'),)
254: dummy:reduce 'S' -> ['if', 'E', 'then', 'S', 'else', 'S'] {'func': <function dummy at 814eef8>} args= (('if', 'if'), ('E', None), ('then', 'then'), ('S', None), ('else', 'else'), ('S', None))
255: dummy:reduce 'G' -> ['S'] {'func': <function dummy at 814eef8>} args= (('S', None),)
256: Accept
257: RESULT= None