COMPUTER SCIENCE AND ENGINEERING
COMPILER DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Recursive descent parser.
|
|
Operator precedence parser.
|
|
An LR(k) parser.
|
|
An LALR(k) parser
|
Detailed explanation-1: -Predictive parser and recursive descent parser are example of top-down parser. Whereas LR(k) and LALR(k) parser are bottom up parser.
Detailed explanation-2: -In computer science, a recursive descent parser is a kind of top-down parser built from a set of mutually recursive procedures (or a non-recursive equivalent) where each such procedure implements one of the nonterminals of the grammar.
Detailed explanation-3: -Explanation: Top-down parser generates the left-most derivation. It constructs the parse tree from left to right and constructs the left-most derivation of the specified sentence.
Detailed explanation-4: -Examples of top-down parsing algorithms include recursive descent parsing and LL parsing. Recursive descent parsing involves writing a set of recursive procedures to recognize the language of a grammar, while LL parsing involves building a predictive parsing table from a given grammar and using it to parse the input.
Detailed explanation-5: -Recursive-descent parsing is one of the simplest parsing techniques that is used in practice. Recursive-descent parsers are also called top-down parsers, since they construct the parse tree top down (rather than bottom up). The basic idea of recursive-descent parsing is to associate each non-terminal with a procedure.