-
Notifications
You must be signed in to change notification settings - Fork 1
/
parsetab.py
executable file
·86 lines (79 loc) · 16.9 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# parsetab.py
# This file is automatically generated. Do not edit.
_tabversion = '3.8'
_lr_method = 'LALR'
_lr_signature = 'CE8BA0EB056168D24813A762D0915FF0'
_lr_action_items = {'CLASS':([0,2,6,8,],[4,4,-3,-2,]),'$end':([1,2,6,8,],[0,-1,-3,-2,]),'POINT_AND_COMMA':([3,5,14,17,18,28,35,40,41,42,43,44,45,55,71,76,77,78,79,84,91,92,93,94,95,96,97,98,99,101,109,110,120,123,128,129,134,141,144,145,],[6,8,19,-4,23,-13,-5,-17,-12,-18,-19,-20,-21,-51,100,-47,-48,-49,-50,-25,-33,-34,-35,-36,-37,-38,-39,-22,114,-40,-11,-32,-52,-10,-42,-43,-26,-41,-31,147,]),'TYPE_ID':([4,10,21,30,33,37,51,62,107,131,132,],[7,16,28,36,39,57,76,90,122,137,138,]),'O_KEY':([7,16,34,39,46,47,48,49,50,52,53,54,57,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[9,22,46,58,46,46,46,46,46,46,46,46,82,46,46,46,46,46,46,46,46,46,46,46,46,-24,46,46,46,46,46,-23,46,46,46,46,46,]),'INHERITS':([7,],[10,]),'C_KEY':([9,11,12,13,19,22,23,29,40,42,43,44,45,55,70,76,77,78,79,83,84,91,92,93,94,95,96,97,98,100,101,108,110,114,120,128,129,134,141,144,],[-57,17,-6,-7,-9,-57,-8,35,-17,-18,-19,-20,-21,-51,98,-47,-48,-49,-50,109,-25,-33,-34,-35,-36,-37,-38,-39,-22,-24,-40,123,-32,-23,-52,-42,-43,-26,-41,-31,]),'ID':([9,12,19,20,22,23,32,34,46,47,48,49,50,52,53,54,56,58,59,60,61,63,64,65,66,67,68,69,70,82,100,102,103,104,105,106,111,112,113,114,117,118,127,130,133,135,142,143,147,],[15,15,-9,24,15,-8,24,40,40,40,40,40,40,40,40,40,81,40,40,40,89,40,40,40,40,40,40,40,40,40,-24,40,40,119,40,121,40,40,126,-23,119,-45,40,-44,40,40,40,40,-46,]),'O_PAR':([15,34,40,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,89,100,102,103,105,111,112,114,126,127,133,135,142,143,],[20,47,60,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,47,112,-24,47,47,47,47,47,-23,135,47,47,47,47,47,]),'TWO_POINTS':([15,24,26,31,81,119,121,],[21,30,33,37,107,131,132,]),'C_PAR':([20,25,27,36,38,40,42,43,44,45,55,60,72,76,77,78,79,84,85,86,87,88,91,92,93,94,95,96,97,98,101,110,112,120,124,125,128,129,134,135,140,141,144,],[26,31,-15,-16,-14,-17,-18,-19,-20,-21,-51,-57,101,-47,-48,-49,-50,-25,110,-27,-28,-30,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-57,-52,-29,134,-42,-43,-26,-57,144,-41,-31,]),'COMMA':([25,27,36,38,40,42,43,44,45,55,76,77,78,79,80,84,86,88,91,92,93,94,95,96,97,98,101,110,120,122,124,128,129,134,138,139,141,144,146,],[32,-15,-16,-14,-17,-18,-19,-20,-21,-51,-47,-48,-49,-50,106,-25,111,-30,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-52,-53,-29,-42,-43,-26,-55,-54,-41,-31,-56,]),'ASSIGNAMENT':([28,40,122,138,],[34,59,133,143,]),'INT':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,42,-24,42,42,42,42,42,-23,42,42,42,42,42,]),'BOOL':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,43,-24,43,43,43,43,43,-23,43,43,43,43,43,]),'STRING':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,44,-24,44,44,44,44,44,-23,44,44,44,44,44,]),'SELF':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,45,-24,45,45,45,45,45,-23,45,45,45,45,45,]),'IF':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,48,-24,48,48,48,48,48,-23,48,48,48,48,48,]),'WHILE':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,49,-24,49,49,49,49,49,-23,49,49,49,49,49,]),'CASE':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,50,-24,50,50,50,50,50,-23,50,50,50,50,50,]),'NEW':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,-24,51,51,51,51,51,-23,51,51,51,51,51,]),'ISVOID':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,52,-24,52,52,52,52,52,-23,52,52,52,52,52,]),'DESTRUCTOR':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,53,-24,53,53,53,53,53,-23,53,53,53,53,53,]),'NOT':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,54,-24,54,54,54,54,54,-23,54,54,54,54,54,]),'LET':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,100,102,103,105,111,112,114,127,133,135,142,143,],[56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,56,-24,56,56,56,56,56,-23,56,56,56,56,56,]),'POINT':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,90,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,61,-18,-19,-20,-21,-51,61,61,61,61,61,-47,61,61,61,61,61,61,113,61,61,61,61,61,61,61,-22,61,-40,61,-32,61,61,61,61,-42,-43,-26,61,61,-41,-31,61,61,]),'AT':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,62,-18,-19,-20,-21,-51,62,62,62,62,62,-47,62,62,62,62,62,62,62,62,62,62,62,62,62,-22,62,-40,62,-32,62,62,62,62,-42,-43,-26,62,62,-41,-31,62,62,]),'PLUS':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,63,-18,-19,-20,-21,-51,63,63,63,63,63,-47,-48,-49,63,63,63,63,-33,-34,-35,-36,63,63,63,-22,63,-40,63,-32,63,63,63,63,-42,-43,-26,63,63,-41,-31,63,63,]),'MINUS':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,64,-18,-19,-20,-21,-51,64,64,64,64,64,-47,-48,-49,64,64,64,64,-33,-34,-35,-36,64,64,64,-22,64,-40,64,-32,64,64,64,64,-42,-43,-26,64,64,-41,-31,64,64,]),'STAR':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,65,-18,-19,-20,-21,-51,65,65,65,65,65,-47,-48,-49,65,65,65,65,65,65,-35,-36,65,65,65,-22,65,-40,65,-32,65,65,65,65,-42,-43,-26,65,65,-41,-31,65,65,]),'DIV':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,66,-18,-19,-20,-21,-51,66,66,66,66,66,-47,-48,-49,66,66,66,66,66,66,-35,-36,66,66,66,-22,66,-40,66,-32,66,66,66,66,-42,-43,-26,66,66,-41,-31,66,66,]),'LESS_THAN':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,67,-18,-19,-20,-21,-51,67,67,67,67,67,-47,-48,-49,67,67,67,67,-33,-34,-35,-36,None,None,None,-22,67,-40,67,-32,67,67,67,67,-42,-43,-26,67,67,-41,-31,67,67,]),'LESS_EQUAL_THAN':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,68,-18,-19,-20,-21,-51,68,68,68,68,68,-47,-48,-49,68,68,68,68,-33,-34,-35,-36,None,None,None,-22,68,-40,68,-32,68,68,68,68,-42,-43,-26,68,68,-41,-31,68,68,]),'EQUAL':([40,41,42,43,44,45,55,71,72,73,74,75,76,77,78,79,83,84,88,91,92,93,94,95,96,97,98,99,101,108,110,115,116,120,124,128,129,134,136,139,141,144,145,146,],[-17,69,-18,-19,-20,-21,-51,69,69,69,69,69,-47,-48,-49,69,69,69,69,-33,-34,-35,-36,None,None,None,-22,69,-40,69,-32,69,69,69,69,-42,-43,-26,69,69,-41,-31,69,69,]),'THEN':([40,42,43,44,45,55,73,76,77,78,79,84,91,92,93,94,95,96,97,98,101,110,120,128,129,134,141,144,],[-17,-18,-19,-20,-21,-51,102,-47,-48,-49,-50,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-52,-42,-43,-26,-41,-31,]),'LOOP':([40,42,43,44,45,55,74,76,77,78,79,84,91,92,93,94,95,96,97,98,101,110,120,128,129,134,141,144,],[-17,-18,-19,-20,-21,-51,103,-47,-48,-49,-50,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-52,-42,-43,-26,-41,-31,]),'OF':([40,42,43,44,45,55,75,76,77,78,79,84,91,92,93,94,95,96,97,98,101,110,120,128,129,134,141,144,],[-17,-18,-19,-20,-21,-51,104,-47,-48,-49,-50,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-52,-42,-43,-26,-41,-31,]),'ELSE':([40,42,43,44,45,55,76,77,78,79,84,91,92,93,94,95,96,97,98,101,110,115,120,128,129,134,141,144,],[-17,-18,-19,-20,-21,-51,-47,-48,-49,-50,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,127,-52,-42,-43,-26,-41,-31,]),'POOL':([40,42,43,44,45,55,76,77,78,79,84,91,92,93,94,95,96,97,98,101,110,116,120,128,129,134,141,144,],[-17,-18,-19,-20,-21,-51,-47,-48,-49,-50,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,128,-52,-42,-43,-26,-41,-31,]),'FI':([40,42,43,44,45,55,76,77,78,79,84,91,92,93,94,95,96,97,98,101,110,120,128,129,134,136,141,144,],[-17,-18,-19,-20,-21,-51,-47,-48,-49,-50,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-52,-42,-43,-26,141,-41,-31,]),'IN':([40,42,43,44,45,55,76,77,78,79,80,84,91,92,93,94,95,96,97,98,101,110,120,122,128,129,134,138,139,141,144,146,],[-17,-18,-19,-20,-21,-51,-47,-48,-49,-50,105,-25,-33,-34,-35,-36,-37,-38,-39,-22,-40,-32,-52,-53,-42,-43,-26,-55,-54,-41,-31,-56,]),'ESAC':([117,118,130,147,],[129,-45,-44,-46,]),'IMPLICATION':([137,],[142,]),}
_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 = {'program':([0,],[1,]),'class_list':([0,],[2,]),'class':([0,2,],[3,5,]),'features_list_opt':([9,22,],[11,29,]),'features_list':([9,22,],[12,12,]),'empty':([9,22,60,112,135,],[13,13,87,87,87,]),'feature':([9,12,22,],[14,18,14,]),'formal_params_list':([20,],[25,]),'formal_param':([20,32,],[27,38,]),'expression':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,102,103,105,111,112,127,133,135,142,143,],[41,71,72,73,74,75,77,78,79,83,84,88,91,92,93,94,95,96,97,99,108,115,116,120,124,88,136,139,88,145,146,]),'let_expression':([34,46,47,48,49,50,52,53,54,58,59,60,63,64,65,66,67,68,69,70,82,102,103,105,111,112,127,133,135,142,143,],[55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,55,]),'block_list':([46,],[70,]),'generate_instances':([56,],[80,]),'arguments_list_opt':([60,112,135,],[85,125,140,]),'arguments_list':([60,112,135,],[86,86,86,]),'actions_list':([104,],[117,]),'action':([104,117,],[118,130,]),}
_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' -> program","S'",1,None,None,None),
('program -> class_list','program',1,'p_program','parser.py',26),
('class_list -> class_list class POINT_AND_COMMA','class_list',3,'p_class_list','parser.py',33),
('class_list -> class POINT_AND_COMMA','class_list',2,'p_class_list','parser.py',34),
('class -> CLASS TYPE_ID O_KEY features_list_opt C_KEY','class',5,'p_class','parser.py',44),
('class -> CLASS TYPE_ID INHERITS TYPE_ID O_KEY features_list_opt C_KEY','class',7,'p_class_inherits','parser.py',61),
('features_list_opt -> features_list','features_list_opt',1,'p_feature_list_opt','parser.py',77),
('features_list_opt -> empty','features_list_opt',1,'p_feature_list_opt','parser.py',78),
('features_list -> features_list feature POINT_AND_COMMA','features_list',3,'p_feature_list','parser.py',85),
('features_list -> feature POINT_AND_COMMA','features_list',2,'p_feature_list','parser.py',86),
('feature -> ID O_PAR formal_params_list C_PAR TWO_POINTS TYPE_ID O_KEY expression C_KEY','feature',9,'p_feature_method','parser.py',96),
('feature -> ID O_PAR C_PAR TWO_POINTS TYPE_ID O_KEY expression C_KEY','feature',8,'p_feature_method_no_formals','parser.py',103),
('feature -> ID TWO_POINTS TYPE_ID ASSIGNAMENT expression','feature',5,'p_feature_attr_initialized','parser.py',110),
('feature -> ID TWO_POINTS TYPE_ID','feature',3,'p_feature_attr','parser.py',117),
('formal_params_list -> formal_params_list COMMA formal_param','formal_params_list',3,'p_formal_list_many','parser.py',124),
('formal_params_list -> formal_param','formal_params_list',1,'p_formal_list_many','parser.py',125),
('formal_param -> ID TWO_POINTS TYPE_ID','formal_param',3,'p_formal','parser.py',135),
('expression -> ID','expression',1,'p_expression_object_identifier','parser.py',142),
('expression -> INT','expression',1,'p_expression_integer_constant','parser.py',149),
('expression -> BOOL','expression',1,'p_expression_boolean_constant','parser.py',156),
('expression -> STRING','expression',1,'p_expression_string_constant','parser.py',163),
('expression -> SELF','expression',1,'p_expr_self','parser.py',170),
('expression -> O_KEY block_list C_KEY','expression',3,'p_expression_block','parser.py',177),
('block_list -> block_list expression POINT_AND_COMMA','block_list',3,'p_block_list','parser.py',184),
('block_list -> expression POINT_AND_COMMA','block_list',2,'p_block_list','parser.py',185),
('expression -> ID ASSIGNAMENT expression','expression',3,'p_expression_assignment','parser.py',195),
('expression -> expression POINT ID O_PAR arguments_list_opt C_PAR','expression',6,'p_expression_dispatch','parser.py',202),
('arguments_list_opt -> arguments_list','arguments_list_opt',1,'p_arguments_list_opt','parser.py',209),
('arguments_list_opt -> empty','arguments_list_opt',1,'p_arguments_list_opt','parser.py',210),
('arguments_list -> arguments_list COMMA expression','arguments_list',3,'p_arguments_list','parser.py',217),
('arguments_list -> expression','arguments_list',1,'p_arguments_list','parser.py',218),
('expression -> expression AT TYPE_ID POINT ID O_PAR arguments_list_opt C_PAR','expression',8,'p_expression_inherits_dispatch','parser.py',228),
('expression -> ID O_PAR arguments_list_opt C_PAR','expression',4,'p_expression_self_dispatch','parser.py',236),
('expression -> expression PLUS expression','expression',3,'p_expression_math_operations','parser.py',243),
('expression -> expression MINUS expression','expression',3,'p_expression_math_operations','parser.py',244),
('expression -> expression STAR expression','expression',3,'p_expression_math_operations','parser.py',245),
('expression -> expression DIV expression','expression',3,'p_expression_math_operations','parser.py',246),
('expression -> expression LESS_THAN expression','expression',3,'p_expression_math_comparisons','parser.py',260),
('expression -> expression LESS_EQUAL_THAN expression','expression',3,'p_expression_math_comparisons','parser.py',261),
('expression -> expression EQUAL expression','expression',3,'p_expression_math_comparisons','parser.py',262),
('expression -> O_PAR expression C_PAR','expression',3,'p_expression_with_parenthesis','parser.py',274),
('expression -> IF expression THEN expression ELSE expression FI','expression',7,'p_expression_if_conditional','parser.py',281),
('expression -> WHILE expression LOOP expression POOL','expression',5,'p_expression_while_loop','parser.py',288),
('expression -> CASE expression OF actions_list ESAC','expression',5,'p_expression_case','parser.py',296),
('actions_list -> actions_list action','actions_list',2,'p_actions_list','parser.py',303),
('actions_list -> action','actions_list',1,'p_actions_list','parser.py',304),
('action -> ID TWO_POINTS TYPE_ID IMPLICATION expression POINT_AND_COMMA','action',6,'p_action_expr','parser.py',314),
('expression -> NEW TYPE_ID','expression',2,'p_expression_new','parser.py',321),
('expression -> ISVOID expression','expression',2,'p_expression_isvoid','parser.py',328),
('expression -> DESTRUCTOR expression','expression',2,'p_expression_integer_complement','parser.py',335),
('expression -> NOT expression','expression',2,'p_expression_boolean_complement','parser.py',342),
('expression -> let_expression','expression',1,'p_expression_let','parser.py',351),
('let_expression -> LET generate_instances IN expression','let_expression',4,'p_let_expression','parser.py',358),
('generate_instances -> ID TWO_POINTS TYPE_ID','generate_instances',3,'p_generate_instances','parser.py',366),
('generate_instances -> ID TWO_POINTS TYPE_ID ASSIGNAMENT expression','generate_instances',5,'p_generate_instances','parser.py',367),
('generate_instances -> generate_instances COMMA ID TWO_POINTS TYPE_ID','generate_instances',5,'p_generate_instances','parser.py',368),
('generate_instances -> generate_instances COMMA ID TWO_POINTS TYPE_ID ASSIGNAMENT expression','generate_instances',7,'p_generate_instances','parser.py',369),
('empty -> <empty>','empty',0,'p_empty','parser.py',387),
]