Alzint — An interpreter for AL(Z) programs



Source code: alzint.pl

You need SWI Prolog to run it.

AL(Z) stands for Assignment Language over Integers. It is a Turing complete programming language supporting variable assignments, loops and conditions.

Alzint is an interpreter for AL(Z) programs, written in Prolog. Alzint lets you run AL(Z) programs. It also supports single-stepping and reverse execution of AL(Z) programs. This means that previous steps of the execution can be undone and later repeated.

To run an AL(Z) program with Alzint, use run(+File):
      swipl -g "run('ex1.txt')" alzint.pl
    
For single-stepping, use step(+File):
      swipl -g "step('ex1.txt')" alzint.pl
    
When single-stepping through an AL(Z) program, you press:
Example files are ex1.txt, ex2.txt and ex3.txt.

A transcript of running ex3.txt: ex3log.txt

If you are interested in more interpreters and compilers in Prolog, also check out Thinking in States and Lisprolog.


Acknowledgments: Many thanks to Christian Fermüller for spawning my interest in AL(Z) and countless other topics in theoretical computer science.



Main page