• edited by
608 views
1 1 vote

Consider the following grammar:
\[
\begin{array}{l}
\mathrm{E} \rightarrow \mathrm{E} / \mathrm{X} \mid \mathrm{X} \\
\mathrm{X} \rightarrow \mathrm{~T}-\mathrm{X}\left|\mathrm{X}^{*} \mathrm{~T}\right| \mathrm{T} \\
\mathrm{~T} \rightarrow \mathrm{~T}+\mathrm{F} \mid \mathrm{F} \\
\mathrm{~F} \rightarrow(\mathrm{E}) \mid \text { id (id stands for identifier) }
\end{array}
\]

The grammar is
(i) Unambiguous
(ii) Ambiguous
(iii) Context-free
(iv) Regular

Only (ii) and (iii) are true
Only (i) and (iii) are true
Only (i) and (iv) are true
Only (ii) and (iv) are true

1 Answer

Best answer
2 2 votes

Its a CFG because its of type V --> (V+T)*  where V is variable and T is terminal.

this grammer is ambiguous since there exist two parse tree for a string.

id - id * id

 Only (ii) and (iii) are true.

• selected by
Position:
Show:

Related questions

2 2 votes
2 2 answers
1.8k
1.8k views
Shivam Bhardwaj asked Aug 10, 2017
1,818 views
Ques. S Aa/bAc/dc A dWhich of them is correct. Please provide detailed information.a) LALR(1) but not SLR(1)b) Both SLR(1) and LALR(1)c) Grammar is Ambiguo...