Machine-translated by Google. Questions are authored in English.
Top

Bottom Up Parsing Questions and Answers

81.

Consider the grammar shown below

\(S \rightarrow AA\)
\(A \rightarrow aA / d\)

The grammar is :

Exam Year(s)

MH SET - 2023, SET Exam - 2023,

Answer: A

The grammar is LL(1).

A grammar is LL(1) if, for each non-terminal, the alternatives can be told apart by one symbol of lookahead. S has a single production. For A → aA | d, the alternatives begin with different terminals: FIRST(aA) = {a} and FIRST(d) = {d}, which are disjoint, and neither alternative derives the empty string, so no FOLLOW set is involved.

Every LL(1) grammar without such conflicts is also SLR(1), LALR(1) and LR(1), so the options that say 'but not LL(1)' are all false for this grammar.

Please log in or register to report this question.

82.

Which of the following is the most powerful parring method ?

Exam Year(s)

UGC NET - 2012,

Answer: B

Canonical LR is the most powerful parsing method of those listed. It keeps a full look-ahead symbol with each item, so it can parse every deterministic context-free grammar, with the largest set of states and the most precise reductions.

LL(1) is a top-down method and handles a smaller class of grammars, SLR uses the follow sets and so makes more conflicts, and LALR merges states of canonical LR with the same core, which can only add reduce-reduce conflicts. So the order of power is SLR, then LALR, then canonical LR.

Please log in or register to report this question.

Loading…

Other Subjects

Tags: Bottom Up Parsing Questions and Answers || Bottom Up Parsing MCQ Questions and Answers || Bottom Up Parsing GK Questions and Answers || Bottom Up Parsing GK MCQ Questions || Bottom Up Parsing Multiple Choice Questions and Answers || Bottom Up Parsing GK || GK on Bottom Up Parsing || Compiler Design Questions and Answers || Compiler Design MCQ Questions and Answers || Compiler Design GK Questions and Answers || GK on Compiler Design