-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparsetab.py
68 lines (61 loc) · 10.7 KB
/
parsetab.py
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
66
67
68
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.2'
_lr_method = 'LALR'
_lr_signature = 'z&K\x03\x03\xfa\xfel\x12\xf5p\xbf\xa3\xb4\xdbl'
_lr_action_items = {'DO':([13,15,16,17,28,43,50,51,53,54,55,56,57,58,59,60,61,62,63,65,],[-13,-14,-15,31,-29,-28,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,]),'NOTEQUAL':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,35,35,-29,35,-28,35,35,-30,35,-23,-19,-20,None,None,35,-18,-16,-21,-17,-22,35,-31,]),'THEN':([13,15,16,24,28,43,50,51,53,54,55,56,57,58,59,60,61,62,63,65,],[-13,-14,-15,48,-29,-28,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,]),'EQUAL':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,36,36,-29,36,-28,36,36,-30,36,-23,-19,-20,None,None,36,-18,-16,-21,-17,-22,36,-31,]),'VAR':([0,1,2,4,7,8,11,13,15,16,19,20,21,26,27,28,31,43,44,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,65,67,69,73,],[-39,-2,5,-8,-39,-7,-39,-13,-14,-15,-5,-3,-4,-32,-33,-29,-39,-28,-6,-39,-34,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,-9,-39,-10,]),'WHILE':([0,1,2,4,7,8,11,13,15,16,19,20,21,26,27,28,31,43,44,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,65,67,69,73,],[-39,-2,6,-8,-39,-7,-39,-13,-14,-15,-5,-3,-4,-32,-33,-29,-39,-28,-6,-39,-34,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,-9,-39,-10,]),'TIMES':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,38,38,-29,38,-28,38,38,-30,38,38,-19,38,38,38,38,-18,38,38,38,38,38,-31,]),'MINUS':([6,10,12,13,14,15,16,17,18,22,23,24,25,28,29,30,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,68,],[12,12,12,-13,12,-14,-15,41,12,12,-39,41,12,-29,41,12,12,12,12,12,12,12,12,12,12,12,12,-28,41,12,-37,41,-30,41,41,-19,41,41,41,41,-18,-16,41,-17,41,41,-31,-38,]),'GREATEREQUAL':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,32,32,-29,32,-28,32,32,-30,32,None,-19,None,32,32,32,-18,-16,None,-17,None,32,-31,]),'RPAREN':([13,15,16,23,28,29,43,46,47,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,-39,-29,50,-28,65,-35,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-36,-31,]),'SEMICOLON':([4,7,8,11,13,15,16,26,27,28,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,65,67,73,],[-8,19,-7,-39,-13,-14,-15,-32,-33,-29,-28,-6,-34,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,-9,-10,]),'LESS':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,34,34,-29,34,-28,34,34,-30,34,None,-19,None,34,34,34,-18,-16,None,-17,None,34,-31,]),'PLUS':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,39,39,-29,39,-28,39,39,-30,39,39,-19,39,39,39,39,-18,-16,39,-17,39,39,-31,]),'COMMA':([13,15,16,28,43,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,-29,-28,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,68,-31,]),'ASSIGN':([9,11,],[22,25,]),'$end':([0,1,2,3,4,7,8,11,13,15,16,19,20,21,26,27,28,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,65,67,73,],[-39,-2,-1,0,-8,-39,-7,-39,-13,-14,-15,-5,-3,-4,-32,-33,-29,-28,-6,-34,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,-9,-10,]),'END':([1,2,4,7,8,11,13,15,16,19,20,21,26,27,28,31,43,44,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,65,66,67,69,70,71,72,73,],[-2,-1,-8,-39,-7,-39,-13,-14,-15,-5,-3,-4,-32,-33,-29,-39,-28,-6,-39,-34,-30,-26,67,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,-39,-9,-39,-11,73,-12,-10,]),'DIVIDE':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,33,33,-29,33,-28,33,33,-30,33,33,-19,33,33,33,33,-18,33,33,33,33,33,-31,]),'NUMBER':([6,10,12,14,18,22,23,25,30,32,33,34,35,36,37,38,39,40,41,42,45,47,68,],[13,13,13,13,13,13,-39,13,13,13,13,13,13,13,13,13,13,13,13,13,13,-37,-38,]),'LPAREN':([6,9,10,12,14,15,18,22,23,25,30,32,33,34,35,36,37,38,39,40,41,42,45,47,68,],[14,23,14,14,14,23,14,14,-39,14,14,14,14,14,14,14,14,14,14,14,14,14,14,-37,-38,]),'LESSEQUAL':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,40,40,-29,40,-28,40,40,-30,40,None,-19,None,40,40,40,-18,-16,None,-17,None,40,-31,]),'ELSE':([1,2,4,7,8,11,13,15,16,19,20,21,26,27,28,43,44,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,65,66,67,73,],[-2,-1,-8,-39,-7,-39,-13,-14,-15,-5,-3,-4,-32,-33,-29,-28,-6,-39,-34,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,69,-9,-10,]),'ID':([0,1,2,4,5,6,7,8,10,11,12,13,14,15,16,18,19,20,21,22,23,25,26,27,28,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,65,67,68,69,73,],[-39,-2,9,-8,11,15,-39,-7,15,-39,15,-13,15,-14,-15,15,-5,-3,-4,15,-39,15,-32,-33,-29,15,-39,15,15,15,15,15,15,15,15,15,15,15,-28,-6,15,-37,-39,-34,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,-9,-38,-39,-10,]),'IF':([0,1,2,4,7,8,11,13,15,16,19,20,21,26,27,28,31,43,44,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,65,67,69,73,],[-39,-2,10,-8,-39,-7,-39,-13,-14,-15,-5,-3,-4,-32,-33,-29,-39,-28,-6,-39,-34,-30,-26,-23,-19,-20,-25,-24,-27,-18,-16,-21,-17,-22,-31,-9,-39,-10,]),'AND':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,30,30,-29,30,-28,30,30,-30,None,-23,-19,-20,-25,-24,None,-18,-16,-21,-17,-22,30,-31,]),'GREATER':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,42,42,-29,42,-28,42,42,-30,42,None,-19,None,42,42,42,-18,-16,None,-17,None,42,-31,]),'NOT':([6,10,12,14,18,22,23,25,30,32,33,34,35,36,37,38,39,40,41,42,45,47,68,],[18,18,18,18,18,18,-39,18,18,18,18,18,18,18,18,18,18,18,18,18,18,-37,-38,]),'OR':([13,15,16,17,24,28,29,43,44,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,65,],[-13,-14,-15,37,37,-29,37,-28,37,37,-30,None,-23,-19,-20,-25,-24,None,-18,-16,-21,-17,-22,37,-31,]),}
_lr_action = { }
for _k, _v in _lr_action_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_action: _lr_action[_x] = { }
_lr_action[_x][_k] = _y
del _lr_action_items
_lr_goto_items = {'vardeclaration':([2,],[4,]),'elsestnt':([66,],[71,]),'lexp':([23,],[45,]),'blocklist':([0,31,48,69,],[2,2,2,2,]),'expassign':([11,],[26,]),'functioncall':([2,6,10,12,14,18,22,25,30,32,33,34,35,36,37,38,39,40,41,42,45,],[8,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,]),'block':([0,31,48,69,],[3,52,66,72,]),'exp':([6,10,12,14,18,22,25,30,32,33,34,35,36,37,38,39,40,41,42,45,],[17,24,28,29,43,44,49,51,53,54,55,56,57,58,59,60,61,62,63,64,]),'command':([2,],[7,]),'explist':([23,],[46,]),'blockterminator':([7,],[20,]),'empty':([0,7,11,23,31,48,66,69,],[1,21,27,47,1,1,70,1,]),}
_lr_goto = { }
for _k, _v in _lr_goto_items.items():
for _x,_y in zip(_v[0],_v[1]):
if not _x in _lr_goto: _lr_goto[_x] = { }
_lr_goto[_x][_k] = _y
del _lr_goto_items
_lr_productions = [
("S' -> block","S'",1,None,None,None),
('block -> blocklist','block',1,'p_block','/home/mateus/Documents/lua-compiler/parser.py',17),
('blocklist -> empty','blocklist',1,'p_blocklist','/home/mateus/Documents/lua-compiler/parser.py',21),
('blocklist -> blocklist command blockterminator','blocklist',3,'p_blocklist','/home/mateus/Documents/lua-compiler/parser.py',22),
('blockterminator -> empty','blockterminator',1,'p_blockterminator','/home/mateus/Documents/lua-compiler/parser.py',29),
('blockterminator -> SEMICOLON','blockterminator',1,'p_blockterminator','/home/mateus/Documents/lua-compiler/parser.py',30),
('command -> ID ASSIGN exp','command',3,'p_command','/home/mateus/Documents/lua-compiler/parser.py',34),
('command -> functioncall','command',1,'p_command','/home/mateus/Documents/lua-compiler/parser.py',35),
('command -> vardeclaration','command',1,'p_command','/home/mateus/Documents/lua-compiler/parser.py',36),
('command -> WHILE exp DO block END','command',5,'p_command','/home/mateus/Documents/lua-compiler/parser.py',37),
('command -> IF exp THEN block elsestnt END','command',6,'p_command','/home/mateus/Documents/lua-compiler/parser.py',38),
('elsestnt -> empty','elsestnt',1,'p_elsestnt','/home/mateus/Documents/lua-compiler/parser.py',49),
('elsestnt -> ELSE block','elsestnt',2,'p_elsestnt','/home/mateus/Documents/lua-compiler/parser.py',50),
('exp -> NUMBER','exp',1,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',57),
('exp -> ID','exp',1,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',58),
('exp -> functioncall','exp',1,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',59),
('exp -> exp PLUS exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',60),
('exp -> exp MINUS exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',61),
('exp -> exp TIMES exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',62),
('exp -> exp DIVIDE exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',63),
('exp -> exp LESS exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',64),
('exp -> exp LESSEQUAL exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',65),
('exp -> exp GREATER exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',66),
('exp -> exp GREATEREQUAL exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',67),
('exp -> exp EQUAL exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',68),
('exp -> exp NOTEQUAL exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',69),
('exp -> exp AND exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',70),
('exp -> exp OR exp','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',71),
('exp -> NOT exp','exp',2,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',72),
('exp -> MINUS exp','exp',2,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',73),
('exp -> LPAREN exp RPAREN','exp',3,'p_exp','/home/mateus/Documents/lua-compiler/parser.py',74),
('functioncall -> ID LPAREN explist RPAREN','functioncall',4,'p_functioncall','/home/mateus/Documents/lua-compiler/parser.py',90),
('vardeclaration -> VAR ID expassign','vardeclaration',3,'p_vardeclaration','/home/mateus/Documents/lua-compiler/parser.py',94),
('expassign -> empty','expassign',1,'p_expassign','/home/mateus/Documents/lua-compiler/parser.py',98),
('expassign -> ASSIGN exp','expassign',2,'p_expassign','/home/mateus/Documents/lua-compiler/parser.py',99),
('explist -> empty','explist',1,'p_explist','/home/mateus/Documents/lua-compiler/parser.py',106),
('explist -> lexp exp','explist',2,'p_explist','/home/mateus/Documents/lua-compiler/parser.py',107),
('lexp -> empty','lexp',1,'p_lexp','/home/mateus/Documents/lua-compiler/parser.py',114),
('lexp -> lexp exp COMMA','lexp',3,'p_lexp','/home/mateus/Documents/lua-compiler/parser.py',115),
('empty -> <empty>','empty',0,'p_empty','/home/mateus/Documents/lua-compiler/parser.py',127),
]