0

I want to know what language is generated by this CFG

S → SS | bS | a

I have obtained some strings but cannot find a pattern

abbaaaa
aaaaaaa
ba
aaaaa
aaaaaaabaaaabbaa
babaaabaaaba
bbbababaababaa
baabaa
baa
aaaaaabbaaabbba
cmgchess
  • 7,996
  • 37
  • 44
  • 62

1 Answers1

1
  • This grammar does not generate epsilon;
  • The minimum length string generated by S is "a". Also last character generated by S is also a;
  • bS means that if there is b in the string then after it there must be more characters (because the grammar does not generate epsilon). These characters could be more b, but eventually a must follow (as noted up). That is n times of b, where n >= 0;
  • Because of SS the language allows repetitions (an infinite number of times (k)) of this zero or more b characters followed by one a.

The language L should be this (where Sigma is the alphabet):

language L

This could be written with regular expression like this:

regex

Nikolay Handzhiyski
  • 1,360
  • 1
  • 6
  • 20
  • The language is produced by the regular expression `(a|b)*a`; I'd write the set simply as `{ ω a | ω ∈ Σ* }`. Not that yours is wrong, but all those subscripted exponents seem unnecessary. – rici Dec 01 '21 at 17:44
  • It could be. I found it to be more detailed and more related to the explanations in the text. The shortest regular expression I think is `(b*a)+`. – Nikolay Handzhiyski Dec 01 '21 at 18:08