hw4 - Homework 4 CSC 7101, Spring 2011 Due: 27 April 2011...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Homework 4 CSC 7101, Spring 2011 Due: 27 April 2011 1. Translate our operational semantics rules into Prolog clauses. Represent syntactic constructs using functors. E.g., the if-statement could be represented as ifThenElse(B,C0,C1) . Represent the three different eval- uation functions, <.,.>->. , as predicates. Assume that appropriate predicates for arithmetic, comparisons, boolean operations are built in. Assume that a state is represented as a list of pairs of a variable and a value, and that bindings at the beginning of the list shadow later bindings. E.g., the axioms for numeric constants and variables could be written as follows: evalArithExp(const(N), Sigma, N). evalArithExp(var(X), Sigma, Val) :- get(Sigma, X, Val). where get(Sigma,X,Val) computes the result of ( X ) in Val and is defined as follows: get(, X, undefined). get([[X,V]|T], X, V). get([H|T], X, V) :- get(T, X, V). You dont need to test and run your Prolog program. Writing it on paper is good enough. 2. Develop semantic rules for our operational semantics system for the following (simplified) loop construct adopted from Ada:...
View Full Document

Page1 / 2

hw4 - Homework 4 CSC 7101, Spring 2011 Due: 27 April 2011...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online