Ejemplo n.º 1
0
def continuar_ejecucionDesc():
    global no_instruccion, waitForCommand

    while no_instruccion < len(Inter.instrucciones):
        if waitForCommand == 0 or waitForCommand == 2:  #0=Sin Entrada, 1=Esperando, 2=Comando Ingresado
            if no_instruccion < len(Inter.instrucciones):
                is_asig = Inter.instrucciones[no_instruccion]
                if isinstance(is_asig, Asignacion):
                    # COMANDO PARA LEER DE CONSOLA
                    if isinstance(is_asig.valor, Read) and waitForCommand == 0:
                        waitForCommand = 1
                        #no_instruccion=i
                        return None
                #EJECUTAR INSTRUCCION
                instr_temp = Inter.ejecutarInstruccionUnitaria(
                    1, no_instruccion)
                if instr_temp is not None:
                    if instr_temp == -10:  # EXIT
                        no_instruccion = len(Inter.instrucciones)
                    else:  #GOTO
                        no_instruccion = instr_temp
                waitForCommand = 0
                no_instruccion += 1
            else:
                MessageBox.showinfo("Finalizado",
                                    "Ultima instruccion ejecutada.")
Ejemplo n.º 2
0
def ejec_ascendente():
    global ts_debug, no_instruccion, waitForCommand, ejecucion_automatica
    ejecucion_automatica=1
    cont=editor.get("1.0",END)
    waitForCommand=0
    Inter.inicializarGUI(editor,consola)
    Inter.limpiarValores()
    Inter.inicializarEjecucionAscendente(cont)
    Inter.inicializarTS()
    i=0
    while i<len(Inter.instrucciones):
        if waitForCommand==0 or waitForCommand==2: #0=Sin Entrada, 1=Esperando, 2=Comando Ingresado
            if i<len(Inter.instrucciones) :
                is_asig=Inter.instrucciones[i]
                if isinstance(is_asig,Asignacion): 
                    # COMANDO PARA LEER DE CONSOLA
                    if isinstance(is_asig.valor,Read) and waitForCommand==0:
                        waitForCommand=1
                        no_instruccion=i
                        return None
                #EJECUTAR INSTRUCCION
                instr_temp=Inter.ejecutarInstruccionUnitaria(1,i)
                if instr_temp is not None:
                    if instr_temp==-10 : # EXIT
                        i=len(Inter.instrucciones)
                    else: #GOTO
                        i=instr_temp
                waitForCommand=0
            else:
                MessageBox.showinfo("Finalizado","Ultima instruccion ejecutada.")
        i=i+1
Ejemplo n.º 3
0
def ejec_ascendente():

    cont1 = editor.get("1.0", END)
    ast = analize(cont1)
    if ast != None:
        analizeAST(cont1)
        fileAugus = translate(ast)

        file1 = open('un-optimized.augus', 'w')
        file1.write(fileAugus)
        file1.close()

        from Optimizer import optimize

    else:
        fileAugus = ''

    global ts_debug, no_instruccion, waitForCommand, ejecucion_automatica
    ejecucion_automatica = 1
    cont = editor.get("1.0", END)
    waitForCommand = 0
    Inter.inicializarGUI(editor, consola)
    Inter.limpiarValores()
    Inter.inicializarEjecucionAscendente(fileAugus)
    Inter.inicializarTS()
    i = 0
    while i < len(Inter.instrucciones):
        if waitForCommand == 0 or waitForCommand == 2:  #0=Sin Entrada, 1=Esperando, 2=Comando Ingresado
            if i < len(Inter.instrucciones):
                is_asig = Inter.instrucciones[i]
                if isinstance(is_asig, Asignacion):
                    # COMANDO PARA LEER DE CONSOLA
                    if isinstance(is_asig.valor, Read) and waitForCommand == 0:
                        waitForCommand = 1
                        no_instruccion = i
                        return None
                #EJECUTAR INSTRUCCION
                instr_temp = Inter.ejecutarInstruccionUnitaria(1, i)
                if instr_temp is not None:
                    if instr_temp == -10:  # EXIT
                        i = len(Inter.instrucciones)
                    else:  #GOTO
                        i = instr_temp
                waitForCommand = 0
            else:
                MessageBox.showinfo("Finalizado",
                                    "Ultima instruccion ejecutada.")
        i = i + 1