def ejecutar(self, ent: Entorno): dbActual = ent.getDataBase() if dbActual != None: tablaIndex: Simbolo = ent.buscarSimbolo(self.tabla + "_" + dbActual) if tablaIndex != None: for nombreCol in self.columnas: i = 0 fin = len(tablaIndex.valor) while i < fin: if nombreCol.valor == tablaIndex.valor[i].nombre: # IDX_database_tabla idIdex: str = "IDX_" + dbActual + "_" + self.tabla + "_" + self.iden + "_" + nombreCol.valor nuevoSym: Simbolo = Simbolo( TipoSimbolo.INDEX, idIdex, {}) nuevoSym.tabla = self.tabla nuevoSym.indexId = self.iden nuevoSym.baseDatos = dbActual nuevoSym.valor.update({ 'id': self.iden, 'columna': nombreCol.valor }) if self.unique: nuevoSym.valor.update({'unique': True}) if self.hash: nuevoSym.valor.update({'hash': True}) if self.orden != None: nuevoSym.valor.update({'orden': self.orden}) tablaIndex.valor[i].atributos.update( {'index': idIdex}) res = ent.nuevoSimbolo(nuevoSym) if res == "ok": variables.consola.insert( INSERT, "Se agregó nuevo index '" + self.iden + "' a la columna '" + nombreCol.valor + "'\n") else: variables.consola.insert( INSERT, "El nuevo index '" + self.iden + "' no se puede agregar porque ya existe.\n" ) reporteerrores.append( Lerrores( "Semántico", "El nuevo index '" + self.iden + "' no se puede agregar porque ya existe.\n", "", "")) break i = i + 1 else: variables.consola.insert( INSERT, "La tabla '" + self.tabla + "' a la que se le desea agregar el índice '" + self.iden + "' no existe.\n") reporteerrores.append( Lerrores( "Semántico", "La tabla '" + self.tabla + "' a la que se le desea agregar el índice '" + self.iden + "' no existe", "", ""))
def ejecutar(self,ent:Entorno): tablas = [] result = [] self.encabezados = [] if self.nametable != None: tipo = self.nametable.tipo if tipo.tipo == 'identificador': nombre = self.nametable.getval(ent) self.ntabla = nombre tabla = ent.buscarSimbolo(nombre + "_" + ent.getDataBase()) if tabla != None: tablas.append(tabla) else: return "ERROR >> En la instrucción Delete, la tabla: "+self.ntabla+" NO EXISTE" if len(tablas) > 1: return "ERROR >> En la instrucción Delete, solo puede ingresar el nombre de una tabla" else: 'llenar resultado desde backend' real = tablas[0].nombre.replace('_' + ent.getDataBase(), '') result = DBMS.extractTable(ent.getDataBase(), real) # filtros if self.exps != None: result = self.wheredelete(ent, tablas) else: return "ERROR >> En la instrucción Delete la expresión es incorrecta" return self.resultdelete(result,self.ntabla,ent.getDataBase())
def ejecutar(self, ent: Entorno): 'Metodo Abstracto para ejecutar la instruccion' if self.distinct is None and self.froms is None and self.where is None and self.group is None and self.having is None and self.order is None and self.combinig is None: resultados = [] for exp in self.exps: if exp != None: resultados.append(exp.getval(ent)) return resultados elif self.froms != None and self.exps != None: tablas = [] for exp in self.froms: if exp != None: tipo = exp.tipo if tipo.tipo == 'identificador': nombre = exp.getval(ent) tabla = ent.buscarSimbolo(nombre) if tabla != None: tablas.append(tabla) #filtros #acceder a columnas if len(self.exps) == 1: if self.exps[0].getval(ent) == '*': result = [] for tabla in tablas: result.append( DBMS.extractTable(ent.getDataBase(), tabla.nombre)) return result
def ejecutar(self, ent: Entorno): dbActual = ent.getDataBase() result = [] if dbActual != None: tabla: Simbolo = ent.buscarSimbolo(self.tabla + "_" + dbActual) if tabla != None: 'obtengo tabla' real = tabla.nombre.replace('_' + ent.getDataBase(), '') result = DBMS.extractTable(ent.getDataBase(), real) columnas = tabla.valor 'lleno encabezado' for col in columnas: self.encabezado.append(col.nombre) for i in range(0, len(result)): resexp = self.resolver(self.where, ent, result, tabla, i) try: if resexp.valor: dic = {} 'busco la columna y le asigno el nuevo valor' for i in range(0, len(self.listaCampos)): nombrecol = self.listaCampos[i].columna expresion = self.listaCampos[i].exp contenido = expresion.getval(ent).valor for nocol in range(0, len(columnas)): if nombrecol == columnas[nocol].nombre: dic.update({nocol: contenido}) 'envio datos par update' llavePrim = [] for column in tabla.valor: prim: Simbolo = ent.buscarSimbolo( column.atributos.get('primary')) llavePrim = prim.valor break r = DBMS.update(dbActual, self.tabla, dic, llavePrim) if r == 0: variables.consola.insert( INSERT, 'Se ha actualizado un registro \n') except: reporteerrores.append( Lerrores( "Error Semantico", 'Error el resultado del where no es booleano', 0, 0)) variables.consola.insert( INSERT, 'Error el resultado del where no es booleano \n') else: variables.consola.insert( INSERT, "La tabla '" + self.tabla + "' que desea actualizar no existe\n") reporteerrores.append( Lerrores( "Error Semántico", "La tabla '" + self.tabla + "' que desea actualizar no existe", "", ""))
def send_data(): print("Analizando Entrada:") print("==============================================") # reporteerrores = [] contenido = Tentrada.get(1.0, 'end') variables.consola.delete("1.0", "end") variables.consola.configure(state='normal') # print(contenido) Principal = Entorno() jsonMode.dropAll() # Principal.database = "DB1" instrucciones = g.parse(contenido) variables.consola.insert(INSERT, "Salida de consultas\n") for instr in instrucciones: if instr != None: res = instr.ejecutar(Principal) if res != None: res = str(res) + '\n' variables.consola.insert(INSERT, res) variables.consola.configure(state='disabled') #variables.consola.configure() tSym = Principal.mostrarSimbolos() with open('ts.dot', 'w', encoding='utf8') as ts: ts.write(tSym) check_call(['dot', '-Tpdf', 'ts.dot', '-o', 'ts.pdf']) reporte_lex_sin()
def ejecutar(self, ent: Entorno): completo = self.nombre + '_' + ent.getDataBase() tabla: Simbolo = ent.buscarSimbolo(completo) if tabla != None: columnas = tabla.valor if len(self.valores) == len(columnas): i = 0 correcto = True for columna in columnas: nombre = columna.nombre tipo = columna.tipo util = Tipo(None, None, -1, -1) if util.comparetipo(tipo, self.valores[i].tipo): 'todo correcto' else: correcto = False return 'Error los tipos de los valores no coinciden con la definicion de la tabla' i = i + 1 terminales = [] for val in self.valores: terminales.append(val.getval(ent)) print("T ", terminales) r = DBMS.insert(ent.getDataBase(), self.nombre, terminales) if (r == 4): return 'Error al Insertar Registro Violacion de Constraint Primary Key' return 'Registros insertados con exito'
def ejecutar(self, ent): 'ejecucion del if' rescond = self.exp.getval(ent).valor if rescond == True: for instr in self.cif: newent = Entorno(ent) val = instr.ejecutar(newent) if val != None: return val return if self.elsif != None: for elsif in self.elsif: if elsif.exp.getval(ent).valor: newent = Entorno(ent) for instr in elsif.cif: newent = Entorno(ent) val = instr.ejecutar(newent) if val != None: return val return if self.celse != None: for inst in self.celse: newent = Entorno(ent) val = inst.ejecutar(newent) if val != None: return val
def ejecutar(self, ent: Entorno): dbActual = ent.getDataBase() if dbActual != None: sym: Simbolo = ent.buscarIndex(self.iden) if sym != None: tabla: Simbolo = ent.buscarSimbolo(sym.tabla + "_" + dbActual) if tabla != None: columna = self.colIdx if isinstance(self.colIdx, int): if self.colIdx <= len(tabla.valor): columna = tabla.valor[self.colIdx - 1].nombre else: variables.consola.insert(INSERT, "El número '" + str( self.colIdx) + "' de columna en la tabla '" + sym.tabla + "' no existe.\n") reporteerrores.append(Lerrores("Semántico", "El número '" + str( self.colIdx) + "' de columna en la tabla '" + sym.tabla + "' no existe.", "", "")) return for col in tabla.valor: if col.nombre == columna: sym.valor.update({'columna': columna}) variables.consola.insert(INSERT, "El index '" + self.iden + "' ahora pertenece a la columna '" + columna + "'\n") return variables.consola.insert(INSERT, "La columna '" + columna + "' a la que desea cambiar el índice '" + self.iden + "' no existe.\n") reporteerrores.append(Lerrores("Semántico", "La columna '" + columna + "' a la que desea cambiar el índice '" + self.iden + "' no existe.", "", "")) else: variables.consola.insert(INSERT, "El index '" + self.iden + "' no existe \n") reporteerrores.append(Lerrores("Semántico", "El index '" + self.iden + "' no existe", "", ""))
def send_data(): print("Analizando Entrada:") print("==============================================") # reporteerrores = [] contenido = Tentrada.get(1.0, 'end') variables.consola.delete("1.0", "end") variables.consola.configure(state='normal') # print(contenido) Principal = Entorno() jsonMode.dropAll() # Principal.database = "DB1" instrucciones = g.parse(contenido) variables.consola.insert(INSERT, "Salida de consultas\n") for instr in instrucciones: if instr != None: instr.ejecutar(Principal) string = str(instr) intrprueba = string variables.consola.configure(state='disabled') # variables.consola.configure() setContenido(Principal.mostrarSimbolos())
def send_data(): print("Analizando Entrada:") print("==============================================") # reporteerrores = [] contenido = Tentrada.get(1.0, 'end') Tsalida.delete("1.0", "end") Tsalida.configure(state='normal') # print(contenido) jsonMode.dropAll() jsonMode.createDatabase("DB1") Principal = Entorno() Principal.database = "DB1" instrucciones = g.parse(contenido) Tsalida.insert(INSERT, "Salida de consultas\n") for instr in instrucciones: if instr != None: res = instr.ejecutar(Principal) if res != None: res += '\n' Tsalida.insert(INSERT, res) Tsalida.configure(state='disabled') Principal.mostrarSimbolos() reporte_lex_sin()
def ejecutar(self, ent: Entorno): dbActual = ent.getDataBase() if dbActual != None: res = ent.eliminarIndex(self.iden) if res: variables.consola.insert(INSERT, "El índice '" + self.iden + "' se ha eliminado. \n") else: variables.consola.insert(INSERT, "El índice '" + self.iden + "' que desea eliminar no existe.\n") reporteerrores.append(Lerrores("Semántico","El índice '" + self.iden + "' que desea eliminar no existe.","",""))
def ejecutar(self, ent:Entorno): if (ent.getDataBase()==None): return "ERROR >> En la instrucción Drop Table "+self.id+", actualmente no hay ninguna base de datos en uso" else: resultado = DBMS.dropTable(ent.getDataBase(),self.id) if (resultado==0): ent.eliminarSimbolo(self.id+"_"+ent.getDataBase()) return "La tabla: ("+self.id+") ha sido eliminada con exito" else: return "ERROR >> En la instrucción Drop Table "+self.id+", La tabla a eliminar NO EXISTE"
def ejecutar(self, ent: Entorno): #formato para el enum: ENUM_database_identificador nuevoType: Simbolo = Simbolo( TipoSimbolo.TYPE_ENUM, ("ENUM_" + ent.getDataBase() + "_" + self.id), self.contenido) nuevoType.baseDatos = ent.getDataBase() r = ent.nuevoSimbolo(nuevoType) if r == "ok": return "Nuevo tipo '" + self.id + "' creado" return "El tipo '" + self.id + "' ya existe declarado"
def ejecutar(self,ent:Entorno): #formato para el enum: ENUM_database_identificador nuevoType:Simbolo = Simbolo(TipoSimbolo.TYPE_ENUM,("ENUM_" + ent.getDataBase() + "_" + self.id),self.contenido) nuevoType.baseDatos = ent.getDataBase() r = ent.nuevoSimbolo(nuevoType) if r == "ok": variables.consola.insert(INSERT,"Nuevo tipo '" + self.id + "' creado\n") return variables.consola.insert(INSERT,"El tipo '" + self.id + "' ya existe declarado\n") reporteerrores.append(Lerrores("Error Semántico","El tipo '" + self.id + "' ya existe declarado","",""))
def ejecutar(self, ent: Entorno): dbActual = ent.getDataBase() result = [] if dbActual != None: tabla: Simbolo = ent.buscarSimbolo(self.tabla + "_" + dbActual) if tabla != None: 'obtengo tabla' real = tabla.nombre.replace('_' + ent.getDataBase(), '') result = DBMS.extractTable(ent.getDataBase(), real) columnas = tabla.valor 'lleno encabezado' for col in columnas: self.encabezado.append(col.nombre) for i in range(0, len(result)): resexp = self.resolver(self.where, ent, result, tabla, i) try: if resexp.valor: 'envio datos par update' llavePrim = [] for column in tabla.valor: prim: Simbolo = ent.buscarSimbolo( column.atributos.get('primary')) llavePrim = prim.valor break #print("PK ----------",llavePrim) r = DBMS.delete(dbActual, self.tabla, llavePrim) #print("DELTEEEE ------------> ",r) if r == 0: variables.consola.insert( INSERT, 'Se ha eliminado un registro \n') except: reporteerrores.append( Lerrores( "Error Semantico", 'Error el resultado del where no es booleano', 0, 0)) variables.consola.insert( INSERT, 'Error el resultado del where no es booleano \n') else: variables.consola.insert( INSERT, "La tabla '" + self.tabla + "' que desea eliminar no existe\n") reporteerrores.append( Lerrores( "Error Semántico", "La tabla '" + self.tabla + "' que desea eliminar no existe", "", ""))
def prueba(): stack = [] ci = CodigoIntermedio(Entorno()) t0 = t0 * 1 t0 = t0 + 0 t4 = t4 - 0 t0 = t1 * 2 absoluto = 10 hora = 1 + 1 valor = hora hora = valor seno = seno + 0 seno = seno - 0 seno = seno * 1 seno = seno * 2 t1 = t2 / 1 t3 = t3 / 1 t4 = t5 * 1 valor = seno + 0 valor = seno - 0 t6 = t7 * 1 t8 = t9 / 1 x = y * 0 t11 = 0 / t12 t12 = t13 + 0 val = nuevo - 0 valor = seno / 1 valor = absoluto * 2 valor = absoluto * 0 valor = 0 / absoluto
class Case(Instruccion): def __init__(self, exp=None, cases=None, celse=None): self.exp = exp self.cases = cases self.celse = celse def ejecutar(self, ent): 'ejecucion del case' if self.exp != None: for case in self.cases: cond = Relacional(self.exp, case.exp, '=') if cond.getval(ent).valor: newent = Entorno(ent) for ins in case.instr: val = ins.ejecutar(newent) if val != None: return val return else: for case in self.cases: if case.exp.getval(ent).valor: newent = Entorno(ent) for ins in case.instr: val = ins.ejecutar(newent) if val != None: return val return if self.celse != None: newent = Entorno(ent) for ins in self.celse: val = ins.ejecutar(newent) if val != None: return val
def ejecutar(self, ent: Entorno): bases = DBMS.showDatabases() for db in bases: if db == self.id: ent.database = id #print(ent.database) return
def traducir(): # reporteerrores = [] contenido = Tentrada.get(1.0, 'end') variables.consola.delete("1.0", "end") variables.consola.configure(state='normal') Principal = Entorno() #jsonMode.dropAll() instrucciones = g.parse(contenido) variables.consola.insert(INSERT, "Salida de traduccion\n") salida = 'from goto import with_goto\n' salida += 'from CodigoIntermedio import CodigoIntermedio\n' salida += 'from Entorno.Entorno import Entorno\n' salida += '@with_goto\n' salida += 'def prueba():\n' salida += '\tstack =[]\n' salida += '\tci = CodigoIntermedio(Entorno())\n' salida2 = '' for instr in instrucciones: if instr != None: #try: s = instr.traducir(Principal) if s != None: salida2 += s.codigo3d #except Exception as inst: # print(inst) salida2 = salida2.replace('goto temp', generarsaltos()) filas = salida2.split('\n') salida2 = '' for fila in filas: salida2 += '\t' + fila + '\n' salida = salida + salida2 f = open('tsAux', 'w') f.write(Principal.mostrarProc()) f.close() print(salida) f = open('prueba.py', 'w') f.write(salida) f.write('\tci.getSym()\n') f.close()
def getval(self, ent:Entorno): 'ejecucion llamada funcinon' sim=ent.buscarSimbolo('_f'+self.nombre) if sim != None: tipo=sim.tipo defparams=sim.valor[0] instrucciones=sim.valor[1] newent=Entorno(ent) if self.parametros!=None and defparams!=None: if len(defparams)==len(self.parametros): for i in range(0,len(defparams)): param=defparams[i] dec=Declaracion(param.nombre,False,param.tipo,self.parametros[i]) dec.ejecutar(newent) for inst in instrucciones: v= inst.ejecutar(newent) if v!=None: util=Tipo('',None,-1,-1) if util.comparetipo(v.tipo,tipo): return v else: reporteerrores.append(Lerrores("Error Semantico", "Error el tipo devuelto no coincide con el de la funcion", 0, 0)) variables.consola.insert(INSERT, "Error el tipo devuelto no coincide con el de la funcion") else: reporteerrores.append(Lerrores("Error Semantico","Error Los parametros no coinciden con la definicion de la funcion",0, 0)) variables.consola.insert(INSERT,"Error Los parametros no coinciden con la definicion de la funcion") return else: for inst in instrucciones: v = inst.ejecutar(newent) if v != None: util = Tipo('', None, -1, -1) if util.comparetipo(v.tipo, tipo): return v else: reporteerrores.append( Lerrores("Error Semantico", "Error el tipo devuelto no coincide con el de la funcion", 0, 0)) variables.consola.insert(INSERT, "Error el tipo devuelto no coincide con el de la funcion") else: reporteerrores.append( Lerrores("Error Semantico", "Error la funcion no existe", 0, 0)) variables.consola.insert(INSERT, "Error la funcion no existe")
def ejecutar(self, ent: Entorno): if (ent.getDataBase() == None): variables.consola.insert( INSERT, "ERROR >> En la instrucción Drop Table " + self.id + ", actualmente no hay ninguna base de datos en uso\n") reporteerrores.append( Lerrores( "Error Semántico", "En la instrucción Drop Table " + self.id + ", actualmente no hay ninguna base de datos en uso", "", "")) else: resultado = DBMS.dropTable(ent.getDataBase(), self.id) if (resultado == 0): ent.eliminarSimbolo(self.id + "_" + ent.getDataBase()) ent.eliminarSymTabla(self.id) variables.consola.insert( INSERT, "La tabla: (" + self.id + ") ha sido eliminada con exito\n") else: variables.consola.insert( INSERT, "ERROR >> En la instrucción Drop Table " + self.id + ", La tabla a eliminar NO EXISTE\n") reporteerrores.append( Lerrores( "Error Semántico", "En la instrucción Drop Table " + self.id + ", La tabla a eliminar NO EXISTE", "", ""))
def ejecutar(self, ent: Entorno): tablas = [] result = [] self.encabezado = [] 'Metodo Abstracto para ejecutar la instruccion' if self.distinct is None and self.froms is None and self.where is None and self.group is None and self.having is None and self.order is None and self.combinig is None: resultados = [] for exp in self.exps: if exp != None: resultados.append(exp.getval(ent)) return resultados elif self.froms != None and self.exps != None: for exp in self.froms: if exp != None: tipo = exp.tipo if tipo.tipo == 'identificador': nombre = exp.getval(ent) tabla = ent.buscarSimbolo(nombre + "_" + ent.getDataBase()) if tabla != None: tablas.append(tabla) if len(tablas) > 1: 'producto cartesiano' else: 'llenar resultado desde backend' real = tablas[0].nombre.replace('_' + ent.getDataBase(), '') result = DBMS.extractTable(ent.getDataBase(), real) #filtros if self.where != None: result = self.execwhere(ent, tablas) #acceder a columnas if len(self.exps) == 1: if self.exps[0].getval(ent) == '*': self.mostarresult(result, 'prueba xd') elif self.exps[0].tipo.tipo == 'identificador': 'obtengo solo columnas pedidas' else: 'pendientes subconsultas y funciones'
def ejecutar(self, ent): 'ejecucion del case' if self.exp != None: for case in self.cases: cond = Relacional(self.exp, case.exp, '=') if cond.getval(ent).valor: newent = Entorno(ent) for ins in case.instr: val = ins.ejecutar(newent) if val != None: return val return else: for case in self.cases: if case.exp.getval(ent).valor: newent = Entorno(ent) for ins in case.instr: val = ins.ejecutar(newent) if val != None: return val return
def ejecutar(self, ent: Entorno): bases = DBMS.showDatabases() existe = False for db in bases: if db == self.id: ent.database = self.id existe = True break if existe: return "Base de datos: " + ent.database + " en uso actualmente" else: return "ERROR >> En la instrucción Use " + self.id + ", La base de datos a utilizar NO EXISTE"
def ejecutar(self, ent:Entorno): tam = len(self.listaDef) print (tam) nuevaTabla = Simbolo(TipoSimbolo.TABLA,self.id) listaColumnas = [] for x in range(0,tam,1): tt = self.listaDef[x] if tt.tipo == AtributosColumna.COLUMNA_SIMPLE: self.numColumnas += 1 nuevaColumna = Simbolo(tt.tipoDato,tt.identificador) listaColumnas.append(nuevaColumna) nuevaTabla.valor = listaColumnas dbActual = ent.getDataBase() if dbActual != None: estado = DBMS.createTable(dbActual,self.id, self.numColumnas) if estado == 0: nuevaTabla.baseDatos = dbActual ent.nuevoSimbolo(nuevaTabla) print("Tabla Creada") DBMS.showCollection()
def ejecutar(self, ent:Entorno): tabla:Simbolo = ent.buscarSimbolo(self.nombre) if tabla != None: columnas=tabla.valor if len(self.valores)== len(columnas): i=0 correcto=True for columna in columnas: nombre=columna.nombre tipo=columna.tipo util=Tipo(None,None,-1,-1) if util.comparetipo(tipo,self.valores[i].tipo): 'todo correcto' else: correcto=False return 'Error los tipos de los valores no coinciden con la definicion de la tabla' i=i+1 terminales = [] for val in self.valores: terminales.append(val.getval(ent)) DBMS.insert(ent.getDataBase(),tabla.nombre,terminales)
def ejecutar(self, ent: Entorno): self.traducir(ent) bases = DBMS.showDatabases() existe = False for db in bases: if db == self.id: ent.database = self.id; existe = True break if existe: variables.consola.insert(INSERT, "Base de datos: " + ent.database + " en uso actualmente\n") return else: return "ERROR >> En la instrucción Use " + self.id + ", La base de datos a utilizar NO EXISTE"
def ejecutar(self, ent: Entorno): self.encabezado.clear() resultfiltro = [] resultfiltro.clear() llavesprim = [] llavesprim.clear() dbActual = ent.getDataBase() result = [] result.clear() if dbActual != None: tabla: Simbolo = ent.buscarSimbolo(self.tabla + "_" + dbActual) if tabla != None: 'obtengo tabla' real = tabla.nombre.replace('_' + ent.getDataBase(), '') result = DBMS.extractTable(ent.getDataBase(), real) columnas = tabla.valor 'lleno encabezado' for col in columnas: self.encabezado.append(col.nombre) for i in range(0, len(result)): resexp = self.resolver(self.where, ent, result, tabla, i) try: if not resexp.valor: resultfiltro.append(result[i]) 'envio datos para delete' llavePrim = [] for column in tabla.valor: prim: Simbolo = ent.buscarSimbolo( column.atributos.get('primary')) if prim != None: llavePrim = prim.valor break except: reporteerrores.append( Lerrores( "Error Semantico", 'Error el resultado del where no es booleano', 0, 0)) variables.consola.insert( INSERT, 'Error el resultado del where no es booleano \n') llavesprim = llavePrim self.resultdelete(resultfiltro, self.tabla, ent.getDataBase(), llavesprim) else: variables.consola.insert( INSERT, "La tabla '" + self.tabla + "' que desea eliminar no existe\n") reporteerrores.append( Lerrores( "Error Semántico", "La tabla '" + self.tabla + "' que desea eliminar no existe", "", ""))
def send_data(): print("Analizando Entrada:") print("==============================================") #reporteerrores = [] contenido = Tentrada.get(1.0, 'end') Tsalida.delete("1.0", "end") Tsalida.configure(state='normal') Tsalida.insert(INSERT, "Salida de consultas") Tsalida.configure(state='disabled') #print(contenido) globalEnt = Entorno() raiz = g.parse(contenido) for x in raiz: if x != None: x.ejecutar(globalEnt)
def traducir(): # reporteerrores = [] contenido = Tentrada.get(1.0, 'end') variables.consola.delete("1.0", "end") variables.consola.configure(state='normal') Principal = Entorno() jsonMode.dropAll() instrucciones = g.parse(contenido) variables.consola.insert(INSERT, "Salida de traduccion\n") salida = '' for instr in instrucciones: if instr != None: salida += instr.traducir(Principal).codigo3d print(salida)