• edited by
668 views
1 1 vote
An unambiguous grammar has same leftmost and rightmost derivation.

True or False

and how??

1 Answer

0 0 votes

"An unambiguous grammar has same leftmost and rightmost derivation"

This statement is false, let me take an example, suppose given gammer is (which is certainly unambiguous)

S -> AB
A -> a
B -> b

Suppose our input string is ab

Left Most Derivation
S -> AB -> aB -> ab

Right Most Derivation
S -> AB -> Ab -> ab

Notice Left Most derivation and Right most derivation are not same, still gammer is unambiguous.

Here is the Derivation Tree

• edited by
Position:
Show:

Related questions

3 3 votes
2 2 answers
1.5k
1.5k views
gatecse asked Feb 23
1,533 views
Which of the following statements is/are true?$\text{LL(1)}$ parser uses backtrackingFor a grammar to be $\text{LL(1)}$, it must be left-recursiveFor a grammar to be $\te...
26 26 votes
6 6 answers
10.8k
10.8k views
Arjun asked Feb 27, 2025
10,848 views
​​Given a Context-Free Grammar $\text{G}$ as follows:\[\begin{array}{l}S \rightarrow A a|b A c| d c \mid b d a \\A \rightarrow d\end{array}\]Which ONE of the following st...
21 21 votes
4 4 answers
6.8k
6.8k views
Arjun asked Feb 27, 2025
6,816 views
Which of the following statement(s) is/are TRUE while computing $\operatorname{First}$ and $\operatorname{Follow}$ during top down parsing by a compiler?For a production ...
19 19 votes
2 2 answers
11.2k
11.2k views
Arjun asked Feb 16, 2024
11,194 views
Consider the following context-free grammar where the start symbol is $\text{S}$ and the set of terminals is $\{a, b, c, d\}$.$$\begin{array}{l}S \rightarrow A a A b \mid...