next up previous
Next: About this document ...

NEW MEXICO STATE UNIVERSITY
Department of Computer Science






Programming Languages Qualifying Examination
January 11th, 1999 -- 12-16pm





Let us consider an Object-oriented language. Each class is described simply by a list of attributes (e.g., you can think of a class as a list of variables in a typeless language). The language allows the manipulation of the class hierarchy using the following command:

You can assume that the language relies on a single-root hierarchy and performs single-inheritance.

Consider also the use of the class hierarchy in a simple imperative language, based on the following syntax:



Program $\rightarrow$ Command
Command $\rightarrow$ Command ; Command
  | Id := Expression
  | Id := new Class
  | Id1.Id2 := Expression
  | ClassOperation
Expression $\rightarrow$ (Expression)
  | Expression + Expression
  | Numeral
  | Id
  | Id1 . Id2
ClassOperation $\rightarrow$ create_class Id Id Attributes
Attributes $\rightarrow$ Id
  | Id , Attributes



The ClassOperation denotes the operations to modify the class hierarchy. The purpose of the operation new is to create an instance of the class Class. The expression and the assignment introduce the special case Id1.Id2 which allows to access the attribute Id2 from the object Id1. For example, the operation
mycar.wheels := 4
assigns the value 4 to the attribute wheels of the object mycar.





1.
[75 pts] Provide the denotational semantics for this language, with particular focus on formally modeling and using the class hierarchy and the objects created as instances of the classes (new operation). In particular: Your valuation functions are required to perform error checking for all the operations associated with objects and classes (e.g., whenever an operation involving I1.I2 is performed the semantics should guarantee that I2 is indeed an attribute of the object I1).

You can rely on the overall structure of the denotational semantics for imperative languages presented in Schmidt's book for the various operations in the language above.





2.
[25 pts] Assume that an additional class operation is introduced: Characterize the meaning of this new operation. Discuss how the new operation affects the semantics of the language (be precise and to the point). Point out precisely which components of the denotational semantics have to be modified to accomodate for the new operation.



 
next up previous
Next: About this document ...
Graduate Representative Account
2000-08-03