CS606 - Complier Construction Solution Assignment No 3 Spring 2021
Dear Students, Here you can read or download CS606 - Assignment No 3 Solution Spring 2021. Previously we shared MGT101 Assignment No 1 Solution Spring 2021. You can also see the File of CS606 Assignment No 3 Solution 2021 provided by Raise For Success. Click on button to Download File and Must Follow our Website and subscribe our YouTube Channel for latest updates.
Dear Students, Here you can read or download CS606 - Assignment No 3 Solution Spring 2021. Previously we shared MGT101 Assignment No 1 Solution Spring 2021. You can also see the File of CS606 Assignment No 3 Solution 2021 provided by Raise For Success. Click on button to Download File and Must Follow our Website and subscribe our YouTube Channel for latest updates.
Requirements:
Consider the following CGF?
We also recommend to read:
Answer:
Add augment production, insert.(Dot)symbol at the position for every production (Raise For Success) of “G”. Also add the look ahead.
S` Ã .S , $
I0 State :
Add augment production to the I0 state and compute the closure
I0 = closure (S` Ã .S)
Add all the production starting with “S” in I0 state because “.” Is followed by non-terminal, so the I0 state becames
S Ã .S , $
S Ã .tTd , $
S Ã .fFd , $
S Ã .tFe , $
S Ã .fTe , $
I1 = Go to ( I0 , S ) = S` Ã S. , $ (Accepting State)
I2 = Go to ( I0 , t ) = S Ã t.Td , $
Add all production starting (Raise For Success) with small “t” in I2 state because “.” Is followed by non-terminal
so, the I2 state becomes
I2 = S Ã .tTd , $
S Ã .tTd , $
S Ã t.Fe , $
T Ã .a , d
F Ã .b , e
I3 = Go to ( I0 , f ) = S Ã f .Fd , $
Add all peoduction starting with small “f” in I3 state because “.” Is followed by non-terminal
So,the I3 state becomes
I3 = S Ã f .Fd , $
S Ã f .Te , $
T Ã .a , e
F Ã .b , d
I4 = Go to ( I2 , T ) = Closure ( S Ã tT . d ,$ ) = S Ã tT . d ,$
I5 = Go to ( I2 , F ) = Closure ( S Ã tF . e ,$ ) = S Ã tF . e ,$
I6 = Go to ( I2 , a ) = Closure ( T Ã a ., d ) = T Ã a ., d
I7 = Go to ( I3 , F ) = Closure ( F Ã b ., e ) = F Ã b ., e
I8 = Go to ( I2 , b ) = Closure ( S Ã fF .d , $ ) = S Ã fF .d , $
I9 = Go to ( I3 , T ) = Closure ( S Ã fT . e ,$ ) = S Ã fT . e ,$
I10 = Go to ( I3 , a ) = Closure ( T Ã a ., e ) = T Ã a ., e (*)
I11 = Go to ( I3 , b ) = Closure ( F Ã b ., d ) = F Ã b ., d (*)
I12 = Go to ( I4 , d ) = Closure ( S Ã tTd ., $ ) = S Ã tTd ., $ (*)
I13 = Go to ( I5 , e ) = Closure ( S Ã tFe ., $ ) = S Ã tFe ., $ (*)
I14 = Go to ( I8 , F ) = Closure ( S Ã tFd ., $ ) = S Ã tFd ., $ (*)
I15 = Go to ( I9 , e ) = Closure ( S Ã fTe ., $ ) = S Ã fTe ., $ (*)
S` Ã .S , $
I0 State :
Add augment production to the I0 state and compute the closure
I0 = closure (S` Ã .S)
Add all the production starting with “S” in I0 state because “.” Is followed by non-terminal, so the I0 state becames
S Ã .S , $
S Ã .tTd , $
S Ã .fFd , $
S Ã .tFe , $
S Ã .fTe , $
I1 = Go to ( I0 , S ) = S` Ã S. , $ (Accepting State)
I2 = Go to ( I0 , t ) = S Ã t.Td , $
Add all production starting (Raise For Success) with small “t” in I2 state because “.” Is followed by non-terminal
so, the I2 state becomes
I2 = S Ã .tTd , $
S Ã .tTd , $
S Ã t.Fe , $
T Ã .a , d
F Ã .b , e
I3 = Go to ( I0 , f ) = S Ã f .Fd , $
Add all peoduction starting with small “f” in I3 state because “.” Is followed by non-terminal
So,the I3 state becomes
I3 = S Ã f .Fd , $
S Ã f .Te , $
T Ã .a , e
F Ã .b , d
I4 = Go to ( I2 , T ) = Closure ( S Ã tT . d ,$ ) = S Ã tT . d ,$
I5 = Go to ( I2 , F ) = Closure ( S Ã tF . e ,$ ) = S Ã tF . e ,$
I6 = Go to ( I2 , a ) = Closure ( T Ã a ., d ) = T Ã a ., d
I7 = Go to ( I3 , F ) = Closure ( F Ã b ., e ) = F Ã b ., e
I8 = Go to ( I2 , b ) = Closure ( S Ã fF .d , $ ) = S Ã fF .d , $
I9 = Go to ( I3 , T ) = Closure ( S Ã fT . e ,$ ) = S Ã fT . e ,$
I10 = Go to ( I3 , a ) = Closure ( T Ã a ., e ) = T Ã a ., e (*)
I11 = Go to ( I3 , b ) = Closure ( F Ã b ., d ) = F Ã b ., d (*)
I12 = Go to ( I4 , d ) = Closure ( S Ã tTd ., $ ) = S Ã tTd ., $ (*)
I13 = Go to ( I5 , e ) = Closure ( S Ã tFe ., $ ) = S Ã tFe ., $ (*)
I14 = Go to ( I8 , F ) = Closure ( S Ã tFd ., $ ) = S Ã tFd ., $ (*)
I15 = Go to ( I9 , e ) = Closure ( S Ã fTe ., $ ) = S Ã fTe ., $ (*)

0 Comments