Sample Midterm Examination -- CS 434 -- Fall 1994
This is a self-scheduled, open book examination. You should return the examination within 2 hours of the time at which you pick it up. You may consult any texts or notes while completing the examination.
S
0 S 1 | A | |||||||
A
1 A | 1
|
Is the grammar an LR(0) grammar? Justify your answer.
The exercise goes on to ask several questions about the opinion expressed by the quote(s). I'd like to ask the same questions (and one extra):
< type specification >
< enumeration type specification > | ||||||||
< enumeration type specification >
( < identifier list > ) | ||||||||
< identifier list >
< identifier > | ||||||||
| | < identifier list > , < identifier > | ||||||||
< factor >
succ ( < expression > ) | ||||||||
| | pred ( < expression > ) | ||||||||
As defined originally, JACCL only allowed assignment to variables of type integer. To make enumerations useful, we must allow assignments to variables of enumeration types. Each enumeration type, however, is a distinct type. Accordingly, a compiler's type checking should ensure that the only values that can be legally assigned to a variable or passed to a parameter declared to be of a given enumeration type are the values of the type.