Simple question about grammar derivations
Actually you have to study the working of a parser in detail to get the answer to your question. 

Parsers can be top down or bottom up. In top down parsing, we try to derive the input string from the start symbol. In bottom up parsing, the reverse procedure is applied, i.e. we try to reduce the input string to the start symbol. 

Let me try to answer your question by explaining the working of recursive descent parser, a general top down parser.

Recursive descent parser will choose the productions based on the order in which they are specified. I will explain with an example. 

The grammar given is 

    S-&gt; aAB | bAB
    A-&gt; d | a
    B-&gt; b


Let the input be 

    bab


The input pointer points to the first symbol 'b'. The recursive descent parser will start with start symbol S. The working is as follows 

    S-&gt; aAB


Whenever a terminal symbol is obtained, it is checked for match with the current input symbol. Input symbol 'b' doesn't match with the terminal 'a'. So the parser will backtrack and choose the next production 

    S-&gt;bAB


The terminal symbol matches with the input. Hence input pointer is advanced and it points to 'a'. Next substitute for A.

    S-&gt; bdB


Input symbol and the obtained terminal does not match. So backtrack and choose the next production for A.

    S-&gt; baB


Now a match is obtained and B is replaced with its production 

    S-&gt;bab


Thus input is successfully parsed.
The steps in derivation can be summarised as

    S-&gt; aAB (backtrack)
     -&gt; bAB
     -&gt; bdB (backtrack)
     -&gt; baB
     -&gt; bab