Exemple #1
0
def automatoER(input):
    input = entrytext.get()
    l = Leitor(input)
    dict, ini, final = l.ler()
    a = Automato(dict,ini,final)
    er = a.automataToER()
    expressao = Er(er)
    expressao.printER()
    expressao.writeERToFile(input)

    input = input.replace('.in', '')
    data_file = open('../testes/'+input+'.out')
    data = data_file.read()
    data_file.close()
    test = Tk.Tk()
    Results = Tk.Label(test, text = data)
    Results.grid(row = 20, column = 3, sticky= Tk.W)
Exemple #2
0
def ERAutomato(input):
    input = entrytext.get()
    l = LeitorEr(input)
    ex = l.ler()
    er = Er(ex)

    a = er.erToAutomato()
    a.printAtomato()
    a.writeAutomataToFile(input)

    input = input.replace('.in', '')
    data_file = open('../testes/'+input+'.out')
    data = data_file.read()
    data_file.close()
    test = Tk.Tk()
    Results = Tk.Label(test, text = data, justify = 'left')
    Results.grid(row = 20, column = 3, sticky= Tk.W)
    Results.pack(fill="x")
Exemple #3
0
    def reserved(self):
        word = ''
        automatos = []
        states = 0
        file = open('../algoritmos/reservado.txt', 'r')
        for line in file:
            for element in line:

                if element != '\n':
                    word += element

                if element == '\n':
                    e = Er(word)
                    e.inicialCase(states)
                    a = e.erToAutomato()
                    dictA = a.getDictAutomato()
                    a.determina()
                    states += len(dictA.keys()) + 1
                    automatos.append(a)
                    word = ''

        return automatos