Rightmost derivation word aaaccb

51 Views Asked by At

I have got these context free grammar:

$S \implies aSA | a \\A \implies Ab|c$

The goal is find rightmost derivation of word $aaaccb$ a draw derivate tree, which corresponding with this derivation.

My result:

$S \implies aS\color{red}A \implies aS\color{red}Ab \implies a\color{red}Scb \implies aaS\color{red}Acb \implies aa\color{red}Sccb \implies aaaccb$

My derivation tree:

enter image description here

Please are derivation and tree correct?

And I would like to ask is there any way to get result with opposite procedure?

$\text{Like: }\hspace{10px}$$ aaaccb \implies ... \implies ... \implies S$