Linguistics 482 - Computational Linguistics Prolog Notes A. C. Brett
Department of Linguistics
University of Victoria
Clearihue C139
Last updated: 23 October 1999


Comments represent a device whereby English text might be inserted into a Prolog program. The English text is normally intended to describe or document the Prolog program. This descriptive or documentary information serves to clarify and explain the Prolog clauses among which the comments have been inserted.

Comments are preceded by a percent sign, "%." The Prolog interpreter ignores all the characters to the right of the % sign up to the end of the line. Thus, only the % is a Prolog entity.

Comments may appear on lines separate from lines containing Prolog statements, in which case the comment line will begin with a %. Comments may also appear on the same line as a Prolog statement; but, in this case, the % follows the Prolog statement. The following lines illustrate comments:

   % Facts comprising the det/1 predicate.
     det(some).      % Det --> some
     det(this).      % Det --> this
     det(these).     % Det --> these
wherein the comments are used to describe a correspondence between Prolog facts and context-free rewrite rules.

Linguistics 482 Prolog Introductory Notes Top of Page