Homework 5
CSC 7101, Spring 2011
Due: 4 May 2011
This homework is just for practice. You don’t need to hand it in.
1. Consider Dijkstra’s guarded conditional:
a
c
A
::=
if
a
be
A
1
→ a
c
A
1
[]
a
be
A
2
→ a
c
A
2
[]
a
be
A
3
→ a
c
A
3
fi
where
if
and
fi
are keywords,
a
be
A
i
are boolean expressions and
a
c
A
i
are commands. (Dijkstra’s
guarded conditional has arbitrarily many clauses; we’ll restrict ourselves to exactly three for simplicity.)
The guarded conditional is a generalization of the ifstatement with multiple conditions (
a
be
A
1
. . .
a
be
A
3
)
and multiple branches (
a
c
A
1
. . .
a
c
A
3
). The boolean expressions are
guards
for the commands that follow
them. A command
a
c
A
i
can only be executed if its guard
a
be
A
i
is true. If more than one guard is
true,
one
of the commands whose guard is true is chosen
nondeterministically
(at random) to be
executed.
DeFne the denotational semantics of this command. Since we are dealing with commands, you need to
deFne a semantic function with a state argument. In the semantic domains in denotational semantics,
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '08
 Baumgartner,G
 Semiotics, Boolean Algebra, Expression, Dijkstra, denotational semantics

Click to edit the document details