예제 #1
0
def p_expresion_agrupacion(t):
    '''expresion : PARA INT PARC valor
                | PARA FLOAT PARC valor
                | PARA CHAR PARC valor'''

    t[0] = ABCInstruccion.ExpresionSimpleOperacion(t[4], t[2])

    global Ts
    t[0].n_t(find_column(Ts.texto_analisis, t.slice[1]))
    Ts.rp_nuevo_nodo('expresion : PARA' + str(t[2]) + 'PARC valor', "t[0] = ABCInstruccion.ExpresionSimpleOperacion(t[4], t[2])")
예제 #2
0
def p_expresion_unaria(t):
    '''expresion : MENOS valor
                | ABS PARA valor PARC
                | NOTB valor
                | NOT valor
                | MAS valor
                | ANDB DOLAR IDENTIFICADOR arra
                | READ PARA  PARC
                | ARRAY PARA  PARC '''

    if t[2] == "(":
        t[0] = ABCInstruccion.ExpresionSimpleOperacion(t[3], t[1])
    elif t[1] == "&":
        t[0] = Referencia(t[3], t[4])

    else:
        t[0] = ABCInstruccion.ExpresionSimpleOperacion(t[2], t[1])

    global Ts
    t[0].n_t(find_column(Ts.texto_analisis, t.slice[1]))
    Ts.rp_nuevo_nodo('expresion : '+str(t[1])+'valor', "t[0] = ABCInstruccion.ExpresionSimpleOperacion(t[3], t[1])")