SICStus Prolog - Full Prolog Syntax Go to the first , previous , next , last section, table of contents . A Prolog program consists of a sequence of sentences or lists of sentences. Each sentence is a Prolog term . Note that a term representing a sentence may be written in any of its equivalent syntactic forms. Terms are written as sequences of tokens .
Tokens are sequences of characters which are treated as separate symbols.
Tokens include the symbols for variables, constants and functors, as well as punctuation characters such as brackets and commas. Two tokens must be separated by a layout-text token if they could otherwise be interpreted as a single token. Layout-text tokens are ignored when interpreting the token list as a term, and may appear at any point in the token list. Depending on the section, a category may represent a class of either terms, token lists, or character strings. C denotes an optional C .