CS322 Fall 1999
Module 8 (Metainterpreters)
Assignment 8

Solution.

In this assignment you will implement, in CILog, a new programming language ArLog that allows for adjustable parameters in arithmetic expressions and user-defined arithmetic functions.

An ArLog program is a set of clauses of the form:

H <= B.
where H is an atom and B is a body.

A body is either of the form:

Parametrized expressions are of the form:

Parametrized expressions are always evaluated in an environment, where an environment is a list of terms of the form val(P,V) where P is a parameter and V is a number.

We always prove goals within an environment, but the environment can be updated with an assign goal. In a conjunction, the rightmost conjunct is evaluated in the environment that is the result of the evaluation of the leftmost conjunct.

As well as normal clauses defining atoms, the user can define functions using:

F=Exp <= B.
Where F is a user-defined function and Exp is an expression. If B is true, the value of Exp is the value that F evaluates to.

You can also download a CILog implementation of ArLog, as well as a sample ArLog program.

  • Question 1
  • Question 2
  • Question 3
  • Question 4

  • David Poole