PG211 > Constraint Logic Programming > Library > Getting started with CHIP

Getting started with CHIP

created November 14, 2003, last update 12 February 2009

In order to use CHIP, it is convenient to create a directory such as

~user/chip/
where you will store your CHIP programs.

The most recent CHIP version available at ENSEIRB is CHIP 5.9 available from
/opt/chip59/A_LIRE.ENSEIRB    (look at ~gloess/chip/A_LIRE.ENSEIRB copy in case you don't have access)
since 3 February 2009,  on "bang" and "narrhavas" machines only. It is also available from /opt/chip/A_LIRE.ENSEIRB, and older CHIP 5.d versions will remain available from  /opt/chip5d/A_LIRE.ENSEIRB, for d = 7, 4, 2.

Then, read file /opt/chip/A_LIRE.ENSEIRB which tells you that CHIP runs on bang and narrhavas only, and how to run CHIP, e.g.:

  1. cd chip                                          # always start CHIP from the directory of your CHIP programs;
  2. source /opt/chip/A_LIRE.ENSEIRB
  3. chip5_xgip
If you are a Unix specialist, you may want to adapt your environment so as to avoid issuing the "source" command every time. [You may find hints about that in my obsolete ~gloess/chip/A_LIRE file that we used with CHIP 5.2 version, which is still available.]

Using CHIP under Emacs

This is the recommended way:

CHIP programs

CHIP programs are meant to contain programs only (that is, predicate definitions by means of definite clauses), not queries. If you wish to include test examples inside your programs, you should therefore comment these test example queries. Because of a CHIP bug (no CHIP file should end with a ".") you should always include a comment at the end of your file.

Here is a typical example of CHIP file:

~gloess/chip/nat.pl
It illustrates a recommended and convenient file organization.

Note that for better inter-operability with Netscape or other browsers, you might want to include a .htaccess file such as

~gloess/chip/.htaccess
in your CHIP directory, so that a ".pl" suffix is treated as a ".txt" suffix.

CHIP queries

You type (and run) CHIP queries from the shell where you started CHIP.  A typical CHIP session is shown (within comments) in
~gloess/chip/nat.pl
file: you should copy this file to your directory, and try to reproduce the CHIP session.

Note that

Each time you have edited (and saved) a CHIP program (say my_program.pl), and wish to see the effect under CHIP, you should run the
reconsult(my_program.pl).
query. This will replace existing definitions of your program predicates with the definitions in your file in the CHIP memory. Other methods are dangerous, because they keep accumulating clauses for the same predicate!