예제 #1
0
def p_operacionP(p):
    '''operacionP   :   MAS valor
                    |   MENOS valor
                    |   MULTIPLICACION valor
                    |   DIVISION valor
                    |   MODULAR valor
                    |   AND valor
                    |   OR valor
                    |   XOR valor
                    |   IGUALIGUAL valor
                    |   DIFERENTE valor
                    |   MAYOR valor
                    |   MENOR valor
                    |   MAYORIGUAL valor
                    |   MENORIGUAL valor
                    |   ANDBIT valor
                    |   ORBIT valor
                    |   XORBIT  valor
                    |   SHIFTIZQ valor
                    |   SHIFTDER valor
    '''

    nodo = NodoG(getIndex(), "operacionP", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(p[2])
    p[0] = nodo
예제 #2
0
def p_operacion2(p):
    '''operacion    :   valor operacionP
    '''
    nodo = NodoG(getIndex(), "operacion", [])
    nodo.add(p[1])
    nodo.add(p[2])

    p[0] = nodo
예제 #3
0
def p_operacion(p):
    '''operacion    :   NOT valor
                    |   NOTBIT valor
                    |   MENOS valor
    '''
    nodo = NodoG(getIndex(), "operacion", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(p[2])
    p[0] = nodo
예제 #4
0
def p_arreglo(p):
    'parreglo   :   VARIABLE dimensiones IGUAL operacion PYCOMA'
    nodo = NodoG(getIndex(), "pvariable", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(p[2])
    nodo.add(NodoG(getIndex(), "=", None))
    nodo.add(p[4])
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #5
0
def p_pread(p):
    'pread  :   VARIABLE IGUAL READ PARIZQ PARDER PYCOMA'
    nodo = NodoG(getIndex(), "pread", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(NodoG(getIndex(), "=", None))
    nodo.add(NodoG(getIndex(), "read", None))
    nodo.add(NodoG(getIndex(), "(", None))
    nodo.add(NodoG(getIndex(), ")", None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #6
0
def p_pvariable(p):
    'pvariable : VARIABLE IGUAL operacion PYCOMA'
    nodo = NodoG(getIndex(), "pvariable", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(NodoG(getIndex(), "=", None))
    nodo.add(p[3])
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #7
0
def p_array(p):
    'parray :   VARIABLE IGUAL ARRAY PARIZQ PARDER PYCOMA'
    nodo = NodoG(getIndex(), "parray", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(NodoG(getIndex(), "=", None))
    nodo.add(NodoG(getIndex(), "array()", None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #8
0
def p_punset(p):
    'punset  :   UNSET PARIZQ VARIABLE PARDER PYCOMA'
    nodo = NodoG(getIndex(), "punset", [])
    nodo.add(NodoG(getIndex(), "unset", None))
    nodo.add(NodoG(getIndex(), "(", None))
    nodo.add(NodoG(getIndex(), p[3], None))
    nodo.add(NodoG(getIndex(), ")", None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #9
0
def p_prefencia(p):
    'preferencia    :  VARIABLE IGUAL ANDBIT VARIABLE PYCOMA '
    nodo = NodoG(getIndex(), "preferencia", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(NodoG(getIndex(), "=", None))
    nodo.add(NodoG(getIndex(), "&", None))
    nodo.add(NodoG(getIndex(), p[4], None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #10
0
def p_operaciones5(p):
    'operacion  :   ABS PARIZQ valor PARDER'
    nodo = NodoG(getIndex(), "operacion", [])
    nodo.add(NodoG(getIndex(), "abs", None))
    nodo.add(NodoG(getIndex(), "(", None))
    nodo.add(p[3])
    nodo.add(NodoG(getIndex(), ")", None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #11
0
def p_pprint(p):
    '''pprint   :   PRINT PARIZQ valor PARDER PYCOMA
    '''
    nodo = NodoG(getIndex(), "pprint", [])
    nodo.add(NodoG(getIndex(), "print", None))
    nodo.add(NodoG(getIndex(), "(", None))
    nodo.add(p[3])
    nodo.add(NodoG(getIndex(), ")", None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #12
0
def p_operacion8(p):
    '''operacion    :   PARIZQ INTEGER PARDER valor
                    |   PARIZQ FLOAT PARDER valor
                    |   PARIZQ CHAR PARDER valor
    '''
    nodo = NodoG(getIndex(), "operacion", [])
    nodo.add(NodoG(getIndex(), "(", None))
    nodo.add(NodoG(getIndex(), p[2], None))
    nodo.add(NodoG(getIndex(), ")", None))
    nodo.add(p[4])
    p[0] = nodo
예제 #13
0
def p_pgoto(p):
    'pgoto  :   GOTO ID PYCOMA'
    nodo = NodoG(getIndex(), "pgoto", [])
    nodo.add(NodoG(getIndex(), "goto", None))
    nodo.add(NodoG(getIndex(), p[2], None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #14
0
def p_etiqueta2(p):
    'etiqueta : ID DOSPUNTOS '
    nodo = NodoG(getIndex(), "etiqueta", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(NodoG(getIndex(), ":", None))
    nodo.add(NodoG(getIndex(), "epsilon", None))
    p[0] = nodo
예제 #15
0
def p_etiqueta(p):
    'etiqueta   :   ID DOSPUNTOS sentencias'
    nodo = NodoG(getIndex(), "etiqueta", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(NodoG(getIndex(), ":", None))
    nodo.add(p[3])
    p[0] = nodo
예제 #16
0
def p_dimensionesP(p):
    'dimensionesP     :   dimension dimensionesP '
    nodo = NodoG(getIndex(), "dimensionesP", [])
    nodo2 = NodoG(getIndex(), "dimension", [])
    nodo2.add(p[1])
    nodo.add(nodo2)
    nodo.add(p[2])
    p[0] = nodo
예제 #17
0
def p_main2(p):
    '''main    :   MAIN DOSPUNTOS
    '''
    nodo = NodoG(getIndex(), "main", [])
    nodo.add(NodoG(getIndex(), "main", None))
    nodo.add(NodoG(getIndex(), ":", None))
    nodo.add(NodoG(getIndex(), "epsilon", None))
    p[0] = nodo
예제 #18
0
def p_main(p):
    'main   :   MAIN DOSPUNTOS sentencias'
    nodo = NodoG(getIndex(), "main", [])
    nodo.add(NodoG(getIndex(), "main", None))
    nodo.add(NodoG(getIndex(), ":", None))

    nodo.add(p[3])
    p[0] = nodo
예제 #19
0
def p_sentencias(p):
    'sentencias :   sentencia sentenciasP'
    nodo = NodoG(getIndex(), "sentencias", [])
    nodo2 = NodoG(getIndex(), "sentencia", [])
    nodo2.add(p[1])
    nodo.add(nodo2)
    nodo.add(p[2])
    p[0] = nodo
예제 #20
0
def p_instrucciones(p):
    'instrucciones  :   instruccion instruccionesP'
    nodo = NodoG(getIndex(), "instruciones", [])
    nodo2 = NodoG(getIndex(), "instruccion", [])
    nodo2.add(p[1])
    nodo.add(nodo2)
    nodo.add(p[2])
    p[0] = nodo
예제 #21
0
def p_psalir(p):
    'pexit  :   EXIT PYCOMA'
    nodo = NodoG(getIndex(), "pexit", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #22
0
def p_pprint3(p):
    'pprint :  PRINT PARIZQ VARIABLE dimensiones PARDER PYCOMA'
    nodo = NodoG(getIndex(), "pprint", [])
    nodo.add(NodoG(getIndex(), "print", None))
    nodo.add(NodoG(getIndex(), "(", None))
    nodo2 = NodoG(getIndex(), "operacion", [])
    nodo2.add(NodoG(getIndex(), p[3], None))
    nodo2.add(p[4])
    nodo.add(nodo2)
    nodo.add(NodoG(getIndex(), ")", None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #23
0
def p_pif(p):
    'pif    :   IF PARIZQ operacion PARDER GOTO ID PYCOMA '
    nodo = NodoG(getIndex(), "pif", [])
    nodo.add(NodoG(getIndex(), "if", None))
    nodo.add(NodoG(getIndex(), "(", None))
    nodo.add(p[3])
    nodo.add(NodoG(getIndex(), ")", None))
    nodo.add(NodoG(getIndex(), "got", None))
    nodo.add(NodoG(getIndex(), p[6], None))
    nodo.add(NodoG(getIndex(), ";", None))
    p[0] = nodo
예제 #24
0
def p_operacion7(p):
    'operacion  :   VARIABLE dimensiones'
    nodo = NodoG(getIndex(), "operacion", [])
    nodo.add(NodoG(getIndex(), p[1], None))
    nodo.add(p[2])
    p[0] = nodo