# Recent questions tagged lr-parser 1 vote
1
Which of the following statements is/are false? $S1$: $LR(0)$ grammar and $SLR(1)$ grammar are equivalent $S2$: $LR(1)$ grammar are subset of $LALR(1)$ grammars $S1$ only $S1$ and $S2$ both $S2$ only None of the options
2
The ‘K’ in LR (K) cannot be : $0$ $1$ $2$ None of these
1 vote
3
In Fig. $4.56$ is a grammar for certain statements, similar to that discussed in Question $4.4.12$. Again, $e$ and $s$ are terminals standing for conditional expressions and "other statements," respectively. Build an LR parsing table for this grammar, resolving conflicts in the usual way ... your parser on the following inputs: if e then s ; if e then s end while e do begin s ; if e then s ; end
4
Construct the canonical LR, and LALR sets of items for the grammar $S\rightarrow S S + \mid S S \ast \mid a$ of Question $4.2.1$.
5
The following is an ambiguous grammar: $S\rightarrow AS\mid b$ $A\rightarrow SA\mid a$ Construct for this grammar its collection of sets of $LR(0)$ items. If we try to build an LR-parsing table for the grammar, there are certain conflicting ... parsing table by nondeterministically choosing a possible action whenever there is a conflict. Show all the possible sequences of actions on input $abab$.
6
Consider the family of grammars $G_{n}$, defined by: $S\rightarrow A_{i}b_{i}$ for $1\leq i\leq n$ $A_{i} \rightarrow a_{j} A_{i}\mid a_{j}$ for $1\leq i,j\leq n$ and $i\neq j$ Show that: $G_{n}$, has $2n^{2}-n$ productions. $G_{n}$, has $2^{n} + n^{2} + n$ sets of $LR(0)$ items. $G_{n}$ is $SLR(1)$. What does this analysis say about how large $LR$ parsers can get?
7
Repeat Question $4.5.1$ for the grammar $S\rightarrow S\: S + \mid S\: S \ast \mid a$ of Exercise $4.2.1$ and the following right-sentential forms: $SSS+a\ast+.$ $SS+a\ast a+.$ $aaa\ast a++.$
8
Can lookahead symbol be epsilon in LR(1) parsing? and pls give the LR(1) diagram for the following grammar? A->AB | a B->*AC | Cb | ∈ C->+ABc | ∈
1 vote
9
Can any one verify this soln plz.. Thank you
1 vote
10
1 vote
11
12
Suppose we have a rightmost derivation which proceeds as follows: $\begin{array}{ccc}S &\rightarrow & Aabw \\ & \rightarrow &ABw \end{array}$ Which of the following is a possible handle for it? $\begin{array}{ccc} A &\rightarrow & ab \end{array}$ ... $\begin{array}{ccc} S &\rightarrow & A \end{array}$ $\begin{array}{ccc} B &\rightarrow & ab \end{array}$
13
Which of the following statements regarding $LR(0)$ parser is FALSE? A $LR(0)$ configurating set cannot have multiple reduce items A $LR(0)$ configurating set cannot have both shift as well as reduce items If a reduce item is present in a $LR(0)$ configurating set it cannot have any other item A $LR(0)$ parser can parse any regular grammar
14
Which of the following sentences regarding Viable prefixes is/are CORRECT? Viable prefixes is the set of prefixes of right-sentential forms that can appear on the stack of a shift-reduce parser Viable prefixes is the set of prefixes of right-sentential forms that do not extend past the end of the ... prefixes can be recognized using a DFA Only (i) Only (ii) Only (i) and (ii) (i), (ii) and (iii)
15
Which of the following statements regarding LR parsers is WRONG? LR(1) does no guess work LR parsers can handle a large range of grammars than predictive parsers LR parsers can handle a large range of languages than predictive parsers LR parser is better at error reporting compared to LL ones Only (i) (i) and (iv) Only (iv) All are CORRECT
1 vote
16
Consider the following CFG. S → aSa|bSb|a|b Number of conflicts in LR(0) State Diagram? 2 8 10 4
17
grammar is CLR(1) or not? if yes then how?
1 vote
18
Which one of the following is true about LALR(1) Parser ? It can resolve SR Conflict in favor of reduced It can resolve SR Conflict in favor of Shift It can resolve RR Conflict in favor of reduced It can resolve RR Conflict in favor of shift
19
WHAT IS A VALID ITEM FOR A VIABLE PREFIX? CAM SOMEONE EXPLAIN IN EASY WAY.
20
Which of the following statements on Viable Prefixes is incorrect? A viable prefix does not extend past the right end of the handle For any context-free grammar, the set of viable prefixes is a regular language A viable prefix by default is a suffix of the handle As long as a parser has viable prefixes on the stack no parsing error has been detected
1 vote
21
Can you give an example which is not LL(1) but is CLR(1)
22
S→(X S→E] S→E) X→E) X→E] E→ϵ Is this grammar CLR(1)? The answer says it is but I find a shift reduce conflict for E-> epsilon with lookup symbols ),]
23
For given production for a LR(1) grammar B->b.C ,$|c here C is non terminal C->c. ,$|c and here c is terminal. $|c are lookup symbols Will there be a shift reduce conflict if a non terminal is visited.Please explain how shift reduce conflict works 0 votes 0 answers 24 Is LR(0) grammar can generate same languages as LR(1) grammar can generate? 0 votes 0 answers 25$E \rightarrow E + T \hspace{5px} | \hspace{5px} TT \rightarrow TF \hspace{5px} | \hspace{5px} F F \rightarrow F^{*} \hspace{5px} | \hspace{5px} (E) \hspace{5px} | \hspace{5px} a \hspace{5px} | \hspace{5px} b \hspace{5px} | \hspace{5px} \epsilon $Construct the LALR sets of items and the parse table for the above grammar. 0 votes 1 answer 26 2 votes 2 answers 27 What is the difference between$SLR(1)$and$LALR(1)$parser ? Both parser have same parsing table then how$SLR$is subset of$LALR\$ ?