edited by
413 views
0 votes
0 votes
What is the number of terminal string of length <= 6 generated by the CFG shown below?
S -> 0A1
A -> BB1/B
B ->A/0/1

Do you have any semantic method to solve such questions based on some pattern that can generalizes up to any length string n ??

 

For the present question it is 6,quite simple to derive but  I am wondering what if it had been asked no of strings of length n

 

 

Thanks
edited by

1 Answer

0 votes
0 votes

You can use this kind of approach. Although it may look complicated but it totally depends on the grammar provided. 

Related questions

1.1k
views
2 answers
1 votes
sh!va asked Jul 12, 2016
1,121 views
S→ A 0BA→ BB|0B →AA|1What is the number of terminal strings of length 5 generated by the context-free grammar shown above?4567