Description of the Sixth Homework Problem

Implement the rules required to simulate a computer that supports the instructions: move, add, decrement, jump, and jump_on_zero.

Details:

Handin Requirements

Reference:

Chapters 1, 2, and 3 of the Spivey text on Prolog are sufficient for this assignment. For plus and integer, it is useful to take a look at Section 14.2 of the text.

Sample Run:

This is an example of what it looks like to run this assignment on a sample program that moves the contents of the first location in memory to the eight location and then quits.

brown[205]: cat x.pp

   answer(X) :- simulate(
                   state(1, 
                         3:nil, 

                         instruction(move,1,8): 
                         instruction(jump,0,0): 
                         nil), 

                   X).
brown[206]:  pprolog Hmwk6.pp GivenRules.pp x.pp
Welcome to picoProlog
Reading Hmwk6.pp
Reading GivenRules.pp
Reading x.pp

# :- answer(X).

X = 3:0:0:0:0:0:0:3:nil ? 

no

# :- ^D

Hints: