Augustana University College

COMPUTING SCIENCE 370
Programming Languages


Prolog -- Structural Organization and Control Structures



Structural Organization

A Prolog program is constructed from a number of clauses, the general form of which is

There are three forms of clauses based on this general pattern:

  1. facts (hypotheses, unit clauses)      <head>.
    E.g.,
      father( john, mary ).
    

  2. rules (conditions, inferences)        <head> :- <body>.
    E.g.,
      sister( X, Y ) :-
          female( X ),
          parents( X, Ma, Pa ),
          parents( Y, Ma, Pa ).
    

  3. questions (goals)                 ?- <body>.
    E.g.,
      ?- sister( alice, victoria ).
    

Control Structures

Copyright © 2000 Jonathan Mohr