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

Bottom Up Parsing Questions and Answers

Answer: C

Correct answer: the tables are opaque and conflicts can be hard to diagnose

LR parsing is linear in the input and handles a wide class of grammars, so the objection is not to its power. It is that a conflict is reported against a state number and an item set rather than against the language construct the author was thinking about, which makes tracing the cause a skilled exercise.

Please log in or register to report this question.

Answer: D

An iterative construct written left recursively is reduced item by item, so the stack stays short. Written right recursively the whole list must be stacked before any reduction occurs. A long initialiser list makes the difference plainly visible.

Please log in or register to report this question.

53.

Assertion (A): LR grammars are usually written with left recursion for list constructs.
Reason (R): A right recursive list forces the entire list onto the stack before the first reduction can take place.

Answer: A

Both are true and the reason gives the mechanism, and the difference is measurable on long lists. Left recursion reduces after each element and keeps the stack at constant depth, which matters for generated initialiser lists and similar input.

Please log in or register to report this question.

Answer: B

Absence of conflicts is a statement about the grammar, not about whether it describes the intended language. Testing remains necessary for everything the generator cannot check. A conflict free grammar can still accept a language nobody intended.

Please log in or register to report this question.

Answer: C

The items show what the parser had seen and what it expected, which usually identifies the pair of productions in conflict. Most generators produce such a report on request. Learning to read one is among the more useful practical skills in this area.

Please log in or register to report this question.

Answer: D

Branches that fail are discarded and surviving branches may be merged. The method accepts ambiguous grammars at the cost of the linear time guarantee. Where the grammar happens to be unambiguous the extra cost is negligible.

Please log in or register to report this question.

Answer: A

Correct answer: share the common parts of several simultaneous parses

GLR pursues every viable parse at once, and a naive implementation would need a separate stack for each. The graph structured stack merges the parts the parses have in common and branches only where they differ, which keeps the work proportional to the genuine ambiguity rather than exponential in the input.

Please log in or register to report this question.

Answer: B

Because the parse is driven entirely by relations tabulated between pairs of terminals, a pair of nonterminals standing side by side offers the table nothing to look up. Arithmetic expression grammars happen to obey the restriction, which is what made the method attractive before generators were widely available.

Please log in or register to report this question.

Answer: C

The relations hold between pairs of terminals and determine where the handle begins and ends. They are not symmetric, so both orderings of a pair must be tabulated. The table is therefore quadratic in the number of terminal symbols.

Please log in or register to report this question.

Answer: D

The first three all build the tree from the leaves upward. Predictive parsing expands nonterminals from the start symbol and belongs to the top down family instead. The direction of tree construction is the defining difference.

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