|Prolog compiler correctness email@example.com (John Todd) (2006-11-04)|
|Re: Prolog compiler correctness firstname.lastname@example.org (russell kym horsell) (2006-11-04)|
|From:||russell kym horsell <email@example.com>|
|Date:||4 Nov 2006 23:20:01 -0500|
|Organization:||Central Iowa (Model) Railroad, Plano, TX, USA|
|Posted-Date:||04 Nov 2006 23:20:00 EST|
John Todd <firstname.lastname@example.org> 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
> 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.
Return to the
Search the comp.compilers archives again.