def p_expression(p): 
    '''expression : exp expressionp'''
    if popper:
        if popper[-1] == '>'  or popper[-1] =='<' or popper[-1] =='<=' or popper[-1] =='>=' or popper[-1] =='==' or popper[-1] =='<>':
            global quadruplo
            operando= popper.pop()
            op1 =pilao.pop()
            op2=pilao.pop()
            tipo=semantic_cube.get((op2[1],operando, op1[1]), 'error')
            if tipo != 'error' :
                res =mem_temps.add_type(tipo,1)
                quadruplo.append([operando,op2[0],op1[0],res])
                pilao.append([res,tipo])
            else:
                print errors['TYPE_MISMATCH']
                exit(1)
def p_term(p): 
    '''term : factor termp'''
    if popper: 
        if popper[-1] == '*' or popper[-1] =='/':
            global quadruplo
            operando= popper.pop()
            op1 =pilao.pop()
            op2=pilao.pop()
            tipo=semantic_cube.get((op2[1],operando, op1[1]), 'error')
            if tipo != 'error' :
                res =mem_temps.add_type(tipo,1)
                quadruplo.append([operando,op2[0],op1[0],res])
                pilao.append([res,tipo])
            else:
                print errors['TYPE_MISMATCH']
                exit(1)