Consider the following grammar productions Assume 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.
Assume 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=??}
Add rules to the attribute grammar to calculate E.type for each grammar production.
Solution:
Related Posts
- Spring2008_CS614_03
- Summer2007_CS614_02
- Summer2007_CS614_01
- Spring2007_CS614_05
- Spring2007_CS614_04
- Spring2007_CS614_03
- Spring2007_CS614_02
- Spring2007_CS614_01
- Special2006_CS614_05
- Special2006_CS614_04

It’s really a nice and helpful piece of information. I’m glad that you shared this helpful info with us. Please keep us informed like this. Thanks for sharing.
found your site on del.icio.us today and really liked it.. i bookmarked it and will be back to check it out some more later