-1

I have this grammar
S->aSbA S->e A->aB B->bA

How can i determine if the language is regular? My problem is that A and B doesnt have a terminal character so i dont know what languages it will produce.

  • You might wanna try that question on the [computer science stackexchange site](http://cs.stackexchange.com/). – Good Night Nerd Pride Sep 22 '16 at 11:24
  • `e` is the empty word, right? – Good Night Nerd Pride Sep 22 '16 at 11:26
  • That language doesn't even terminate. There is never a condition in which you're not looking for another symbol. – J Earls Sep 22 '16 at 13:17
  • Technically speaking, the only string matched by that grammar is the empty string, so it's trivially regular. None of the productions other than `S -> e` is useful, since there is no base case for either `A` or `B`. I suppose you didn't manage to copy-and-paste the entire homework problem. – rici Sep 22 '16 at 17:29

1 Answers1

0

There is no general method for this. Regularity is an undecidable problem for context-free languages.

In your specific case, as J Earls has pointed out, the only word you can derive is the empty word. All derivations that use a rule different from S -> e never terminate. Thus the language is finite and therefore regular.

Peter Leupold
  • 1,162
  • 1
  • 9
  • 16