context free grammar

259 views

Do the following productions mean the same

Bb->bb and B->b

My doubt is that will the first production be used only when we have b in the follow of B or it can be used in any case.

If it can be used in any case then will the first production be equal to second production.

retagged

1 vote

Bb - > bb is context sensitive grammer and it can only be used when b is in follow of B i.e Bb
B -> b is context free grammer and it can be used anywhere you see B

selected

Related questions

1
106 views
Consider the following CFG 'G' S--> aA/bSS/SS A--> aAb/bAa/AA/ε The language generated by G is: a)Set of all strings with atleast one 'a' b)Set of all strings with atleast two a's c)Set of all strings with atleast one more 'a' than number of b's d)None of these
1 vote
Construct context-free grammars to accept the following languages. \begin{align*} \large L = \left \{ 0^i1^j2^k \;\; | \;\; i \neq j \;\; or \;\; j \neq k \right \} \end{align*}
... Please verify all grammars. third grammar In Linz book it is given as \begin{align*} & S\rightarrow aSbSa|aaSb|bSaa|SS|a \\ \end{align*} ..better explanation if possible.??