You are on page 1of 2

Quiz!

• Books and papers put away


• Hats off or brims turned backwards
• Piece of paper out
- Name and Student ID on it
• Your work is your own
- Eyes on your own paper
- Protect your own paper
- Turn your paper over when you’re done
• You have 10 minutes
• Turn in papers on first pass by your aisle
Quiz 2 – Type Checking
Suppose Oberon had an Enumerated Set type that can be a set of any finite
atomic type (BOOLEANS and ranges of INTEGER):
VAR smallIntSet: SET OF 1..10;
VAR boolSet1, boolSet2: SET OF BOOLEAN;
BEGIN
smallIntSet := smallIntSet ++ 5;(* insert 5 into set *)
boolSet1 := boolSet1 ++ boolSet2; (* union two sets *)
END
Based on the the Expression Compatibility table for the SET type, below,
write a “complete” Oberon type checking testcase for the SET type.
Operator | first operand second operand result type
------------------------------------------------------------------------------------
++ -- ** | SET OF T T SET OF T
| T SET OF T SET OF T
| SET OF T SET OF T SET OF T

Hint: Expanding this table to include erroneous types (the illegal cases) will
help you derive a complete testcase.
Hint: You may use symmetries (e.g., commutativity) to reduce the number of
cases you write down, but you must note the symmetries in your answer.

You might also like