Overall structure of Strawberry Prolog 'programs'

'... Prolog is not a wholly procedural language.' That is why the word program , although fit to bring about some intuition, and for this reason used in the tutorial text, does not strictly apply to Prolog source. Rigor of Standard prescribes whatever is submitted to a Prolog interpreter (or compiler) to be called Prolog text .

Prolog text that Strawberry Prolog admits is syntactically a series of terms , each followed by a . , and whitespace (to provide some difference from other uses of . ).

Rules are terms that have :- as their functor . Recall that the functor of a term may be placed among its arguments , if it is an operator. The left-hand side argument of a rule is the head of the rule.

In Strawberry Prolog :- is defined as an operator that admits an arbitrary sequence of arguments on its right-hand side. This sequence of terms on the right-hand side of a rule is the body of the rule. Terms in the sequence that makes the body of a rule are separated by commas.

Questions are terms that have ?- as their functor. In Strawberry Prolog ?- is an operator that admits an arbitrary sequence of arguments on its right-hand side.

Terms with their functor neither ?- nor :- are what the Tutorial calls facts .

Rules and facts are the kinds of clause that Strawberry Prolog admits. Although within the scope of Strawberry Prolog implementer's plans, directives are out of the scope of this version of the On-line Help.

Clauses are the data-like and passive part of Prolog text in Strawberry Prolog. When compiling text, the Strawberry Prolog interpreter consumes them to assemble a Prolog database . After this it processes the questions in the order of their occurrence in the text, regardless to how they are distributed among clauses.

Changes of the contents of the database caused by the interpreter's work on every question are available to next-to-process questions.