There are mainly two types of derivations,
- Leftmost derivation
- Rightmost derivation
Let Consider the grammar with the production S->S+S | S-S | S*S | S/S |(S)| a
Left Most Derivation
A derivation of a string W in a grammar G is a left most derivation if at every step the left most non terminal is replaced.
![](https://educatech.in/wp-content/uploads/2024/02/pr1.jpg)
Right Most Derivation A derivation of a string W in a grammar G is a right most derivation if at every step the right most non terminal is replaced.
![](https://educatech.in/wp-content/uploads/2024/02/pr2.jpg)