search
Log In

Recent questions tagged lr-parser

1 vote
1 answer
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
asked Mar 30 in Compiler Design Lakshman Patel RJIT 191 views
0 votes
1 answer
2
1 vote
0 answers
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
asked Aug 20, 2019 in Compiler Design Lakshman Patel RJIT 81 views
0 votes
0 answers
4
0 votes
0 answers
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$.
asked Aug 20, 2019 in Compiler Design Lakshman Patel RJIT 69 views
0 votes
0 answers
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?
asked Aug 20, 2019 in Compiler Design Lakshman Patel RJIT 80 views
0 votes
0 answers
7
0 votes
1 answer
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 | ∈
asked Mar 26, 2019 in Compiler Design aditi19 214 views
1 vote
2 answers
9
Can any one verify this soln plz.. Thank you
asked Feb 1, 2019 in Compiler Design Nandkishor3939 187 views
0 votes
2 answers
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}$
asked Jan 26, 2019 in Compiler Design Arjun 231 views
2 votes
2 answers
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
asked Jan 26, 2019 in Compiler Design Arjun 342 views
2 votes
2 answers
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)
asked Jan 26, 2019 in Compiler Design Arjun 375 views
2 votes
0 answers
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
asked Jan 26, 2019 in Compiler Design Arjun 269 views
1 vote
0 answers
16
Consider the following CFG. S → aSa|bSb|a|b Number of conflicts in LR(0) State Diagram? 2 8 10 4
asked Jan 21, 2019 in Compiler Design Na462 228 views
0 votes
4 answers
17
grammar is CLR(1) or not? if yes then how?
asked Jan 21, 2019 in Compiler Design Rahul_Rathod_ 804 views
1 vote
0 answers
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
asked Jan 19, 2019 in Compiler Design Na462 259 views
0 votes
0 answers
19
WHAT IS A VALID ITEM FOR A VIABLE PREFIX? CAM SOMEONE EXPLAIN IN EASY WAY.
asked Jan 1, 2019 in Compiler Design sushmita 89 views
5 votes
1 answer
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
asked Dec 27, 2018 in Compiler Design Ruturaj Mohanty 283 views
0 votes
2 answers
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 ),]
asked Nov 1, 2018 in Compiler Design sripo 406 views
0 votes
1 answer
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
asked Nov 1, 2018 in Compiler Design sripo 106 views
0 votes
0 answers
24
Is LR(0) grammar can generate same languages as LR(1) grammar can generate?
asked Sep 16, 2018 in Compiler Design soumayan bandhu 40 views
0 votes
0 answers
25
$E \rightarrow E + T \hspace{5px} | \hspace{5px} T$ $T \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.
asked Jun 29, 2018 in Compiler Design Mk Utkarsh 149 views
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$ ?
asked May 26, 2018 in Compiler Design gate19 299 views
0 votes
1 answer
28
#self_doubt While representing the canonical collection of LR(0) or LR(1) items why first augmented production is added in state diagram??
asked May 10, 2018 in Compiler Design Naveen Kumar 3 75 views
0 votes
2 answers
29
Can the following grammar be parsed by LR(0) parser? E -> E+id | id Is the accept state entry considered on all the terminal symbol columns for LR(0) parser?
asked May 2, 2018 in Compiler Design Jayant Isswani 186 views
0 votes
1 answer
30
LL(1) parser cannot accept nondeterministic grammar at we have only single lookahead and there can be no predictable parsing in this case. Suppose we have LL(n) and we are given that maximum length of non-determinism in a production is n - 1. Can we use this grammar for LL(n) predictive parsing?
asked Apr 4, 2018 in Compiler Design smsubham 418 views
...