a5 - Is this rule consistent (with the standard model)? If...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 755, Assignment #5 Due: 2 June 2006. 1. (3 points). One problem with the language whose axiomatics we considered was that there was no way to check for ‘end-of-file’. This problem tries to fix that. Suppose we introduce the keyword ‘ EOF ’ that allows us to check if we have reached the end of the input stream. EOF can be used wherever a boolean expression may be used (such as in if-then-else and while statements). So, for example, I can write, while (!EOF) { ... } and this loop will go on till we reach the end-of-file. What changes, if any, would you have to make to the partial correctness axiomatics of the language to deal with EOF ? Write down the modified axioms and rules, and explain them briefly. What changes, if any, would you have to make to the total correctness axiomatics of the language to deal with EOF ? Explain briefly. 2. (3 points). Consider the following rule for the if statement: { p b } S 1 { q b } , { p ∧ ¬ b } S 2 { q ∧ ¬ b } { p } if b then S 1 else S 2 { q }
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Is this rule consistent (with the standard model)? If yes, explain; if not, show that it is not. Is the rule complete? (More precisely: If we replaced the standard if-then-else rule with this rule, would the resulting system by relatively complete?) If yes, explain; if not, show that it is not. 3. (4 points). Consider the simple imperative language whose (structural) operational semantics we have defined in class. Suppose we change the (intuitive) operational model of the assignment statement as follows: to execute x := e ; , we evaluate the expression e as usual and assign its value to x , and then we output, on the standard output stream, the value just assigned to x . What changes would you make to the operational semantics we saw in class? You do not need to write down all the changes, just explain the idea and illustrate it by writing down a couple of the new rules. 1...
View Full Document

This homework help was uploaded on 04/10/2008 for the course CSE 755 taught by Professor Neelamsoundarajan during the Winter '05 term at Ohio State.

Ask a homework question - tutors are online