41 lines
2.6 KiB
Python
41 lines
2.6 KiB
Python
|
|
# calc_Calc_parsetab.py
|
|
# This file is automatically generated. Do not edit.
|
|
_tabversion = '3.2'
|
|
|
|
_lr_method = 'LALR'
|
|
|
|
_lr_signature = '|\x0f"\xe2\x0e\xf7\x0fT\x15K\x1c\xc0\x1e\xa3c\x10'
|
|
|
|
_lr_action_items = {'$end':([1,2,3,5,9,15,16,17,18,19,20,21,22,],[-11,-10,0,-2,-11,-8,-1,-9,-6,-5,-3,-7,-4,]),'RPAREN':([2,8,9,15,17,18,19,20,21,22,],[-10,17,-11,-8,-9,-6,-5,-3,-7,-4,]),'DIVIDE':([1,2,5,8,9,15,16,17,18,19,20,21,22,],[-11,-10,10,10,-11,-8,10,-9,-6,-5,10,-7,10,]),'EQUALS':([1,],[7,]),'NUMBER':([0,4,6,7,10,11,12,13,14,],[2,2,2,2,2,2,2,2,2,]),'PLUS':([1,2,5,8,9,15,16,17,18,19,20,21,22,],[-11,-10,12,12,-11,-8,12,-9,-6,-5,-3,-7,-4,]),'LPAREN':([0,4,6,7,10,11,12,13,14,],[4,4,4,4,4,4,4,4,4,]),'EXP':([1,2,5,8,9,15,16,17,18,19,20,21,22,],[-11,-10,13,13,-11,-8,13,-9,13,13,13,-7,13,]),'TIMES':([1,2,5,8,9,15,16,17,18,19,20,21,22,],[-11,-10,11,11,-11,-8,11,-9,-6,-5,11,-7,11,]),'MINUS':([0,1,2,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,],[6,-11,-10,6,14,6,6,14,-11,6,6,6,6,6,-8,14,-9,-6,-5,-3,-7,-4,]),'NAME':([0,4,6,7,10,11,12,13,14,],[1,9,9,9,9,9,9,9,9,]),}
|
|
|
|
_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 = {'expression':([0,4,6,7,10,11,12,13,14,],[5,8,15,16,18,19,20,21,22,]),'statement':([0,],[3,]),}
|
|
|
|
_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' -> statement","S'",1,None,None,None),
|
|
('statement -> NAME EQUALS expression','statement',3,'p_statement_assign','./calc.py',107),
|
|
('statement -> expression','statement',1,'p_statement_expr','./calc.py',111),
|
|
('expression -> expression PLUS expression','expression',3,'p_expression_binop','./calc.py',116),
|
|
('expression -> expression MINUS expression','expression',3,'p_expression_binop','./calc.py',117),
|
|
('expression -> expression TIMES expression','expression',3,'p_expression_binop','./calc.py',118),
|
|
('expression -> expression DIVIDE expression','expression',3,'p_expression_binop','./calc.py',119),
|
|
('expression -> expression EXP expression','expression',3,'p_expression_binop','./calc.py',120),
|
|
('expression -> MINUS expression','expression',2,'p_expression_uminus','./calc.py',130),
|
|
('expression -> LPAREN expression RPAREN','expression',3,'p_expression_group','./calc.py',134),
|
|
('expression -> NUMBER','expression',1,'p_expression_number','./calc.py',138),
|
|
('expression -> NAME','expression',1,'p_expression_name','./calc.py',142),
|
|
]
|