Home » Compiler Design » Compiler design miscellaneous » Question

Compiler design miscellaneous

  1. Which of the following derivations does a top-down parser use while parsing an input string? The input is assumed to be scanned in left to right order.
    1. Leftmost derivation
    2. Leftmost derivation traced out in reverse
    3. Rightmost derivation
    4. Rightmost derivation traced out in reverse
Correct Option: A

In top down parsing, we just start with the start symbol and compare the RHS of the different productions against the first piece of input to see which of the productions should be used. A topdown parser is called LL parser because it parses the input from Left to right. eg:
S → Ax
A → a
For an input ax Top down parser will do parsing as



Your comments will be displayed only after manual approval.