def p_cmd_while(self, p): 'cmd : WHILE LPAREN exp RPAREN cmd' p[0] = nd.Node('cmd', [p[3], p[5]], [p[1], p[2], p[4]])
def p_cmd_sout(self, p): 'cmd : SOUT LPAREN exp RPAREN SEMICOLON' p[0] = nd.Node('cmd', [p[3]], [p[1], p[2], p[4], p[5]])
def p_cmd_if(self, p): 'cmd : IF LPAREN exp RPAREN cmd' p[0] = nd.Node('cmd', [p[3], p[5]], [p[1], p[2], p[4]])
def p_cmd_ifelse(self, p): 'cmd : IF LPAREN exp RPAREN cmd ELSE cmd' p[0] = nd.Node('cmd', [p[3], p[5], p[7]], [p[1], p[2], p[4], p[6]])
def p_main_class(self, p): 'main : CLASS ID LCBRACKET PUBLIC STATIC VOID MAIN LPAREN STRING LSBRACKET RSBRACKET ID RPAREN LCBRACKET cmd RCBRACKET RCBRACKET' p[0] = nd.Node('main', [p[15]], [ p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[16], p[17] ])
def p_cmd_chave(self, p): 'cmd : LCBRACKET loopcmd RCBRACKET' p[0] = nd.Node('cmd', [p[2]], [p[1], p[3]])
def p_tipo_bool(self, p): 'tipo : BOOLEAN' p[0] = nd.Node('tipo', [], [p[1]])
def p_exp_exp(self, p): 'exp : exp AND rexp' p[0] = nd.Node('exp', [p[1], p[3]], [p[2]])
def p_params_tipo(self, p): 'params : tipo ID loopvirgulatipoid' p[0] = nd.Node('params', [p[1], p[3]], [p[2]])
def p_tipo_inta(self, p): 'tipo : INT LSBRACKET RSBRACKET' p[0] = nd.Node('tipo', [], [p[1], p[2], p[3]])
def p_metodo_public(self, p): 'metodo : PUBLIC tipo ID LPAREN optparams RPAREN LCBRACKET loopvar loopcmd RETURN exp SEMICOLON RCBRACKET' p[0] = nd.Node('metodo', [p[2], p[5], p[8], p[9], p[11]], [p[1], p[3], p[4], p[6], p[7], p[10], p[12], p[13]])
def p_var_tipo(self, p): 'var : tipo ID SEMICOLON' p[0] = nd.Node('var', [p[1]], [p[2], p[3]])
def p_classe_id(self, p): 'classe : CLASS ID optextends LCBRACKET loopvar loopmetodo RCBRACKET' p[0] = nd.Node('classe', [p[3], p[5], p[6]], [p[1], p[2], p[4], p[7]])
def p_cmd_ideq(self, p): 'cmd : ID ASSIGN exp SEMICOLON' p[0] = nd.Node('cmd', [p[3]], [p[1], p[2], p[4]])
def p_tipo_int(self, p): 'tipo : INT' p[0] = nd.Node('tipo', [], [p[1]])
def p_cmd_id(self, p): 'cmd : ID LSBRACKET exp RSBRACKET ASSIGN exp SEMICOLON' p[0] = nd.Node('cmd', [p[3], p[6]], [p[1], p[2], p[4], p[5], p[7]])
def p_tipo_id(self, p): 'tipo : ID' p[0] = nd.Node('tipo', [], [p[1]])
def p_exp_rexp(self, p): 'exp : rexp' p[0] = nd.Node('exp', [p[1]], [])
def p_prog_main(self, p): 'prog : main loopclasse' p[0] = nd.Node('prog', [p[1], p[2]], [])