def createTbl(database: str, table: str, numberColumns: int): instruccion = g.parse('CREATE TABLE tbProducto (idproducto integer primary key, \ producto varchar(150), \ fechacreacion date, \ estado integer);') erroresSemanticos = [] for instr in instruccion['ast'] : if instr != None: result = instr.executec3d(datos) #print(result+'--MF') if isinstance(result, Error): print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") print(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance(instr, select.QuerysSelect): print(str(instr.ImprimirTabla(result))) else: print(str(result)) resultado = 10 #createTable(database, table, numberColumns) if resultado == 1: print('Error(42P16): invalid_table_definition.') elif resultado == 2: print('Error(???): No existe la base de datos.') elif resultado == 3: print('Error(42P07): duplicate_table.') elif resultado == 0: print('Tabla ' + table + ' creada correctamente')
def do_dataquery(self): global datos dataSize = int(self.headers['Content-Length']) reqBody = self.rfile.read(dataSize) reqData = json.loads(reqBody.decode("utf-8")) texto = reqData["texto"] instrucciones = g.parse(texto) textoenviado = "" for instr in instrucciones['ast']: if instr != None: result = instr.execute(datos) if isinstance(result, Error): print(str(result.desc)) #imprimir en consola textoenviado = textoenviado + str(result.desc) '''self.send_response(200) self.send_header('Content-type', 'application/json') self.end_headers() self.wfile.write(bytes("enviado", 'utf-8'))''' #erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance( instr, select.QuerysSelect): textoenviado = textoenviado + str( instr.ImprimirTabla( result)) + "\n" #imprimir en consola else: textoenviado = textoenviado + str( result) + "\n" #imprimir en consola respuesta = {"consola": textoenviado} myJsonResponse = json.dumps(respuesta) self.send_response(200) self.send_header('Content-type', 'application/json') self.end_headers() self.wfile.write(bytes(myJsonResponse, 'utf-8'))
def parsear(input_x): res = [] fx = open("entrada.txt", "w") fx.write(input_x) fx.close() ruta = 'entrada.txt' f = open(ruta, "r") input = f.read() instrucciones = g.parse(input) for instr in instrucciones['ast']: if instr == None: continue result = instr.execute(datos) if isinstance(result, error.Error): print(result) elif isinstance(instr, select.Select): res.append(instr.ImprimirTabla(result)) #print(instr.ImprimirTabla(result)) else: res.append(result) #print(input) return '\n '.join([(str(elem)) for elem in res])
def Ejecutar(): global datos texto = request.json['query'] #f = open ('TytusTest.sql','r') #texto = f.read() #print(texto) #f.close() instrucciones = g.parse(texto) erroresSemanticos = [] salida = "" for instr in instrucciones['ast'] : if instr != None: result = instr.execute(datos) if isinstance(result, error): salida = salida + str(result.desc) + "\n" #imprimir en consola erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance(instr, select.QuerysSelect): salida = salida + str(instr.ImprimirTabla(result)) + "\n" #imprimir en consola else: salida = salida + str(result) + "\n" #imprimir en consola errores = g.getMistakes() salidaE = "" for error1 in errores: salidaE += error1.toString() + "\n" salida = salida + salidaE + "\n" errores.clear() erroresSemanticos.clear() del instrucciones print(salida) return jsonify({"mensaje":salida})
def insertC3D(database: str, table: str, register: list): #print('************ registro') #print(register) cadenaIns = 'INSERT INTO ' + table + ' VALUES(' contadorCampos = 0 for campoIns in register: if contadorCampos == 0: if es_numero(campoIns): cadenaIns = cadenaIns + str(campoIns) else: fTipo = campoIns.find("NOW") if fTipo >= 0: cadenaIns = cadenaIns + str(campoIns) else: cadenaIns = cadenaIns + "'" + str(campoIns) + "'" else: if es_numero(campoIns): cadenaIns = cadenaIns + "," + str(campoIns) else: fTipo = campoIns.find("NOW") if fTipo >= 0: cadenaIns = cadenaIns + "," + str(campoIns) else: cadenaIns = cadenaIns + ",'" + str(campoIns) + "'" contadorCampos += 1 cadenaIns = cadenaIns + ");" instruccion = g.parse(cadenaIns) erroresSemanticos = [] for instr in instruccion['ast']: if instr != None: result = instr.executec3d(datos) #print(result+'--MF') if isinstance(result, Error): print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") print(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance( instr, select.QuerysSelect): print(str(instr.ImprimirTabla(result))) else: print(str(result)) resultado = 100 #insert(database, table, register) if resultado == 1: print('Error(42P16): invalid_table_definition.') elif resultado == 2: print('Error(???): No existe la base de datos.') elif resultado == 3: print('Error(???): No existe la tabla.') elif resultado == 4: print('Error(???): Llave primaria duplicada.') elif resultado == 5: print('Error(???): No coincide el numero de campos.') elif resultado == 0: print('Dato insertado correctamente')
def analize(texto): global datos instrucciones = g.parse(texto) for instr in instrucciones['ast']: if instr != None: result = instr.execute(datos) if isinstance(result, Error): eel.printText(str(result)) elif isinstance(instr, select.Select) or isinstance( instr, select.QuerysSelect): eel.addTable( str( instr.ImprimirTabla(result).get_html_string( format=True))) elif isinstance(instr, show.Show): eel.addTable(str(result.get_html_string(format=True))) else: eel.printText(str(result)) #return str(result) errores = g.getMistakes() errores.clear() del instrucciones
def analisis(): global datos salida.delete("1.0", "end") texto = editor.get("1.0", "end") instrucciones = g.parse(texto) erroresSemanticos = [] try: hacerReporteGramatica(instrucciones['reporte']) except: print("") for instr in instrucciones['ast']: if instr != None: result = instr.execute(datos) print(result) if isinstance(result, Error): print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") escribirEnSalidaFinal(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select): print("jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj") escribirEnSalidaFinal(str(instr.ImprimirTabla(result))) else: escribirEnSalidaFinal(str(result)) errores = g.getMistakes() recorrerErrores(errores) Rerrores(errores, erroresSemanticos) errores.clear() erroresSemanticos.clear() reporteTabla() del instrucciones
def prueba2(): if request.method == 'POST': content = request.get_json() name = content['codigo'] instrucciones = g.parse(name) for instr in instrucciones['ast'] : if instr == None: continue result = instr.execute(datos) if isinstance(result, error.Error): print(result) elif isinstance(instr, select.Select): print(instr.ImprimirTabla(result)) else: try: #response = "hola " + name response = {"codigo":str(result)} return response except ClientError as e: logging.error(e) return e.response #print(str(result)) try: response = "hola " + name return response except ClientError as e: logging.error(e) return e.response
def createDB(database: str) : instruccion = g.parse("CREATE DATABASE IF NOT EXISTS test OWNER = 'root' MODE = 1;") erroresSemanticos = [] for instr in instruccion['ast'] : if instr != None: result = instr.executec3d(datos) #print(result+'--MF') if isinstance(result, Error): print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") print(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance(instr, select.QuerysSelect): print(str(instr.ImprimirTabla(result))) else: print(str(result)) #*********************** CREATE DB **************************** resultado = 10 #createDatabase(database) if resultado==0: print('Base de datos ' + database + ' creada correctamente') elif resultado==2: print('Error al crear la base de datos ' + database + '. El nombre ya existe') elif resultado==1: print('Ha ocurrido un error al crear la base de datos ' + database + '.') elif resultado==0: print('Error desconocido')
def analisis(): global errores texto = editor.get("1.0", "end") instrucciones = g.parse(texto) errores = g.getMistakes() recorrerErrores() Rerrores() errores.clear()
def do_runQuery(self): global datos dataSize = int(self.headers['Content-Length']) reqBody = self.rfile.read(dataSize) reqData = json.loads(reqBody.decode("utf-8")) texto = reqData["text"] ####################################################ENVIANDO AL PARSER instrucciones = g.parse(texto) erroresSemanticos = [] contenido = "" text = "" try: f = open("../../../../parser/team26/G26/Utils/tabla.txt", "r") text = f.read() text = text.replace('\'', '"') text = text.replace('False', '"False"') text = text.replace('None', '""') text = text.replace('True', '"True"') except: text = "" print('error') for instr in instrucciones['ast']: if instr != None: result = instr.execute(datos) if isinstance(result, Error): contenido = contenido + str(result.desc) + "\n" erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance( instr, select.QuerysSelect): contenido = contenido + str( instr.ImprimirTabla(result)) + "\n" else: contenido = contenido + str(result) + "\n" databases = "" url = "../../../../parser/team26/G26/data/json/databases" try: databases = open(url).read() except: databases = "" ####################################################FIN PARSER respuesta = { "consola": contenido, "jsonText": text, "databases": databases } myJsonResponse = json.dumps(respuesta) self.send_response(200) self.send_header('Content-type', 'application/json') self.end_headers() self.wfile.write(bytes(myJsonResponse, 'utf-8'))
def selectC3D(database: str, columns: any, tablas: any, cwhere: str): #print('************ registro') #print(register) cadenaE = 'SELECT ' contCampos=0 for i in columns: if contCampos==0: cadenaE = cadenaE + str(i) else: cadenaE = cadenaE + ', ' + str(i) contCampos+=1 if len(tablas)>0: cadenaE = cadenaE + ' FROM ' contCampos=0 for j in tablas: if contCampos==0: cadenaE = cadenaE + str(j) else: cadenaE = cadenaE + ', ' + str(j) contCampos+=1 if len(cwhere)>0: cadenaE = cadenaE + ' WHERE ' + cwhere instruccion = g.parse(cadenaE) erroresSemanticos = [] for instr in instruccion['ast'] : if instr != None: result = instr.executec3d(datos) #print(result+'--MF') if isinstance(result, Error): print(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance(instr, select.QuerysSelect): print(str(instr.ImprimirTabla(result))) else: print(str(result)) resultado = 100 #update(database, table, register, columns) if resultado == 1: print('Error(42P16): invalid_table_definition.') elif resultado == 2: print('Error(???): No existe la base de datos.') elif resultado == 3: print('Error(???): No existe la tabla.') elif resultado == 4: print('Error(???): Llave primaria no existe.') elif resultado == 5: print('Error(???): No coincide el numero de campos.') elif resultado == 0: print('Update realizado correctamente')
def parse_grammar(self): cadena = self.textArea.textarea.get(1.0, tk.END) global miTablaSimbolos global miListaErrores # Será una lista de de objetos: errorReportar instrucciones = g.parse(cadena) # print(len(instrucciones.hijos)) # print(instrucciones) self.procesar_instrucciones(instrucciones.hijos, miTablaSimbolos, miListaErrores) grafica = GraphArbol(instrucciones) grafica.crearArbol()
def analisis(): global datos salida.delete("1.0", "end") texto = editor.get("1.0", "end") instrucciones = g.parse(texto) erroresSemanticos = [] try: hacerReporteGramatica(instrucciones['reporte']) except: print("") try: f = open("./Utils/tabla.txt", "r") text = f.read() text = text.replace('\'', '"') text = text.replace('False', '"False"') text = text.replace('None', '""') text = text.replace('True', '"True"') print(text) datos.reInsertarValores(json.loads(text)) print(str(datos)) except: print('error') for instr in instrucciones['ast']: if instr != None: result = instr.execute(datos) if isinstance(result, Error): escribirEnSalidaFinal(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance( instr, select.QuerysSelect): escribirEnSalidaFinal(str(instr.ImprimirTabla(result))) else: escribirEnSalidaFinal(str(result)) f = open("./Utils/tabla.txt", "w") f.write(str(datos)) f.close() errores = g.getMistakes() recorrerErrores(errores) Rerrores(errores, erroresSemanticos) errores.clear() erroresSemanticos.clear() reporteTabla() del instrucciones
def debbugear(): debugger.delete(*debugger.get_children()) consola.delete('1.0', END) input = txtarea.get(1.0, END) erris = lista_err.L_Error() resultado = g.parse(input, erris) global debbug if erris.principio is not None: errores(erris.principio) else: debbug = Debbuger.Debbugger(resultado, consola, txtarea, debugger) thread = threading.Thread(target=debbug.start) thread.start() thread.join()
def Main(input, consola): global archivoDot global idP archivoDot = "" idP = 0 global shell shell = consola instrucciones = g.parse(input) ts_global = TS.TablaDeSimbolos() procesar_instrucciones(instrucciones, 0, ts_global) archivoDot += "Digraph{\n p0[label=\"Main\"];\n" graficar_procesar_instrucciones(instrucciones, 0, ts_global) contadorPadre() archivoDot += "}" crearTS(ts_global)
def otro(): ruta = '../G26/entrada.txt' f = open(ruta, "r") input = f.read() instrucciones = g.parse(input) for instr in instrucciones['ast']: if instr == None: continue result = instr.execute(datos) if isinstance(result, error.Error): print(result) elif isinstance(instr, select.Select): print(instr.ImprimirTabla(result)) else: print(result)
def analizar(): consola.delete('1.0', END) input = txtarea.get(1.0, END) interprete = inter.Interprete() resultado = g.parse(input, interprete.errores) if interprete.errores.principio is not None: errores(interprete.errores.principio) else: imprimir(resultado) thread = threading.Thread(target=interprete.analizar, args=(resultado, )) thread.start() thread.join() errores(interprete.errores.principio) TS(interprete.pila.obtenerreporte()) consola.insert(INSERT, interprete.codigo)
def useDatabase(database: str) : instruccion = g.parse("USE TEST;") erroresSemanticos = [] for instr in instruccion['ast'] : if instr != None: result = instr.executec3d(datos) #print(result+'--MF') if isinstance(result, Error): print("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") print(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance(instr, select.QuerysSelect): print(str(instr.ImprimirTabla(result))) else: print(str(result)) print('Use ' + database)
def transaccionar(): query = request.json['query'] instrucciones = g.parse(query) print(instrucciones) mensaje = "" text = "" for instr in instrucciones['ast']: if instr != None: result = instr.execute(datos) if isinstance(result, Error): mensaje = mensaje + str(result.desc) + "\n" elif isinstance(instr, select.Select) or isinstance( instr, select.QuerysSelect): mensaje = mensaje + str(instr.ImprimirTabla(result)) + "\n" else: mensaje = mensaje + str(result) + "\n" print(mensaje) return jsonify({"msj": mensaje})
def traduccion(self): if self.codigo.text() == "": return self.editor.setText("") sys.setrecursionlimit(2147483644) self.consola.clear() ReporteErrores.func(None,True) g.textoEntrada = self.codigo.text() g.func(0,None) instrucciones = g.parse(self.codigo.text()) self.instrucciones = instrucciones ts_global = TS.Entorno(None) ast = AST.AST(instrucciones) temp.temporal(True) temp.parametro(True) temp.etiqueta(True) temp.listaContinue(-1,None) temp.listaBreak(-1,None) temp.listaReturn(-1,None) temp.listaLLamada(-1,None) temp.listaRecusion(-1,None) #PRIMERA PASADA PARA GUARDAR TODAS LAS FUNCIONES Y STRUCTS if(instrucciones != None): for ins in instrucciones: try: if(isinstance(ins,Funcion)): if(ast.existeEtiqueta(ins)): error = Error.Error("SEMANTICO","Error semantico, Ya existe la funcion "+ins.id,ins.linea,ins.columna) ReporteErrores.func(error) else: if(ins.id != "main"): ins.inicializar(ts_global,ast,self) ast.agregarEtiqueta(ins) elif(isinstance(ins,Struct)): if(ast.existeStruct(ins)): error = Error.Error("SEMANTICO","Error semantico, Ya existe el Struct "+ins.id,ins.linea,ins.columna) ReporteErrores.func(error) else: ast.agregarStruct(ins) except: pass #SE TRADUCE EL METODO MAIN main = ast.obtenerEtiqueta("main") if(main != None): self.editor.append("main:") #se corren las instrucciones globales for ins in instrucciones: try: if(not isinstance(ins,Funcion)): try: ins.traducir(ts_global,ast,self) except: pass except: pass entMain = TS.Entorno(ts_global) for ins in main.instrucciones: try: ins.traducir(entMain,ast,self) except: pass ast.entornoGlobal.tabla = {**entMain.tabla,**ast.entornoGlobal.tabla} ast.entornoGlobal.tabla = {**ts_global.tabla,**ast.entornoGlobal.tabla} else: error = Error.Error("SEMANTICO","Error semantico, No puede iniciarse el programa ya que no existe el metodo main()",0,0) ReporteErrores.func(error) listado = ReporteErrores.func(None) if(len(listado)>0): QMessageBox.critical(self.centralwidget, "Errores en Traducción", "Se obtuvieron errores en la traducción del Código Ingresado, verifique reporte de Errores de Traducción") self.ts_global = ts_global self.ast = ast self.listado_gramatical = g.func(1,None).copy()
def analisis(): global datos fc3d = open("./c3d/codigo3Dgenerado.py", "w") fc3d.write("from sentencias import *\n") fc3d.write("from goto import with_goto\n") fc3d.write("@with_goto # Decorador necesario.\n") fc3d.write("\n") fc3d.write("def main():\n") fc3d.close() salida.delete("1.0", "end") texto = editor.get("1.0", "end") instrucciones = g.parse(texto) erroresSemanticos = [] try: hacerReporteGramatica(instrucciones['reporte']) except: print("") try: f = open("./Utils/tabla.txt", "r") text = f.read() text = text.replace('\'','"') text = text.replace('False','"False"') text = text.replace('None','""') text = text.replace('True','"True"') #print(text) datos.reInsertarValores(json.loads(text)) #print(str(datos)) except: print('error bloque utils tabla') for instr in instrucciones['ast'] : if instr != None: result = instr.execute(datos) #print(result) if isinstance(result, Error): #sprint("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") escribirEnSalidaFinal(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance(instr, select.QuerysSelect): escribirEnSalidaFinal(str(instr.ImprimirTabla(result))) else: escribirEnSalidaFinal(str(result)) f = open("Utils/tabla.txt", "w") f.write(str(datos)) f.close() fc3d = open("./c3d/codigo3Dgenerado.py", "a") fc3d.write("\n") fc3d.write("main()\n") fc3d.close() errores = g.getMistakes() recorrerErrores(errores) Rerrores(errores, erroresSemanticos) errores.clear() erroresSemanticos.clear() repIndex.reporteTablaIndices(datos) reporteTabla() del instrucciones
import gramatica as g x = 0 def newTemp(): global x x += 1 temp = "t"+str(x) return temp def recorrerAST(nodo): if isinstance(nodo, str): return (nodo, "") else: izqTMP, izqC3D = recorrerAST(nodo.opIzq) derTMP, derC3D = recorrerAST(nodo.opDer) signo = nodo.signo temporal = newTemp() return (temporal, izqC3D + derC3D + "\n"+temporal+" = "+izqTMP + " "+signo+" "+derTMP) ast = g.parse("a+b*c/d+g*a") tmp, c3d = recorrerAST(ast) print(c3d)
def analisis(): global datos salida.delete("1.0", "end") texto = editor.get("1.0", "end") try: f = open("./Utils/tabla.txt", "r") text = f.read() f.close() text = text.replace('\'', '"') text = text.replace('False', '"False"') text = text.replace('None', '""') text = text.replace('True', '"True"') print(text) datos.reInsertarValores(json.loads(text)) print(str(datos)) except: print('error') #g2.tempos.restartTemp() #reinicia el contador de temporales. prueba = g2.parse(texto) #print(prueba['text']) exepy = ''' #imports from goto import with_goto import gramatica as g import Utils.Lista as l import Librerias.storageManager.jsonMode as storage storage.dropAll() heap = [] datos = l.Lista({}, '') ''' exepy += ''' #funcion intermedia def mediador(): global heap # Analisis sintactico instrucciones = g.parse(heap.pop()) for instr in instrucciones['ast'] : print(instr.execute(datos)) ''' exepy += ''' #funciones de plg-sql ''' exepy += ''' #main #@with_goto def main(): global heap ''' exepy += str(prueba['text']) exepy += ''' #Ejecucion del main if __name__ == "__main__": main() ''' f = open("./c3d.py", "w") f.write(exepy) f.close() instrucciones = g.parse(texto) erroresSemanticos = [] try: hacerReporteGramatica(instrucciones['reporte']) except: print("") '''try: f = open("./Utils/tabla.txt", "r") text = f.read() text = text.replace('\'','"') text = text.replace('False','"False"') text = text.replace('None','""') text = text.replace('True','"True"') print(text) datos.reInsertarValores(json.loads(text)) print(str(datos)) except: print('error')''' for instr in instrucciones['ast']: if instr != None: result = instr.execute(datos) if isinstance(result, Error): escribirEnSalidaFinal(str(result.desc)) erroresSemanticos.append(result) elif isinstance(instr, select.Select) or isinstance( instr, select.QuerysSelect): escribirEnSalidaFinal(str(instr.ImprimirTabla(result))) else: escribirEnSalidaFinal(str(result)) f = open("./Utils/tabla.txt", "w") f.write(str(datos)) f.close() errores = g.getMistakes() recorrerErrores(errores) Rerrores(errores, erroresSemanticos) errores.clear() erroresSemanticos.clear() reporteTabla() del instrucciones
while id_actual < len(cola.items): instruccion = cola.items[id_actual] if isinstance(instruccion,Etiqueta) or isinstance(instruccion,EtiquetaMain): etiqueta_ambito = instruccion.nombre procesar_instruccion(instruccion,tablasimbolos,etiqueta_ambito,id_actual) # elif isinstance(instruccion,Asignacion): # procesar_instruccion(instruccion,tablasimbolos,etiqueta_ambito,id_actual) id_actual += 1 def procesar_instruccion(instruccion,tablasimbolos,ambito,index): if isinstance(instruccion, Print) : procesar_print(instruccion, tablasimbolos) elif isinstance(instruccion,Asignacion) : procesar_asignacion(instruccion, tablasimbolos,ambito) elif isinstance(instruccion,Unset) : procesar_unset(instruccion,tablasimbolos) elif isinstance(instruccion,Read) : procesar_read(instruccion,tablasimbolos) elif isinstance(instruccion,Exit) : return procesar_exit(instruccion,tablasimbolos) elif isinstance(instruccion,Array) : procesar_array(instruccion,tablasimbolos,ambito) elif isinstance(instruccion,Etiqueta) : procesar_etiqueta(instruccion,tablasimbolos,'main',index) elif isinstance(instruccion,EtiquetaMain) : procesar_etiqueta(instruccion,tablasimbolos,None,0) elif isinstance(instruccion,Goto) : return procesar_goto(instruccion,tablasimbolos) elif isinstance(instruccion,Ifgoto) : return procesar_if(instruccion,tablasimbolos) else : print('Error: instrucción no válida') return None colaInstruccines = Cola() f = open("./entrada.txt", "r") input = f.read() #instrucciones contiene el arbol AST main = g.parse(input) tablasimbolos_global = TABLASIMBOLOS.TablaDeSimbolos() procesar_main(colaInstruccines,main, tablasimbolos_global) imprimirTabla(tablasimbolos_global)
import gramatica as g import Utils.TablaSimbolos as table import Utils.Lista as l datos = l.Lista([], '') ruta = '../G26/entrada.txt' f = open(ruta, "r") input = f.read() instrucciones = g.parse(input) for instr in instrucciones : instr.execute(datos) print (datos)
def parse_grammar(self): cadena = self.textArea.textarea.get(1.0, tk.END) instrucciones = g.parse(cadena)