Download USER MANUAL

Transcript
2.4 How to run the ELAN compiler
25
assembler language. Up to now, this is the only known limitation, why the compiler runs only
on the following architectures: DEC-ALPHA, SUN4 and Intel-PC. The ELAN compiler does
not (in the alpha release of the version 2.0) compile whole ELAN language. There are several
ne restrictions (see Section 4.3) of programs, which can be compiled. The main restriction
is that the ELAN compiler does not treat AC-symbols, thus any logic description containing
AC-symbols is not yet compilable.
In the preliminary alpha release of the version 2.00, there exists two modes of using the ELAN
compiler. The rst one (initialised by the switch -c), allows to compile a logic description (or, an
ELAN program) with an input query term into a binary executable le. This le is launched from
the ELAN environment, and also their results are interpreted by the ELAN environment such
that the user does not see any substantial dierence in the behaviour of the ELAN environment
between the interpreted and the compiled versions (except of the speed-up).
We illustrate the compiler on a simple example from the distribution le. The rst example
shows the compilation of the program nqueens with the query queens(8):
> elan -c nqueens
******** ELAN version 2.00 (17/04/97.16:24) ********
(c)
INRIA-Lorraine & CRIN,
1994, 1995, 1996, 1997
handling module nqueens
handling module int
handling module bool
end of bool
end of int
end of nqueens
[.eln->.c]:
[.c->.o]: $ELANLIB/Compiled/`uname -m`/cElanScript -c nqueens
gcc -DNONUNDERSCORED -w -I/users/protheo/toto/elan/elanlib//Compiled
-L/users/protheo/toto/elan/elanlib//Compiled/alpha -c nqueens.c
enter query term finished by the key word 'end':
queens(8) end
[.o->a.out]: $ELANLIB/Compiled/`uname -m`/cElanScript -l
nqueens -N
gcc -DNONUNDERSCORED -w -I/users/protheo/toto/elan/elanlib//Compiled
-L/users/protheo/toto/elan/elanlib//Compiled/alpha maincompiled.c
nqueens.o -lelan -lnonearley -lm
[execute]:
[ main ] start :
[] result term :5.7.2.6.3.1.4.8.nil
[] result term :4.7.5.2.6.1.3.8.nil
[] result term :6.4.7.1.3.5.2.8.nil
[] result term :6.3.5.7.1.4.2.8.nil
[] result term :4.2.8.6.1.3.5.7.nil
[] result term :5.3.1.6.8.2.4.7.nil
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . e.t.c.
[] result term :3.5.2.8.6.4.7.1.nil
[] result term :5.2.4.7.3.8.6.1.nil
[] result term :4.2.7.3.6.8.5.1.nil
real 0.3 user 0.1 sys 0.0
[kill]:
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . e.t.c.
enter query term finished by the key word 'end':
The same program (but without the query) can be compiled using the option --exe, which
produces an independent executable le. This fact implies that the parser of ELAN terms is
May 9, 1997
ELAN user manual