MCQ IN COMPUTER SCIENCE & ENGINEERING

COMPUTER SCIENCE AND ENGINEERING

COMPILER DESIGN

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which one of the following is a top-down parser?
A
Recursive descent parser.
B
Operator precedence parser.
C
An LR(k) parser.
D
An LALR(k) parser
Explanation: 

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.

There is 1 question to complete.