guys I've been working on this assignment for my formal languages class for a couple of days now, and I'm stuck when it comes to generating grammars for a given language. I don't have an example in my textbook similar to this question to follow, so I was hoping anyone could provide an explanation. thank you.
Asked
Active
Viewed 1,377 times
-8

Facundo Ezequiel Candido
- 25
- 2
- 5
-
4You might want to notify your teacher that his g-key is broken. – Johannes H. Jun 05 '16 at 06:45
-
It took me a while to get @JohannesH 's idea in the comment, if you do so is of course your decision, **but** IMO his answer you really should read carefully and also follow the advice kindly given by him ;-) – Dilettant Jun 05 '16 at 08:58
1 Answers
2
To solve the problem:
- Understand which words are in L.
I actually did this part for you: L
defines that any words in that language start with any number (including 0) of a
or b
, followed by 1 or more a
s, follwoed by one b
, maybe followed by any number of a
s, followed by the same character it started with (or a repetition of them).
- Read one grammar. See if you can construct words with this grammar that are not in L.
- See if you can find words in L that can not be constructed by this grammar
- If you find either, proceed with the next grammar
- if you find none, the grammar successfully generates L.

Johannes H.
- 5,875
- 1
- 20
- 40