Beispiel #1
0
def p_expBool_1(t):
    """
    expBool : expBool R_AND expBool
            | expBool R_OR expBool
    """
    t[0] = code.BinaryOperation(newTemp(), t[1], t[3], t[2], t[1].row, t[1].column)
    repGrammar.append(t.slice)
Beispiel #2
0
def p_expComp_unario_1(t):
    """
    expComp : datatype R_ISNULL
    | datatype R_NOTNULL
    """
    t[0] = code.UnaryOperation(newTemp(),t[1],t[2],t[1].row,t[1].column)
    repGrammar.append(t.slice)
Beispiel #3
0
def p_expComp_ternario_1(t):
    """
    expComp :  datatype R_BETWEEN datatype R_AND datatype
    """
    t[0] = code.TernaryOperation(newTemp(), t[1],t[3],t[5],t[2],t[1].row,t[3].column)
    incTemp(2)
    repGrammar.append(t.slice)
Beispiel #4
0
def p_expComp_ternario_3(t):
    """
    expComp : datatype R_BETWEEN R_SYMMETRIC datatype R_AND datatype
    """
    t[0] = code.TernaryOperation(newTemp(), t[1],t[4],t[6],t[2]+t[3],t[1].row,t[1].column)
    incTemp(6)
    repGrammar.append(t.slice)
Beispiel #5
0
def p_datatype_operadores_unarios(t):
    """
    datatype : O_RESTA datatype %prec UO_RESTA
    | O_SUMA datatype %prec UO_SUMA
    """
    t[0] = code.UnaryOperation(newTemp(),t[2],t[1],t[2].row, t[2].column)
    repGrammar.append(t.slice)
Beispiel #6
0
def p_expComp_unario_3(t):
    """
    expComp : datatype R_IS R_NOT R_NULL
    | datatype R_IS R_NOT R_TRUE
    | datatype R_IS R_NOT R_FALSE
    | datatype R_IS R_NOT R_UNKNOWN
    """
    t[0] = code.UnaryOperation(newTemp(),t[1],t[2]+t[3]+t[4],t[1].row,t[1].column)
    repGrammar.append(t.slice)
Beispiel #7
0
def p_expCompBinario_1(t):
    """
    expComp : datatype OL_MENORQUE datatype
    | datatype OL_MAYORQUE datatype
    | datatype OL_MAYORIGUALQUE datatype
    | datatype OL_MENORIGUALQUE datatype
    | datatype S_IGUAL datatype
    | datatype OL_DISTINTODE datatype
    """
    t[0] = code.BinaryOperation(newTemp(),t[1],t[3],t[2], t[1].row, t[1].column)
    repGrammar.append(t.slice)
Beispiel #8
0
def p_datatype_operadores_binarios1(t):
    """
    datatype : datatype O_SUMA datatype
    | datatype O_RESTA datatype
    | datatype O_PRODUCTO datatype
    | datatype O_DIVISION datatype
    | datatype O_EXPONENTE datatype
    | datatype O_MODULAR datatype
    """
    t[0] = code.BinaryOperation(newTemp(),t[1],t[3],t[2], t[1].row, t[1].column)
    repGrammar.append(t.slice)
Beispiel #9
0
def p_expBool_5(t):
    """
    expBool : expBool optBoolPredicate
    """
    t[0] = code.UnaryOperation(newTemp(), t[1], t[2], t[1].row, t[1].column )
    repGrammar.append(t.slice)
Beispiel #10
0
def p_expBool_2(t):
    """
    expBool : R_NOT expBool
    """
    t[0] = code.UnaryOperation(newTemp(),t[2],t[1],t[2].row, t[2].column)
    repGrammar.append(t.slice)
Beispiel #11
0
def p_expCompBinario_3(t):
    """
    expComp : datatype R_IS R_NOT R_DISTINCT R_FROM datatype
    """
    t[0] = code.BinaryOperation(newTemp(), t[1], t[6], "==", t[1].row, t[1].column)
    repGrammar.append(t.slice)
Beispiel #12
0
def p_datatype_operadores_binarios2(t):
    """
    datatype : datatype OC_CONCATENAR datatype
    """
    t[0] = code.BinaryOperation(newTemp(),t[1],t[3],t[2], t[1].row, t[1].column)
    repGrammar.append(t.slice)