Alzint — An interpreter for AL(Z) programs
Source code: alzint.pl
You need SWI Prolog to run
AL(Z) stands for Assignment Language over Integers. It is a
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:
- c to continue
- r to run
- u to undo the preceding step (reverse execution)
- q to quit
are ex1.txt, ex2.txt and
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
Fermüller for spawning my interest in AL(Z) and countless
other topics in theoretical computer science.