0

The language is {w|w has an odd length} and the alphabet is {0,1}.

I came up with a solution of

S->1p|0p|e

p->00p|11p|01p|10p|e

and the book has

S->0|1|0S0|0S1|1S0|1S1

are these equivalent?

TemporaryFix
  • 2,008
  • 3
  • 30
  • 54

1 Answers1

2

They are not. The first grammar describes a language that includes the empty string; e should not be an option for expanding S.

user2357112
  • 260,549
  • 28
  • 431
  • 505