assignment-2

assignment-2 - do c while b end where c Com and b Bexp ....

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

View Full Document Right Arrow Icon
CSC 501 - Assignment #2 version 8.0 Due Tuesday 10/4/11 in Class Problems 1. Given the production C ::= skip | V:=A | C;C | if B then C else C end | while B do C end give an inductive defnition oF set Com , the set oF all well Formed commands. You can assume that the productions For non-terminals A and B give rise to the inductively defned sets Aexp and Bexp , respectively. 2. Compute the semantic value oF ae 2 v ,where ae Aexp with v Loc and 2 I . Assume the initial state σ 0 Σ. 3. Compute the semantic value oF c x := 3; if x 5 then x := 0 else x := 10 end , where c Com , x Loc ,and0 , 3 , 5 , 10 I . Assume the initial state σ 0 . 4. Let a 0 1+1and a 1 2 2 2, where a 0 ,a 1 Aexp .P rov etha t a 0 a 1
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: do c while b end where c Com and b Bexp . The inFormal specifcation oF this command is that c is executed as long as b remains true . Provide a set oF semantic rules that defne the behavior oF this construct Formally and demonstrate that your rules work with a simple example. 6. Let : Loc I be some state , show that [2 /x ] = ( [1 /x ])[2 /x ] For some x Loc . ( Hint: use extensional equality oF Functions. 1 ) Where not stated explicitly otherwise, show your computations based on the semantics rules covered in class. 2 1 http://en.wikipedia.org/wiki/Extensionality 2 Typewritten work is preferred :) 1...
View Full Document

This note was uploaded on 10/03/2011 for the course CSC 501 taught by Professor Staff during the Spring '09 term at Rhode Island.

Ask a homework question - tutors are online