Exemplo n.º 1
0
    def do_body(self, p_instruccion, p_st, es_global, ct_global):
        if not p_instruccion:
            messagebox.showerror("Tytus DB",
                                 "Ha ocurrido un problema en la ejecución del programa. Revisar los reportes de errores. ")
            return

        for inst in p_instruccion:
            if isinstance(inst, IfExist1):
                self.do_drop_db(inst, p_st, es_global,st.SymbolTable())
            elif isinstance(inst, CreateDatabase):
                self.do_create_database(inst, p_st, es_global)
            elif isinstance(inst, Insert):
                self.do_insert_tb(inst, p_st, es_global)
            elif isinstance(inst, DropT):
                self.do_drop_tb(inst, p_st, es_global,st.SymbolTable())
            elif isinstance(inst, CreateTable):
                self.do_create_tb(inst, p_st, es_global, ct_global)
            elif isinstance(inst, Index) or isinstance(inst, IndexMM) or isinstance(inst,IndexW) or isinstance(inst, IndexOrden):
                self.do_index(inst, p_st, es_global)
            elif isinstance(inst,Funcion):
                self.do_funcion(inst,p_st,es_global)
            elif isinstance(inst,DropIndex):
                self.do_dropIndex(inst,p_st,es_global,st.SymbolTable())
            elif isinstance(inst,AlterRenameIn):
                self.do_AlterRIndex(inst,p_st,es_global,st.SymbolTable())
            elif isinstance(inst,AlterIndex):
                self.do_AlterOrden(inst,p_st)
            else:
                print(inst)

        print("--- ANÁLISIS TERMINADO ---")
Exemplo n.º 2
0
    def tytus_ejecutar(self):
        # Getting widget
        index = self.ta_input.index(self.ta_input.select())
        ta_input = self.array_tabs[index]

        # Delete old lexical report
        if os.path.exists("reports/error_lexical.txt"):
            os.remove("reports/error_lexical.txt")

        # Delete old syntactic report
        if os.path.exists("reports/error_syntactic.txt"):
            os.remove("reports/error_syntactic.txt")

        # Delete old semantic report
        if os.path.exists("reports/error_semantic.txt"):
            os.remove("reports/error_semantic.txt")

        # Delete old output
        self.ta_output.delete('1.0', END)

        if ta_input.compare("end-1c", "!=", "1.0"):
            # Gets new input
            tytus = ta_input.get(1.0, END)

            # Start parser
            ins = g.parse(tytus)
            st_global = st.SymbolTable()

            if not ins:
                messagebox.showerror(
                    "ERROR", "Ha ocurrido un error. Verificar reportes.")
            else:
                self.do_body(ins, st_global)
        else:
            messagebox.showerror("INFO", "El campo de entrada esta vacío.")
Exemplo n.º 3
0
    def tytus_ejecutar(self):
        global GC3D
        # Getting widget
        index = self.ta_input.index(self.ta_input.select())
        ta_input = self.array_tabs[index]

        # Delete old lexical report
        if os.path.exists("reports/error_lexical.txt"):
            os.remove("reports/error_lexical.txt")

        # Delete old syntactic report
        if os.path.exists("reports/error_syntactic.txt"):
            os.remove("reports/error_syntactic.txt")

        # Delete old semantic report
        if os.path.exists("reports/error_semantic.txt"):
            os.remove("reports/error_semantic.txt")

        if ta_input.compare("end-1c", "!=", "1.0"):
            # Gets new input
            tytus = ta_input.get(1.0, END)

            # Start parser
            ins = g.parse(tytus)
            #g.gramaticaBNF(tytus)
            #Contador de temporales utilizados
            temp = g.contador
            gen = Generador(temp, 0, ins.getInstruccion())
            gen.ejecutar()
            GC3D = gen.codigo3d
            #reporteOptimizacion(reglasOpt)
            C3D = g.codigo_3D
            crearArchivo(C3D, gen.codigo3d)
            st_global = st.SymbolTable()
            es_global = es.ListaErroresSemanticos()
            ct_global = ct.crearTabla()

            if not ins:
                messagebox.showerror(
                    "ERROR", "Ha ocurrido un error. Verificar reportes.")
            else:
                self.do_body(ins.getInstruccion(), st_global, es_global,
                             ct_global)
                self.raiz_ast = ins.getNodo()
                self.new_output(
                    "--- SE HA GENERADO EL ARCHIVO ÉXITOSAMENTE ---")
        else:
            messagebox.showerror("INFO", "El campo de entrada esta vacío.")
Exemplo n.º 4
0
    def tytus_ejecutar(self):
        # Getting widget
        index = self.ta_input.index(self.ta_input.select())
        ta_input = self.array_tabs[index]

        # Delete old lexical report
        if os.path.exists("reports/error_lexical.txt"):
            os.remove("reports/error_lexical.txt")

        # Delete old syntactic report
        if os.path.exists("reports/error_syntactic.txt"):
            os.remove("reports/error_syntactic.txt")

        # Delete old semantic report
        if os.path.exists("reports/error_semantic.txt"):
            os.remove("reports/error_semantic.txt")

        if ta_input.compare("end-1c", "!=", "1.0"):
            # Gets new input
            tytus = ta_input.get(1.0, END)

            # Start parser
            ins = g.parse(tytus)
            temp = g.contador
            gen = Generador(temp, 0, ins.getInstruccion())
            gen.ejecutar()
            C3D = g.codigo_3D
            crearArchivo(C3D)
            ##g.analizar(tytus)
            st_global = st.SymbolTable()
            es_global = es.ListaErroresSemanticos()
            ct_global = ct.crearTabla()

            if not ins:
                messagebox.showerror(
                    "ERROR", "Ha ocurrido un error. Verificar reportes.")
            else:
                #self.do_body(ins.getInstruccion(), st_global, es_global, ct_global)
                self.raiz_ast = ins.getNodo()
        else:
            messagebox.showerror("INFO", "El campo de entrada esta vacío.")
Exemplo n.º 5
0
 def report_st(self):
     tSimbolo = st.SymbolTable()
     generarTablaSimbolos(tSimbolo)