Re: Prolog compiler correctness

russell kym horsell <>
4 Nov 2006 23:20:01 -0500

          From comp.compilers

Related articles
Prolog compiler correctness (John Todd) (2006-11-04)
Re: Prolog compiler correctness (russell kym horsell) (2006-11-04)
| List of all articles for this month |

From: russell kym horsell <>
Newsgroups: comp.compilers
Followup-To: comp.compilers,comp.lang.prolog
Date: 4 Nov 2006 23:20:01 -0500
Organization: Central Iowa (Model) Railroad, Plano, TX, USA
References: 06-11-016
Keywords: prolog
Posted-Date: 04 Nov 2006 23:20:00 EST

John Todd <> wrote:
> Hi, all.
> I'm writing a Prolog compiler that compiles Prolog code into Warren
> Abstract Machine code, which in turn has an assembler that executes
> the WAM code (pretty conventional). I'm not a professional compiler
> writer, so my question for those of you who wrote Prolog compilers
> before:
> how do you go about testing it? Is there a formal suite of tests that
> you run? (Note: I'm only concerned about Prolog correctness, NOT
> ISO-Prolog compatibility).

I remember seeing (over past 30 y or so) test sets around for validating
compilers, but Prolog is getting a bit old and the interest is "limited".

Since there are lots of interpreters around the "obvious" way to test
your compiler -- if written in Prolog (usual case) --
is to do validation in Prolog.

"Does there exist a small example set of clauses+goal that is compiled
and/or executed wrongly?".

Generate a bunch of test clauses + goal, run them through
your compiler, run the output through a wam interpreter, then compare
result of that with actually interpreting the original clauses in

Sounds trite, but should not be too hard to get going. A WAM interp
in Prolog (if you can't find 10-20 on the web) is expected to be
1-2 wk of postgrad time.

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.