-
Notifications
You must be signed in to change notification settings - Fork 0
/
parsetab.py
70 lines (63 loc) · 8.55 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
69
70
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.8'
_lr_method = 'LALR'
_lr_signature = '7FB20F2C7244AA3E93BAA234403E1A18'
_lr_action_items = {'NUMBER':([0,3,6,9,10,12,21,22,23,24,25,26,27,28,29,30,31,34,36,37,40,42,67,73,74,80,],[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,-4,1,1,1,1,1,-9,1,-3,]),'ANDAND':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,21,-18,-21,-23,-18,21,21,21,-27,-33,-35,-36,-30,21,-31,-32,-28,-29,-34,-24,21,21,21,-37,-9,-25,]),'STRING':([0,3,6,9,10,12,21,22,23,24,25,26,27,28,29,30,31,34,36,37,40,42,67,73,74,80,],[2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,-4,2,2,2,2,2,-9,2,-3,]),'$end':([0,7,9,32,34,73,80,],[-2,0,-2,-1,-4,-9,-3,]),'PLUS':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,22,-18,-21,-23,-18,22,22,22,22,-33,-35,-36,22,22,22,22,22,22,-34,-24,22,22,22,-37,-9,-25,]),'DIVIDE':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,24,-18,-21,-23,-18,24,24,24,24,24,-35,-36,24,24,24,24,24,24,24,-24,24,24,24,-37,-9,-25,]),'FALSE':([0,3,6,9,10,12,21,22,23,24,25,26,27,28,29,30,31,34,36,37,40,42,67,73,74,80,],[4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,-4,4,4,4,4,4,-9,4,-3,]),'VAR':([0,9,34,42,73,74,80,],[5,5,-4,5,-9,5,-3,]),'IF':([0,9,34,42,73,74,80,],[6,6,-4,6,-9,6,-3,]),'NOT':([0,3,6,9,10,12,21,22,23,24,25,26,27,28,29,30,31,34,36,37,40,42,67,73,74,80,],[3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,-4,3,3,3,3,3,-9,3,-3,]),'LE':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,27,-18,-21,-23,-18,27,27,27,27,-33,-35,-36,-30,27,-31,-32,27,-29,-34,-24,27,27,27,-37,-9,-25,]),'EQUALEQUAL':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,29,-18,-21,-23,-18,29,29,29,29,-33,-35,-36,-30,29,-31,-32,-28,-29,-34,-24,29,29,29,-37,-9,-25,]),'COMMA':([1,2,4,15,16,17,43,44,45,46,47,48,49,50,51,52,53,54,56,60,68,73,78,],[-19,-20,-22,-21,-23,-18,-27,-33,-35,-36,-30,-26,-31,-32,-28,-29,-34,-24,67,70,-37,-9,-25,]),'RPAREN':([1,2,4,15,16,17,35,37,39,43,44,45,46,47,48,49,50,51,52,53,54,56,57,58,59,60,61,62,68,69,73,75,77,78,],[-19,-20,-22,-21,-23,-18,54,-39,-6,-27,-33,-35,-36,-30,-26,-31,-32,-28,-29,-34,-24,-41,-38,68,-6,-8,-5,71,-37,76,-9,-40,-7,-25,]),'RETURN':([0,9,34,42,73,74,80,],[10,10,-4,10,-9,10,-3,]),'GT':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,25,-18,-21,-23,-18,25,25,25,25,-33,-35,-36,-30,25,-31,-32,25,-29,-34,-24,25,25,25,-37,-9,-25,]),'ELSE':([41,73,],[64,-9,]),'TIMES':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,23,-18,-21,-23,-18,23,23,23,23,23,-35,-36,23,23,23,23,23,23,23,-24,23,23,23,-37,-9,-25,]),'RBRACE':([42,65,74,79,],[-11,73,-11,-10,]),'LPAREN':([0,3,6,9,10,12,13,14,17,18,21,22,23,24,25,26,27,28,29,30,31,34,36,37,38,40,42,67,73,74,80,],[12,12,12,12,12,12,37,39,37,39,12,12,12,12,12,12,12,12,12,12,12,-4,12,12,59,12,12,12,-9,12,-3,]),'OROR':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,26,-18,-21,-23,-18,26,26,26,-27,-33,-35,-36,-30,-26,-31,-32,-28,-29,-34,-24,26,26,26,-37,-9,-25,]),'IDENTIFIER':([0,3,5,6,9,10,12,14,21,22,23,24,25,26,27,28,29,30,31,34,36,37,39,40,42,59,67,70,73,74,80,],[13,17,19,17,13,17,17,38,17,17,17,17,17,17,17,17,17,17,17,-4,17,17,60,17,13,60,17,60,-9,13,-3,]),'FUNCTION':([0,3,6,9,10,12,21,22,23,24,25,26,27,28,29,30,31,34,36,37,40,42,67,73,74,80,],[14,18,18,14,18,18,18,18,18,18,18,18,18,18,18,18,18,-4,18,18,18,18,18,-9,18,-3,]),'GE':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,28,-18,-21,-23,-18,28,28,28,28,-33,-35,-36,-30,28,-31,-32,28,-29,-34,-24,28,28,28,-37,-9,-25,]),'TRUE':([0,3,6,9,10,12,21,22,23,24,25,26,27,28,29,30,31,34,36,37,40,42,67,73,74,80,],[15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,-4,15,15,15,15,15,-9,15,-3,]),'EQUAL':([13,19,],[36,40,]),'LBRACE':([1,2,4,15,16,17,20,43,44,45,46,47,48,49,50,51,52,53,54,64,68,71,73,76,78,],[-19,-20,-22,-21,-23,-18,42,-27,-33,-35,-36,-30,-26,-31,-32,-28,-29,-34,-24,42,-37,42,-9,42,-25,]),'LT':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,30,-18,-21,-23,-18,30,30,30,30,-33,-35,-36,-30,30,-31,-32,30,-29,-34,-24,30,30,30,-37,-9,-25,]),'MINUS':([1,2,4,8,13,15,16,17,20,33,35,43,44,45,46,47,48,49,50,51,52,53,54,55,56,63,68,73,78,],[-19,-20,-22,31,-18,-21,-23,-18,31,31,31,31,-33,-35,-36,31,31,31,31,31,31,-34,-24,31,31,31,-37,-9,-25,]),'SEMICOLON':([1,2,4,8,11,13,15,16,17,33,41,43,44,45,46,47,48,49,50,51,52,53,54,55,63,66,68,72,73,78,],[-19,-20,-22,-17,34,-18,-21,-23,-18,-15,-12,-27,-33,-35,-36,-30,-26,-31,-32,-28,-29,-34,-24,-14,-16,74,-37,-13,-9,-25,]),}
_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 = {'js':([0,9,],[7,32,]),'exp':([0,3,6,9,10,12,21,22,23,24,25,26,27,28,29,30,31,36,37,40,42,67,74,],[8,16,20,8,33,35,43,44,45,46,47,48,49,50,51,52,53,55,56,63,8,56,8,]),'params':([39,59,70,],[61,61,77,]),'statements':([42,74,],[65,79,]),'args':([37,67,],[57,75,]),'compoundstmt':([20,64,71,76,],[41,72,78,80,]),'stmt':([0,9,42,74,],[11,11,66,66,]),'optparams':([39,59,],[62,69,]),'element':([0,9,],[9,9,]),'optargs':([37,],[58,]),}
_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' -> js","S'",1,None,None,None),
('js -> element js','js',2,'p_js_element','jsgrammar.py',20),
('js -> <empty>','js',0,'p_js_empty','jsgrammar.py',24),
('element -> FUNCTION IDENTIFIER LPAREN optparams RPAREN compoundstmt','element',6,'p_element_function_define','jsgrammar.py',28),
('element -> stmt SEMICOLON','element',2,'p_element_statement','jsgrammar.py',32),
('optparams -> params','optparams',1,'p_optparams_params','jsgrammar.py',36),
('optparams -> <empty>','optparams',0,'p_optparams_empty','jsgrammar.py',40),
('params -> IDENTIFIER COMMA params','params',3,'p_params','jsgrammar.py',44),
('params -> IDENTIFIER','params',1,'p_params_last','jsgrammar.py',48),
('compoundstmt -> LBRACE statements RBRACE','compoundstmt',3,'p_compoundstmt','jsgrammar.py',52),
('statements -> stmt SEMICOLON statements','statements',3,'p_statements','jsgrammar.py',56),
('statements -> <empty>','statements',0,'p_statements_empty','jsgrammar.py',60),
('stmt -> IF exp compoundstmt','stmt',3,'p_stmt_if_then','jsgrammar.py',64),
('stmt -> IF exp compoundstmt ELSE compoundstmt','stmt',5,'p_stmt_if_then_else','jsgrammar.py',68),
('stmt -> IDENTIFIER EQUAL exp','stmt',3,'p_stmt_assign','jsgrammar.py',72),
('stmt -> RETURN exp','stmt',2,'p_stmt_return','jsgrammar.py',76),
('stmt -> VAR IDENTIFIER EQUAL exp','stmt',4,'p_stmt_var','jsgrammar.py',80),
('stmt -> exp','stmt',1,'p_stmt_exp','jsgrammar.py',84),
('exp -> IDENTIFIER','exp',1,'p_exp_identifier','jsgrammar.py',89),
('exp -> NUMBER','exp',1,'p_exp_number','jsgrammar.py',93),
('exp -> STRING','exp',1,'p_exp_string','jsgrammar.py',97),
('exp -> TRUE','exp',1,'p_exp_true','jsgrammar.py',101),
('exp -> FALSE','exp',1,'p_exp_false','jsgrammar.py',105),
('exp -> NOT exp','exp',2,'p_exp_not','jsgrammar.py',109),
('exp -> LPAREN exp RPAREN','exp',3,'p_exp_parens','jsgrammar.py',113),
('exp -> FUNCTION LPAREN optparams RPAREN compoundstmt','exp',5,'p_exp_lambda','jsgrammar.py',117),
('exp -> exp OROR exp','exp',3,'p_binop','jsgrammar.py',121),
('exp -> exp ANDAND exp','exp',3,'p_binop','jsgrammar.py',122),
('exp -> exp EQUALEQUAL exp','exp',3,'p_binop','jsgrammar.py',123),
('exp -> exp LT exp','exp',3,'p_binop','jsgrammar.py',124),
('exp -> exp GT exp','exp',3,'p_binop','jsgrammar.py',125),
('exp -> exp LE exp','exp',3,'p_binop','jsgrammar.py',126),
('exp -> exp GE exp','exp',3,'p_binop','jsgrammar.py',127),
('exp -> exp PLUS exp','exp',3,'p_binop','jsgrammar.py',128),
('exp -> exp MINUS exp','exp',3,'p_binop','jsgrammar.py',129),
('exp -> exp TIMES exp','exp',3,'p_binop','jsgrammar.py',130),
('exp -> exp DIVIDE exp','exp',3,'p_binop','jsgrammar.py',131),
('exp -> IDENTIFIER LPAREN optargs RPAREN','exp',4,'p_call','jsgrammar.py',135),
('optargs -> args','optargs',1,'p_optargs','jsgrammar.py',139),
('optargs -> <empty>','optargs',0,'p_optargs_empty','jsgrammar.py',143),
('args -> exp COMMA args','args',3,'p_args','jsgrammar.py',147),
('args -> exp','args',1,'p_args_last','jsgrammar.py',151),
]