Home » Compiler Design » Compiler design miscellaneous » Question

Compiler design miscellaneous

  1. In the correct grammar above, what is the length of the derivation (number of steps starting from S) to generate the string albm with l ≠ m?
    1. max (l, m) + 2
    2. l + m + 2
    3. l + m + 3
    4. max (l, m) + 3
Correct Option: A

It is very clear from the previous solution that the no. of steps required depend upon the no. of a' s & b ' s which ever is higher & exceeds by 2 due to S " AC CB & C"!
So max(l, m) + 2
Hence (a) is correct option.



Your comments will be displayed only after manual approval.