search
Log In
1 vote
289 views
Find the closure of S $\rightarrow$ .A ,dollar for the grammar

S --> A

A --> AB | $\varepsilon$

B --> aB | b
 

// I'm getting
S --> .A , dollar

A --> .AB, dollar

A --> . $\varepsilon$ , a,b
in Compiler Design
edited by
289 views
1

S--->.A, $

A--->.AB, $

         /.ϵ, $

A--->.AB, a/b

        /.ϵ, a/b

0

So you're saying that in A--->.AB, lookaheads will be { $, a, b} ?

0
yes..
0
can you elaborate in detail please ? @joshi_nitish
3

S--->.A, $

A--->.AB, $

         /.ϵ, $   

upto above you might be clear...now,

in A--->.AB, \$  dot(.) is before A you have to write productions of 'A' and his time new lookaheads will be first(B$) i.e a,b...

Please log in or register to answer this question.

Related questions

1 vote
0 answers
1
172 views
Consider the following grammar: $S \rightarrow A$ $S \rightarrow xb$ $A \rightarrow aAb$ $A \rightarrow B$ $B \rightarrow x$ The average length of the stack used while parsing the string "axb$" using LR(1) parser is _________. I am getting 5, but answer is 2.5.
asked Jan 7, 2018 in Compiler Design Shubhanshu 172 views
2 votes
0 answers
2
716 views
Consider the following grammer:- Stmts -> Stmt | Stmts;Stmt Stmt -> Var =E Var ->id[E] | id E-> id | (E) Find the number of conflicts in LR(0)?
asked Oct 14, 2017 in Compiler Design rahul sharma 5 716 views
0 votes
1 answer
3
217 views
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 217 views
1 vote
1 answer
4
359 views
According to my understanding, we LALR is constructed by reducing LR(1) automaton states. So I think it should be LR(1) However, we construct SLR(1) items from the LR(0) automaton, and we say with surety that number of states in SLR(...) is equal to number of states in LALR(...), how can this be?
asked Jan 13, 2018 in Compiler Design vaibhav101 359 views
...