search
Log In

Recent questions tagged parsing

0 votes
2 answers
1
I think follow(A) is given wrong. I am getting follow(A) = {first (B), follow(S)} = {e, $}
asked Jan 23, 2017 in Compiler Design Sushant Gokhale 296 views
0 votes
2 answers
2
An umambiguous grammar has same right most and left most derivation>?? True or false.?
asked Jan 23, 2017 in Compiler Design Ravi_1511 326 views
2 votes
1 answer
3
what is viable prefix in compiler??
asked Jan 22, 2017 in Compiler Design yankur9 199 views
3 votes
2 answers
4
Consider the following grammar G: The number of states in SLR parser for G is _______. My question is since this grammar can't generate any string the number of states should be zero right as we will remove useless symbols before constructing canonical collection of LR(0) items
asked Jan 20, 2017 in Compiler Design Pankaj Joshi 657 views
9 votes
2 answers
5
1. If a grammar is LL(1), then it has to be LALR(1).Is it correct?? 2. Is there anything called as LL(0)?? 3. Do every DCFL has LL(1) grammar?? 4. Do every DCFL has LR(1) grammar?? 5. Can someone please specify, As we can say that every regular language is LL(1), what can we say for CFL,CSL,Recursive and RE?? 6. What is the difference between parse tree, syntax tree and abstract syntax tree?
asked Jan 20, 2017 in Compiler Design Lucky sunda 1.6k views
4 votes
1 answer
8
Consider a Grammar G as follows : $S\rightarrow W$ $W \rightarrow ZXY / XY$ $Y\rightarrow c/\epsilon$ $Z\rightarrow a/d$ $X\rightarrow Xb/\epsilon$ Draw the LL(1) parsing table for the given grammar ? NOTE :- The above grammar is NOT LL(1) .
asked Dec 27, 2016 in Compiler Design Kapil 5.3k views
3 votes
1 answer
10
A non left recursive and left facotred grammar in which all non-empty rules defining the same non terminal have disjoint first sets, such grammar is called _____________ a) LL(1) b) LR(0) c) LR(1) d) None asnwer given LL(1). but i think bcoz of follow there can be conflict hence none of these should be the answer. Is it right??
asked Dec 26, 2016 in Compiler Design Rahul Jain25 485 views
2 votes
1 answer
11
$\begin{align*} &\color{blue}{\text{Top down predictive parsers detect errors earlier than bottom up parsers (true/false)}} \\ &\color{maroon}{\text{Justify your answer}} \\ \end{align*}$
asked Dec 19, 2016 in Compiler Design Anusha Motamarri 722 views
0 votes
3 answers
12
Consider the following grammar: $S \rightarrow S$ $S \rightarrow SS \mid a \mid \epsilon$ Indicate the shift-reduce and reduce-reduce conflict (if any) in the various states of the LR(0) parser.
asked Dec 19, 2016 in Compiler Design jothee 515 views
5 votes
2 answers
13
Consider the following grammar: $S \rightarrow S$ $S \rightarrow SS \mid a \mid \epsilon$ Construct the collection of sets of LR (0) items for this grammar and draw its goto graph.
asked Dec 19, 2016 in Compiler Design jothee 1k views
1 vote
2 answers
14
Consider the grammar given below. It is E -> T+E | T T -> a a. SLR(1) but not LL(1) b. Not an operator grammar c. Ambiguous d. None of these
asked Dec 16, 2016 in Compiler Design umang_16 189 views
0 votes
0 answers
15
$\begin{align*} \text {stmt} &\rightarrow \text{if expr then stmt else stmt} \\ & \;\; \;\; | \text{ if expr then stmt} \\ & \;\; \;\; | \text{ other} \end{align*}$ Which of the following statement/s is/are true ?? A. The grammar is ambiguous and the ambiguity cannot be resolved. B. The grammar is unambiguous C. The grammar is ambiguous and the ambiguity can be resolved D. None of these
asked Dec 15, 2016 in Compiler Design dd 562 views
1 vote
1 answer
16
Consider the following statements: S1: Whenever we apply transition on any symbol the lookahead does not change S2: The lookahead has effect on items of the form [$A\rightarrow \alpha \bullet \beta , a$] where β ≠ ∈ and [$A\rightarrow \alpha \bullet , a$] Which of the above statements are true wrt LR(1) items?
asked Dec 15, 2016 in Compiler Design dd 311 views
0 votes
2 answers
17
why does recursive descent parser not use left recursive grammar?
asked Dec 14, 2016 in Compiler Design gautamcse27 451 views
0 votes
1 answer
19
Find first and follow of given grammer E --> E+T / T T --> T*F / F F --> (E) / id
asked Dec 9, 2016 in Compiler Design sudhirnayak 1.1k views
2 votes
1 answer
20
1 vote
0 answers
21
Consider the following two statements: P: Every regular grammar is LL(1) Q: Every regular set has a LR(1) grammar Which of the following is TRUE? Both P and Q are true P is true and Q is false P is false and Q is true Both P and Q are false
asked Dec 2, 2016 in Compiler Design indrajeet 359 views
14 votes
3 answers
22
Merging states with a common core may produce __________ conflicts and does not produce ___________ conflicts in an LALR purser.
asked Nov 27, 2016 in Compiler Design makhdoom ghaya 2.1k views
24 votes
2 answers
23
Consider the following expression grammar. The semantic rules for expression evaluation are stated next to each grammar production. ... to $7$ Precedence of $+$' is higher than that of $\times$', and both operators are left associative; expression is evaluated to $9$
asked Nov 27, 2016 in Compiler Design jothee 6k views
...