This preview shows pages 1–2. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.View Full Document
Unformatted text preview: Homework 3 CSC 7101, Spring 2011 Due: 14 March 2011 1. Consider a standard programming language (say, like C or Pascal). Suppose we have defined the context sensitive syntax of this language using attribute grammars in the same manner as what we discussed in class. Suppose we now wish to add the requirement that all variables must be initialized or assigned a value before they are used (without requiring syntactically that every declaration contains an initializer). E.g., the Java specification has such a requirement. Is it possible to check this condition in the context-sensitive syntax of the language (using attributes such as symtab , tbl , etc.)? If yes, explain briefly how you would modify the grammar to check this condition. If no, explain how a code-generation attribute grammar would need to be modified such that this condition is checked at run time. Such a check could be performed independently of the scope rules of the language, so you can restrict yourself to the simple languages discussed in class. 2. For each of the following assertions, state whether it is operationally valid or not. Justify your answers briefly. If for either of these assertions you cannot decide whether it is operationally valid or not,briefly....
View Full Document
- Spring '08