edited by
657 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.4k
1.4k views
gatecse asked Feb 23
1,398 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.6k
10.6k views
Arjun asked Feb 27, 2025
10,649 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.7k
6.7k views
Arjun asked Feb 27, 2025
6,702 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.1k
11.1k views
Arjun asked Feb 16, 2024
11,110 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...