2
$\begingroup$

i just want to double check with what i concluded from this parse trees.

       A
      / \
     /   \
    B      C
   / \    / \
  0   D  D   E
         |   |
         0   1

from the above tree i get right derivation to be

A -> C

C -> D|E

E -> 1

D -> 0

and the left derivation as

A -> B

B -> 0|D

D -> 0

i just want someone to proof check for me. and tell me if am wrong somewhere. Thanks!

$\endgroup$
2
$\begingroup$

What you wrote are not derivations, they are grammars.

The leftmost derivation in your case is $A \to BC \to 0DC \to 0DDE \to 0D0E \to 0D01$. I'll leave you to figure out the rightmost derivation.

$\endgroup$
2
  • $\begingroup$ ohh i think i got it now. so the right derivation would be; $A \to BC \to BDE \to 0DDE \to 00DE \to 00D1$ and why didn't we drive the D first in the left most derivation 0D0E part? $\endgroup$
    – Heniam
    Mar 9 '17 at 20:16
  • $\begingroup$ Any derivation must end with 00D1, which are the symbols in the leaves read left to right. Please review the definitions once again. $\endgroup$ Mar 9 '17 at 20:29

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.