Question

Identify the languages generated by the following grammars and draw a derivation and parse tree a)...


Identify the languages generated by the following grammars and draw a derivation and parse tree
a) S -> 0S1 | 0A1 A-> 1A | 1
b) S -> 0S1 | 0A1 A -> 1A0 | 10

0 0
Add a comment Improve this question Transcribed image text
Answer #1

a) there can be many combinations of strings formed from the given grammar. we start with S,

S-> 0S1 -> 00A11 -> 001A11 -> 001111 (a string is generated with no terminals which can be produced) similarly, S-> 0A1-> 01A1-> 0111 (a string generated). S-> 0A1-> 01A1-> 011A1-> 0111A1-> 011111(a string generated). S-> 0S1-> 00S11-> 000S111-> 0000A1111-> 000011111

so the language generated could be written as L={011^n where n=1,2,3...| 0^n1^n+1 where n=2,3,4...|001111|...}

parse tree for one of the string S-> 0S1 -> 00A11 -> 001A11 ->001111 is:

b) to generate language we start with S, S-> 0S1-> 00A11-> 001011(string). S-> 0A1-> 01A01-> 011A001-> 01110001. S-> 0S1-> 00A11-> 001A011-> 00110011. Similarly many such strings could be formed.

L={001011 | 01110001 | 00110011|....}

parse tree for S-> 0S1-> 00A11-> 001A011-> 00110011:

Add a comment
Know the answer?
Add Answer to:
Identify the languages generated by the following grammars and draw a derivation and parse tree a)...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT