Example #1
0
 def testDadoUmaProducaoQueNaoEhDaGramaticaRetornaNoneAoTentarObterTerminaisDoBeta(self):
   vn = set(['S', 'V'])
   vt = set(['a', 'b', 'c'])
   s = 'S'
 
   producoes = set()
   producoes.add(Producao('S', 'a S V b'))
   producoes.add(Producao('S', EPSILON))
   
   glc1 = Gramatica(producoes, vn,vt,s)
   self.assertEqual(None, glc1.obterTerminaisDoBeta(Producao('S', 'S V b')))
Example #2
0
 def testDadoUmaProducaoDaGramaticaSabeInformarQuaisSaoOsTerminaisExistentesNoBeta(self):
   vn = set(['S', 'V'])
   vt = set(['a', 'b', 'c'])
   s = 'S'
 
   producoes = set()
   producoes.add(Producao('S', 'a S V b'))
   producoes.add(Producao('S', EPSILON))
   
   glc1 = Gramatica(producoes, vn,vt,s)
   self.assertEqual(set(['a','b']), glc1.obterTerminaisDoBeta(Producao('S', 'a S V b')))
Example #3
0
 def testDadoUmaProducaoDaGramaticaSeNaoPossuiTerminaisNoBetaRetornaVazioAoTentarObtelos(self):
   vn = set(['S', 'V'])
   vt = set(['a', 'b', 'c'])
   s = 'S'
 
   producoes = set()
   producoes.add(Producao('S', 'S V'))
   producoes.add(Producao('S', EPSILON))
   
   glc1 = Gramatica(producoes, vn,vt,s)
   self.assertEqual(set(), glc1.obterTerminaisDoBeta(Producao('S', 'S V')))