RGPV 2020
What are leftmost and rightmost derivations? Explain with suitable example ?
Grammar:
S → aS / ∈
For generating strings ‘aaa’.
Left most derivation:
A leftmost derivation is obtained by applying production to the leftmost variable in each step.
S → aS
→ aaS (Using S → aS)
→ aaaS (Using S → aS)
→ aaa∈
→ aaa
Right most derivation:
A rightmost derivation is obtained by applying production to the rightmost variable in each step.
S → aS
→ aaS (Using S → aS)
→ aaaS (Using S → aS)
→ aaa∈
→ aaa