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.
Tags:
Please Discuss here about this assignment.Thanks
Our main purpose here discussion not just Solution
We are here with you hands in hands to facilitate your learning and do not appreciate the idea of copying or replicating solutions.
kindly guide me.
from which lecture is this assignment..?
Lecture 38..
what i can understand in it that this assignment relates to "type checking".
but still don't know the solution.
it can be like this.
| E1< E2 |
{E.type=BOOL} |
but what will be next.
having no idea.
kindly share yout ideas.
come all,will discuss and solve it.
| E1= =E2 {E.type=ASSIGNMENT}
IS this true?
then | E1+E2 should also be BOOLEAN??
ok..in handouts on Page 111 expression E---> (E1) has beenn mentioned..bt not getting it..kindly confirm it too..Is this also boolean??
actually i am not according to scheduled lectures and started late to work on this assignment.let me listen lecture first.
ok i am also working on it..@Sweet Heart..plzz confirm it 100%...:)
© 2021 Created by + M.Tariq Malik.
Powered by
Promote Us | Report an Issue | Privacy Policy | Terms of Service
We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.
We are user-generated contents & non-commercial site. All product, videos, pictures & others contents on site don't seem to be beneath our Copyrights & belong to their respected owners & freely available on public domains. All Contents on site are for personal & non-commercial use.We believe in Our Policy & do according to them. If Any content is offensive in your Copyrights then please email at m.tariqmalik@gmail.com with copyright detail & We will happy to remove it immediately.
Management: Admins ::: Moderators
Awards Badges List | Moderators Group
All Members | Featured Members | Top Reputation Members | Angels Members | Intellectual Members | Criteria for Selection
Become a Team Member | Safety Guidelines for New | Site FAQ & Rules | Safety Matters | Online Safety | Rules For Blog Post