Recent questions tagged grammar

0 0 votes
1 1 answer
60
60 views
Consider the grammar $$S\rightarrow aS\mid Sb\mid b$$ Which of the following statements are correct?The given grammar is a Type $3$ grammar. The given grammar is a Type $...
2 2 votes
1 1 answer
141
141 views
Consider the right-linear grammar,$$\begin{aligned}A &\to fB \mid gA \\B &\to gA \mid fC \mid f \\C &\to gA \mid fC \mid f\end{aligned}$$When this grammar is converted in...
2 2 votes
1 1 answer
105
105 views
Which of the following statements are correct for converting a finite automaton into an equivalent right-linear grammar?Each automaton state becomes a non-terminal. The s...
2 2 votes
1 1 answer
93
93 views
Consider the NFA given below: Which right-linear grammar is obtained by the standard NFA-to-grammar construction?$q_0 \to aq_1$,$q_1 \to aq_0 \mid bq_1 \mid \epsilon$ $q_...
1 1 vote
1 1 answer
112
112 views
Consider the right-linear grammar,$$\begin{aligned}S &\to aB \mid bS \mid \epsilon \\B &\to aS \mid bB\end{aligned}$$Which NFA is obtained by the standard grammar-to-NFA ...
3 3 votes
1 1 answer
167
167 views
Consider the right-linear grammar,$$\begin{aligned}S &\to aT \\T &\to abcS \mid b\end{aligned}$$If this grammar is converted into an NFA with one input symbol per transit...
1 1 vote
1 1 answer
92
92 views
Consider the grammar $G$ with productions :$$\begin{aligned}S &\to aB \mid \epsilon \\B &\to Sbb\end{aligned}$$Which option is correct?$L(G)=\{a^n b^{2n}\mid n\ge 0\}$ an...
1 1 vote
1 1 answer
92
92 views
Consider the grammar $G$ with start variable $A$ and productions $:$$$\begin{aligned}A &\to aB \mid bC \\B &\to aB \mid \epsilon \\C &\to aD \mid A \mid bC \\D &\to aD \m...
1 1 vote
0 0 answers
169
169 views
We know that the class of languages of LR(0), SLR(1), LALR(1), CLR(1) is the class of DCFLs, with the only exception being that...An LR(0) language is a DCFL that has the...
0 0 votes
1 1 answer
101
101 views
Given below are two statements: one is labelled as Assertion A and the other is labelled as Reason RAssertion A: $L=\left\{a^{n} b^{n} c^{n}: n \geq 0\right\}$ is accepte...
1 1 vote
0 0 answers
85
85 views
Match the LIST-I with LIST-IILIST-IGrammarLIST-IIAll productions are the formA.Regular GrammarI.$\mathrm{A} \rightarrow \mathrm{aX}$, where $\mathrm{a} \in \mathrm{T}$ an...
0 0 votes
0 0 answers
264
264 views
Which of the following Grammars is/are only Context Free?$\begin{array}{|l|l|l|l|} \hline \textbf{I} & \begin{array}{l} S \rightarrow A b \\ a S \rightarrow a A \\ A \ri...
0 0 votes
1 1 answer
195
195 views
Match List I with List II$\begin{array}{|ll|ll|} \hline & \textbf{List I} & & \textbf{List II} \\ \hline \text{A.} & \text{Type } 3 \text{ Grammar} & \text{I.} & \mathrm...
0 0 votes
2 2 answers
334
334 views
Match the $\textbf{LIST-I}$ with $\textbf{LIST-II}$$\begin{array}{|l|l|l|l|} \hline & \textbf{ LIST-I } & & \textbf{ LIST-II } \\ \hline \text{A.} & \text{Type} - 0 \text...
0 0 votes
0 0 answers
264
264 views
A machine is represented by states $Q$ , input alphabet $\sum$, transition function $\hat{\mathrm{o}}$. Initial state $\mathrm{q}_{0}$ and final state $F$. The machine ac...
0 0 votes
1 1 answer
333
333 views
Consider the Grammar:\[\begin{array}{l} \mathrm{S} \rightarrow \mathrm{~A} \\ \mathrm{~A} \rightarrow \$ \mathrm{~B} \$ \mid \mathrm{id} \\ \mathrm{~B} \rightarrow \mathr...
0 0 votes
1 1 answer
294
294 views
Consider the Grammar:$\begin{array}{l}\mathrm{T} \rightarrow \mathrm{Q} x \\\mathrm{Q} \rightarrow \mathrm{RS} \\\mathrm{R} \rightarrow \mathrm{y} \mid \varepsilon \\\mat...
0 0 votes
0 0 answers
167
167 views
Arrange the following Language Classes in ascending order according to their expressive power, as defined by Chomsky hierarchy:Context-free languagesContext-sensitive lan...
1 1 vote
1 1 answer
209
209 views
Which of the following are context free language?$\left\{\mathrm{w}^{\mathrm{i}} \mathrm{x}^{\mathrm{j}} \mathrm{y}^{\mathrm{k}} \mathrm{z}^{l} \mid \mathrm{i}+\mathrm{k}...
0 0 votes
2 2 answers
216
216 views
Let $\text{L}=\{a b, a a, b a a\}$. Which of the following strings are not in $\text{L}^{*}$.$\mathrm{abaabaaabaa}$$\mathrm{aaaabaaaa}$$\mathrm{baaaaabaaaab}$$\mathrm{baa...
2 2 votes
0 0 answers
199
199 views
Consider a Grammar $\mathrm{E} \rightarrow \mathrm{E}+\mathrm{n}\mid \mathrm{E} \times \mathrm{n} \mid \mathrm{n}$ for a sentence $\mathrm{n}+\mathrm{n} \times \mathrm{n}...
1 1 vote
2 answers 2 answers
712
712 views
Is {aⁿbᵐcᵖ | n ≠ m or m ≠ p} CFL? If so what is the Context Free Grammar for it? If not, what is the grammar for the language?
22 22 votes
11 11 answers
13.5k
13.5k views
Consider two grammars $G_{1}$ and $G_{2}$ with the production rules given below: $G_{1} : S \rightarrow$ $if$ $E$ $then$ $S$ $|$ $if$ $E$ $then$ $S$ $else$ $S$ $|$ $a$ ...
1 1 vote
0 0 answers
867
867 views
Consider the following simple context-free grammars: Grammar G₁ Grammar G2 Grammar G3S → AA → εA → bbA S → AA → εA → bAb S → AA → εA → Abb  The start symbols are S, the n...
0 0 votes
2 2 answers
369
369 views
Let $\Sigma=\{a, b, c\}$. What is the language generated by the following grammar?\[S:=\epsilon|a S| S b \mid c S\]$(a+b+c)^{*} b^{*}$$(a+b+c)^{*} c^{*}$$(a+c)^{*} b^{*}$...
1 1 vote
1 1 answer
594
594 views
Let $\Sigma=\{a, b\}$ be an alphabet. A palindrome is a word which reads the same when read from left-to-right, or from right-to-left. For example, the words $a b b a, a ...