I'm solving some past job interview problems. I met an embarrassing question about compilers.
The question is :
Consider the following grammar, with start symbol $E$:
\begin{align*} E &\rightarrow E \ast E\\ &\quad \mid E ~/~ E\\ &\quad \mid E + E\\ &\quad \mid E - E\\ &\quad \mid (E)\\ &\quad \mid a \mid b \mid c \mid \ldots \mid x \mid y \mid z \end{align*}
The following strings are legal derivations from this grammar:
- $a \ast b + c$
- $( a - b ) \ast c$
- $a ~/~ ( b – c)$
Which of the above are rightmost sentential forms?
When I was an undergraduate student, I learned that rightmost(leftmost) sentential form is result of rightmost(leftmost) derivation. so, I think if $1,2,3$ are legal derivations form above grammar then absolutely all of $1,2,3$ are rightmost sentential form. If I'm correct, above question is very worthless.
Is there any counter example that is not rightmost sentential form of the grammar $G$ although it is a legal derivation from $G$?
OR
Is there another definition about rightmost sentential form corresponding to above question? I have googled "rightmost sentential form" but there are few results and most of them is the definition that I already know.