search
Log In

Recent questions tagged parsing

0 votes
4 answers
1
A top down parser generates Left most derivation Right most derivation Left most derivation in reverse Right most derivation in reverse
asked Mar 31 in Compiler Design Lakshman Patel RJIT 150 views
0 votes
0 answers
2
Implement Algorithm $3.23$, which converts a regular expression into a nondeterministic finite automaton, by an L-attributed SDD on a top-down parsable grammar. Assume that there is a token char representing any character, and that char.$lexval$ is the character it ... that is, a state never before returned by this function. Use any convenient notation to specify the transitions of the $NFA$.
asked Sep 6, 2019 in Compiler Design Lakshman Patel RJIT 108 views
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
The following is an ambiguous grammar for expressions with $n$ binary, infix operators, at $n$ different levels of precedence: $E\rightarrow E\theta_{1}E\mid E\theta_{2}E\mid \cdot\cdot\cdot E\theta_{n}E\mid(E)\mid id$ ... of the tables for the two (ambiguous and unambiguous) grammars compare? What does that comparison tell you about the use of ambiguous expression grammars?
asked Aug 20, 2019 in Compiler Design Lakshman Patel RJIT 115 views
0 votes
1 answer
5
0 votes
0 answers
7
0 votes
0 answers
9
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
12
For each of the (augmented) grammars of Question $4.2.2(a)-(g)$ : Construct the SLR sets of items and their GOTO function. Indicate any action conflicts in your sets of items. Construct the SLR-parsing table, if one exists.
asked Aug 20, 2019 in Compiler Design Lakshman Patel RJIT 27 views
1 vote
2 answers
14
In operator precedence parsing we have the rule that production cannot have two adjacent non-terminals or an epsilon production, so this production, S--> ab is allowed but not S--> AB, A->a and B->b, though they are giving us the same output. Why so?
asked Jun 14, 2019 in Compiler Design Hirak 260 views
0 votes
1 answer
15
S → aSbS /bSaS / ϵ S → aABb A→ c/ ϵ B → d/ ϵ Which of the following is LL1. Explain in details.
asked Jun 1, 2019 in Compiler Design Hirak 162 views
0 votes
0 answers
16
why do first sets can have epsilon symbol but follow sets don’t? P.S: I’ve a silly doubt :P
asked May 12, 2019 in Compiler Design aditi19 117 views
0 votes
0 answers
17
Use the exhaustive search parsing method to parse the string $abbbbbb$ with the grammar with productions $S\rightarrow aAB,$ $A\rightarrow bBb,$ $B\rightarrow A|\lambda.$ In general, how many rounds will be needed to parse any string $w$ in this language?
asked Apr 14, 2019 in Theory of Computation Naveen Kumar 3 65 views
0 votes
1 answer
18
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
0 votes
1 answer
19
is it always true or not??? STATEMENT → in LR(0) Parsing i1 is a final state,there is a shift move. it always give S/R conflict. Explain with example.
asked Feb 8, 2019 in Compiler Design sandeep singh gaur 95 views
6 votes
3 answers
20
Which one of the following kinds of derivation is used by LR parsers? Leftmost Leftmost in reverse Rightmost Rightmost in reverse
asked Feb 7, 2019 in Compiler Design Arjun 3.9k views
9 votes
3 answers
21
Consider the grammar given below: $S \rightarrow Aa$ $A \rightarrow BD$ $B \rightarrow b \mid \epsilon $ $D \rightarrow d \mid \epsilon $ Let $a,b,d$ and $\$ be indexed as follows:$\begin{array}{|l|l|l|l|} \hline a & b & d & \$ \\ \hline 3 & 2 & 1 & ... $)$ , then the answer should be $3210$)
asked Feb 7, 2019 in Compiler Design Arjun 5.4k views
4 votes
2 answers
22
Which of the following statements is FALSE? Any DCFL has an equivalent grammar that can be parsed by a SLR(1) parser with end string delimiter Languages of grammars parsed by LR(2) parsers is a strict super set of the languages of grammars parsed by LR(1) parsers Languages of ... of grammars parsed by LL(1) parsers There is no DCFL which is not having a grammar that can be parsed by a LR(1) parser
asked Jan 26, 2019 in Compiler Design Arjun 626 views
2 votes
2 answers
23
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
24
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
3 votes
1 answer
25
Which of the following is TRUE regarding LL(0) grammar? We can have a LL(0) grammar for any regular language We can have a LL(0) grammar for a regular language only if it does not contain empty string We can have a LL(0) grammar for any regular language if and only if it has prefix property We can have a LL(0) grammar for only single string languages
asked Jan 26, 2019 in Compiler Design Arjun 348 views
3 votes
1 answer
26
Match the following: $\begin{array}{|cc|cc|} \hline (i) &LL(1)&(A)& \text{bottom-up} \\ \hline (ii)& \text{Recursive Descent}& (B) &\text{Predictive} \\ \hline (iii) &\text{Recursive Ascent}& (C)& \text{Top-down} \\ \hline (iv) &LR(1) &(D)& \text{Deterministic CFL} \\ \hline \end{array}$ i-b; ii-c; iii-a; iv-d i-d; ii-a; iii-c; iv-d i-c; ii-b; iii-d; iv-a i-a; ii-c; iii-b; iv-d
asked Jan 26, 2019 in Compiler Design Arjun 296 views
0 votes
1 answer
27
If we have more than 1 parse tree,but one is LMD and other is RMD , Is Grammar Ambiguous? There are no other parse tree other than these two.
asked Jan 25, 2019 in Compiler Design Reshu $ingh 129 views
0 votes
0 answers
28
Does RDP require back tracking ? I am asking this because I have read that if RDP doesn't require back tracking then it is a predictive parser(LL(1))!! A predictive parser is a recursive descent parser that does not require backtracking. Predictive parsing is ... for the class of LL(k) grammars ( https://en.wikipedia.org/wiki/Recursive_descent_parser ) Does it mean that the RDP requires BT
asked Jan 24, 2019 in Compiler Design Nandkishor3939 178 views
0 votes
4 answers
29
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
30
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
...