Syntax Errors

If a clause being compiled contains a syntax error, Prolog tells you that a syntax error has been found and displays the clause. For example, suppose you accidentally omitted a closing parenthesis in a clause:

     | ?- member(X,[a,b,c,d].

When you compile a file containing this clause, Prolog compiles all the clauses that precede the clause containing the error. When it reaches this clause, it displays the message:

     ! Syntax error
     ! between lines 26 and 27
     ! member(X,[a,b,c,d]
     ! <<here>>

to let you know

  1. that the syntax of the clause is incorrect,
  2. where the clause is in the file, and
  3. at what point in the clause it found the syntax error.

Prolog then ignores the clause and continues loading the rest of the file into the database.