The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
196 views

$S\rightarrow aA|bAc|dc$

$A\rightarrow d$

Number of states in $CLR\left ( 1 \right )$ parser construction _______________


Is

$S\rightarrow d.c|$$

$A\rightarrow d.,a$

will be in $1$ state or in $2$ different states??

asked in Compiler Design by Veteran (112k points) | 196 views
0

Check the 3rd for loop, $First(\beta a)$

Now if $\beta =\epsilon$

Then lookahead will be $a$, i.e. lookahead for $A\rightarrow \alpha B\beta$

0

 

Then lookahead will be a

both a and b 

0
yes,
merging is a shortcut for lookahead

right??
0

this line of ur is not correct

 

We don't need to find lookahead1 as we have it already found that in $I_{0}$

 However , I understood it

0
by merging you mean
$A \rightarrow a.A , a $ and $A \rightarrow a.A ,  b$

can be writen as

$A \rightarrow a.A , a | b$ ?
0

 that line is correct coz that production is not added in that state 

and it was added in $I_0$

0

No

suppose for $A \rightarrow a.A , b $

here lookahead just merged with prev. grammar, when A has no terminal after it.

I mean this  $A \rightarrow a.A , b $ in next level becomes

$A \rightarrow a.Ab $

And Next we got look ahead for A will be $\left \{ b \right \}$


Check the 3rd for loop of the algo, u will get it

0
your basics are not clear

lookaheads don't merge

You should read from page 260
0

 that line is correct coz that production is not added in that state

 @Mk Utkarsh

yes, because it shouldnot add that state

Check the rule

lookahead1 is lookahead to that $A$ in red color ${\color{Red} A}\rightarrow a.A,a|b$

And that $A$ comes from prev. state

And in prev state 

we got $A\rightarrow .aA$ which again has no follow set

So, go to prev production again, i.e. $S\rightarrow .AA$

And from here we got value of $Follow\left ( A \right )=\left \{ a,b \right \}$

Ok??

0

your basics are not clear
 

I just looking for a shortcut : |

check the 3rd for loop

for(each terminal $b$ in $first\left ( \beta a \right )$) 

What is $a$ here??

Please log in or register to answer this question.

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
49,807 questions
54,504 answers
188,309 comments
74,892 users