Question: Context Free Grammars ] ) : } A , , 1 A | l o n | [ , B , Give a leftmost derivation

Context Free Grammars
]):}
A,,1A|lon|
[,B,
Give a leftmost derivation for string 10101
Give a parse tree for string 1001
The language of this grammar is a regular language, can you find an equivalent regular expression for this language?
(b) In each case below, indicate what language is generated by the context-free grammar. The alphabet is ={0,1}
S0S|1S|lon
S0S|0|
In the following questions the alphabet is ={0,1} :
(c) Write a grammar for the language {0i1j|i,j0}.
(d) Write a grammar for the language {0i1j|i>j}.
(e) Write a grammar for the language {0n1m0m1n|n,m0}.
(f) Write a grammar for the language |),(vin** and {:|u|=|v|}.
(g) Let B be the collection of strings that contain at least one 1 in their second half. In other words, |),(vin**1** and {:|u||v|}.
Give a CFG that generates B.(HINT: Start with the grammar that you used for question f and modify it).
(h) Given context-free grammars for languages L1 and L2 with start variables S1 and S2 respectively. Give the grammar for L1L2, the grammar for L1@L2,(the concatenation), and the grammar for L1**.
Context Free Grammars ] ) : } A , , 1 A | l o n |

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Finance Questions!