0
$\begingroup$

E -> E + E | E * E | (E) | a

Derivation for ( (a+a) * a)

Question : Show that the grammar is ambiguous by sparse tree method

Now, I have derived two derivation using left most derivation

but it results in like this 1st : ((a+a) * a) 2nd : (a * (a+a))

is this correct or the order should also be same?

$\endgroup$
0
$\begingroup$

You are deriving different strings. The definition of ambiguity asks for the very same string.

In this case, that they "mean the same thing" in algebra, due to the commutative law for multiplication, is completely off topic.

| cite | improve this answer | |
$\endgroup$
  • $\begingroup$ Thanks for help. Also could you tell me how to drive the second one?Or is this unambiguous grammar. $\endgroup$ – Amir Ali May 19 '18 at 23:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.