CFG para definir un idioma

I need to generate a context free grammar for this language L= { a^i b^j c^k | i, j, k ≥ 0 , i = j or i = k }

what I already have is S : aSc | T | abS T : bT | cT | ԑ

Do you guys think that the above grammar can correctly define the language? if not, is there any better suggestion?

preguntado el 28 de mayo de 14 a las 14:05

1 Respuestas

No, that grammar does not correctly define the language. It accepts "bc", for instance.

contestado el 28 de mayo de 14 a las 14:05

Thanks, I guess I can generate two grammars, one for i = j and the other for i = k, then combine both grammars to define the language. - Lucy

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.