Parsing


Q31.

Which of the following productions eliminate left recursion in the productions given below: S \rightarrow Aa \mid b A \rightarrow Ac \mid Sd \mid \epsilon
GateOverflow

Q32.

Consider the following two sets of LR(1) items of an LR(1) grammar. \begin{array}{l|l} X \rightarrow c.X, c∕d &X → c.X, \$\\ X \rightarrow .cX, c∕  d& X → .cX, \$\\ X \rightarrow .d, c∕ d & X → .d, \$ \end{array} Which of the following statements related to merging of the two sets in the corresponding LALR parser is/are FALSE? 1. Cannot be merged since look aheads are different. 2. Can be merged but will result in S-R conflict. 3. Can be merged but will result in R-R conflict. 4. Cannot be merged since goto on c will lead to two different sets.
GateOverflow

Q33.

Shift reduce parsing belongs to a class of
GateOverflow

Q34.

What is the maximum number of reduce moves that can be taken by a bottom-up parser for a grammar with no epsilon- and unit-production (i.e., of type A\rightarrow \epsilon and A \rightarrow a ) to parse a string with n tokens?
GateOverflow

Q35.

Which of the following sentences can be generated by S -> aS \mid bA A -> d \mid cA
GateOverflow

Q36.

Consider two binary operators '\uparrow 'and '\downarrow' with the precedence of operator \downarrow being lower than that of the operator \uparrow . Operator \uparrow is right associative while operator \downarrow is left associative. Which one of the following represents the parse tree for expression (7 \downarrow 3 \uparrow4 \uparrow 3 \downarrow2)?
GateOverflow

Q37.

Which variable does not drive a terminal string in grammar? S -> AB A -> a B -> b B -> C
GateOverflow

Q38.

Consider the grammar S \rightarrow ABCc \mid bc BA \rightarrow AB Bb \rightarrow bb Ab \rightarrow ab Aa \rightarrow aa Which of the following sentences can be derived by this grammar?
GateOverflow

Q39.

For the grammar below, a partial LL(1) parsing table is also presented along with the grammar. Entries that need to be filled are indicated as E1, E2, and E3. \varepsilon is the empty string, $ indicates end of input, and, | separates alternate right hand sides of productions.S\rightarrow aAbB|bAaB|\varepsilon A\rightarrow S B\rightarrow S The FIRST and FOLLOW sets for the non-terminals A and B are
GateOverflow

Q40.

Which of the following statements are TRUE? I There exist parsing algorithms for some programming languages whose complexities are less than \theta (n^{3}). II A programming language which allows recursion can be implemented with static storage allocation. III No L-attributed definition can be evaluated in the framework of bottom-up parsing. IV Code improving transformations can be performed at both source language and intermediate code level.
GateOverflow