Recent questions tagged context-free-grammar

293
views
1 answers
1 votes
Give a context-free grammar for the set of all strings over the alphabet {a, b} with exactly twice as many a’s as b’s. Explain the working of the grammar by characterizing the strings generated by each non-terminal.
638
views
0 answers
0 votes
Identify the type of the given language and draw the corresponding automata for the language.$L=\left \{a^{i}b^{j}c^{k} \space\ | \space\ j=max(i,k) \right \}$A] RegularB] DCFLC] CFL but not DCFLD] Non-CFLPlease describe your selection.
980
views
2 answers
0 votes
Consider the following context-free grammar:Find the number of unique productions in {Goto (A → D.BC, B) U Goto (A → .DBC, D)}
650
views
2 answers
3 votes
Is this Language a CFL?If yes, Can you please explain the implementation.
686
views
1 answers
1 votes
259
views
1 answers
1 votes
how option 2 is correct becz regular lang. dosnt accept comparision can anyone explain?
5.1k
views
1 answers
2 votes
Convert the following grammar into Greibach Normal Form.E-> E + T | TT-> T*F | FF->(E) | a I am unable to process this type of grammer into GNF, Can someone please provide a detailed explaination?
393
views
1 answers
3 votes
How to approach with such questions. Do we have to generate strings to validate the property of the grammars ?
288
views
2 answers
1 votes
14.Show that the grammar S → aSb |SS| e is ambiguous, but that the language denoted by it is not.Can someone share the approach for second part.
719
views
1 answers
2 votes
Let $L$ be a context-free language generated by the context-free grammar $G = (V, \Sigma, R, S)$ where $V$ is the finite set of variables, $\Sigma$ the finite set of ... ast }${L}'=\left \{ xx \mid x \in L \right \}$None of the above
3.2k
views
1 answers
0 votes
Consider an $\varepsilon$-tree CFG. If for every pair of productions $A\rightarrow u$ and $A\rightarrow v$If $\text{FIRST(u)} \cap \text{FIRST(v)}$ is empty then the CFG ... $(A)$ and $(B)$None of the above
1.5k
views
1 answers
0 votes
The CFG $S \to aS\mid bS\mid a\mid b$ is equivalent to $(a+b)$(a+b)(a+b)^*$(a+b)(a+b)$all of these
1.2k
views
1 answers
0 votes
Let $G$ be a grammar in CFG and let $W_1,W_2\in L(G)$ such that $\mid W_1\mid=\mid W_2\mid$ then which of the following statements is true?Any ... .Some derivation of $W_1$ may be shorter than the derivation of $W_2$None of the options
1.3k
views
1 answers
0 votes
The grammar $S\rightarrow aSb\mid bSa\mid SS\mid \varepsilon $ is:Unambiguous CFGAmbiguous CFGNot a CFGDeterministic CFG
492
views
2 answers
0 votes
Which sentence can be generated by $S\rightarrow d/bA, A\rightarrow d/ccA$ :$\text{bccddd}$\text{aabccd}$\text{ababccd}$\text{abbbd}$
1.6k
views
2 answers
0 votes
Let $G= (V,T,S,P)$ be a context-free grammer such that every one of its productions is of the form $A\rightarrow v$, with $\mid v \mid=K> 1$. The derivation tree for any ...
536
views
1 answers
0 votes
Consider the context-free grammar below ($\epsilon$ denotes the empty string, alphabet is $\{a,b\}$):$S\rightarrow \epsilon \mid aSb \mid bSa \mid SS.$What ... $a$ and $b$