[top] [up] [next]

A first Prolog program


This section will show you how to use Trinc-Prolog for writing Prolog programs. All the different steps are described and the text editor and debugger are demonstrated. It is advisable to read through this section and use Trinc-Prolog if you are either new to Trinc-Prolog or new to Prolog.

1. Open the text editor of Trinc-Prolog to create a new text file. The text editor can be opened by:
  • Select 'View | Text Editor' from the menu of the main window, or,
  • press the F12 key.
2. Create a new text file by:
  • Select from the menu 'File | New', or,
  • press the New button.
3. Paste the following program into the new file in the text editor:
%This small program demonstrates some of features of Prolog

%person(<name-of-person>, <year-of-birth>, <sex>).
person(kate, 1973, female).
person(jeff, 1971, male).
person(mary, 1941, female).
person(john, 1939, male).

%mother(<name-of-parent>, <name-of-child>).
mother(mary, kate).
mother(mary, jeff).

%father(<name-of-parent>, <name-of-child>).
father(john, kate).
father(john, jeff).

4. Save the new text file by:
  • Select from the menu of the text editor 'File | Save', or,
  • press the Save button, or,
  • press the CTRL+S key combination.

[top] [up] [next]

 

info@trinc-prolog.com