Пример #1
0
 def clicouTransformarGR(self):
   try:
     af = self.obterAF()
     af = util.determinizar_af(af)
     self._janela_principal.obterGRGUI().setarGR(util.obter_gramatica_regular(af)) 
   except Exception as excecao:
     self.mostrarErro(str(excecao))
Пример #2
0
    def clicouTransformarEmGR(self):
        try:
            exp = ExpressaoRegular(str(self.__ui.exp_reg.text()))
            afd = exp.obterAFD()
            afd = util.remover_estados_mortos_afd(afd)
            self.__janela_principal.obterGRGUI().setarGR(util.obter_gramatica_regular(afd))

        except Exception as excecao:
            self._error.showMessage(str(excecao))
Пример #3
0
 def testPodeSalvarECarregarUmaGramaticaRegularDoDisco(self):
   gr1 = util.obter_gramatica_regular(construirAFDComABOndeBsEhImpar())
   util.salvar(gr1, os.path.join(os.getcwd(), 'teste.gr'))
   gr2 = util.carregar(os.path.join(os.getcwd(), 'teste.gr'))
   self.assertTrue(util.sao_equivalentes_af(util.obter_afd(gr1), util.obter_afd(gr2)))
Пример #4
0
 def testDadoUmAFDSabeQualEhASuaGramaticaRegularCorrespondenteQuandoAFDNaoProduzEpsilon(self):
   gr1 = util.obter_gramatica_regular(construirAFDComABOndeBsEhImpar())
   afd1  = util.obter_afd(gr1)
   afd2 = construirAFDComABOndeBsEhImpar()
   
   self.assertTrue(util.sao_equivalentes_af(afd1, afd2))
Пример #5
0
 def testDadoUmAFDQueGeraApenasUmSimboloSabeQualEhASuaGramaticaRegularCorrespondente(self):
   gr1 = util.obter_gramatica_regular(construirAFDQueGeraOSimboloA())
   afd1  = util.obter_afd(gr1)
   afd2 = construirAFDQueGeraOSimboloA()
   
   self.assertTrue(util.sao_equivalentes_af(afd1, afd2))