We are here with you hands in hands to facilitate your learning & don't appreciate the idea of copying or replicating solutions. Read More>>

Looking For Something at vustudents.ning.com? Click Here to Search

www.bit.ly/vucodes

+ Link For Assignments, GDBs & Online Quizzes Solution

www.bit.ly/papersvu

+ Link For Past Papers, Solved MCQs, Short Notes & More


Dear Students! Share your Assignments / GDBs / Quizzes files as you receive in your LMS, So it can be discussed/solved timely. Add Discussion

How to Add New Discussion in Study Group ? Step By Step Guide Click Here.

Question No 1: Marks 20
Consider the following grammar productions. Suppose you have an attribute E.type which can
be set to either INT, BOOL. Assume that the type of an expression is set to INT if an error is
detected and you have a routine msg() similar to printf() that can be used to print error
message.
E → CONST {E.type=??}
| ID {E.type =getType(ID.name);}
| E1 +E2 {E.type=??}
| E1< E2 {E.type=??}
| E1= =E2 {E.type=??}
| (E1) {E.type=??}
You are required to add rules to the attribute grammar to calculate E.type for each grammar
production.

+ How to Follow the New Added Discussions at Your Mail Address?

+ How to Join Subject Study Groups & Get Helping Material?

+ How to become Top Reputation, Angels, Intellectual, Featured Members & Moderators?

+ VU Students Reserves The Right to Delete Your Profile, If?


See Your Saved Posts Timeline

Views: 2185

.

+ http://bit.ly/vucodes (Link for Assignments, GDBs & Online Quizzes Solution)

+ http://bit.ly/papersvu (Link for Past Papers, Solved MCQs, Short Notes & More)

+ Click Here to Search (Looking For something at vustudents.ning.com?)

+ Click Here To Join (Our facebook study Group)

Attachments:

Replies to This Discussion

also see handouts page 104...there is another possibility..

Handouts page frm where i took help are 109,and 113...check them..and inform me whether m right or wrong??..

i hv pdf.

kindly tell topic names.

Topic : Three-Address statement types...

check hint in it which is like a<b..

ys chked...

u r wrong.

chk that attached idea solution in my previous comments.our type checking is right and

follow rules given lecture 38 under ur mentioned topic.

INt and BooL can't be conditional statements.

ok..lemme make final solution..then will share..

In fact " INT " and BOOL are types..we can't apply jumps on these.

assignmnet ker li app ne mjuye se ni hui can u help me salma iqbal

E ---->CONST             {E.type= INT ;}

    | ID                        {E.type =getType (ID.name) ;}

    | E1 +E2               {E.type=INT ;}

   | E1 +E2            {if ((E1.type==INT&& E2.type==INT))

                                E.type==INT;

                                else

                                E.type==BOOL;//error

                               }               

     | E1< E2              {E.type=BOOL ;}

    | E1< E2               {if ((E1.type== BOOL && E2.type== BOOL))

                                    E.type== BOOL;

                                    else

                                    E.type== INT; //error

                                    }   

    

     | E1= =E2          {E.type=BOOL ;}

     | E1= =E2          {if ((E1.type== BOOL && E2.type== BOOL))

                                    E.type== BOOL;

                                    else

                                    E.type== INT; //error

                                    }   

Still its incomplete solution..Confusion regarding ID is stil there and lso regarding      | (E1)...@sny2ksa..Is this correct solution??

No,its not correct according to me...

still rules are missing in it..you are just printing errors.

if any one else can say about it..most welcome.

at least we will be able to submit it .

:-( koi kar day uplod .............sny2ksa ager koi mistak ha ti identify karo na plzzzzzz

waqas.

assignment already has been discussed in the right way.

1st write expression types and then Rules.

see the last thread comments.you will get all with an idea solution.

smjh nai lag rai yaar :-(

RSS

© 2020   Created by +M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service

.