Error and warning messages from programming systems like SWI Prolog tell you that there is (or may be) a problem, but they can be a little cryptic in terms of telling you what the problem is. The following table is intended to demystify the messages.
| Message | Likely cause(s) |
|---|---|
ERROR: Out of local stack
| Usually infinite recursion. Look at your recursive rules and ensure that there is some provision to stop the recursion from going on for ever. |
Warning: (test.pl:1):
Singleton variables: [Cihld]
| Means that in the program file test.pl,
at line 1 (that's the :1), you have used a
variable name that not used anywhere else in that rule
(or fact). Can mean a spelling mistake, as in this case -
Cihld should presumably be Child.
However, it could just be that you really only wanted to
use the variable once, as with Someone, inhappy(Person) :- loves(Someone, Person).In this case, you can get rid of the warning message by putting an underscore in front of the singleton variable: happy(Person) :- loves(_Someone, Person).
|
Warning: (thing.pl:3:31):
Redefined static procedure rich/1
| means that rich was previously defined,
and you have now loaded a new definition of it via
a consult operation. This will have
cleared out the previous definition of rich.
|
Warning: (/Users/billw/or.pl:6):
Clauses of rich/1 are not together in the source-file
| |
ERROR: /Users/billw/thing.pl:1: No permission to redefine built-in predicate `assert/1' Use :- redefine_system_predicate(+Head) if redefinition is intended | This means that you have tried to redefine a system predicate.
It is usually a very bad idea to redefine a system predicate, as it
means that any other code that calls the system predicate may end
up using your definition, which might be entirely inappropriate.
It is usually better to think of another name for your predicate:
perhaps make_assertion instead of assert
in the example above.If you absolutely have to use the name reserved for the system predicate for some very good reason, you can do this by inserting the directive :- redefine_system_predicate(+Head).e.g. :- redefine_system_predicate(assert/1).before the point where you begin to redefine the system predicate. |
ERROR: /import/diskname/1/yourlogin/filename.pl:6:
source_sink `nlp-basis.pro' does not exist
Warning: /import/diskname/1/yourlogin/filename.pl:6:
Goal (directive) failed: user:[nlp-basis.pro]
| This is telling you something like the following: you tried to use
a directive like :- ['nlp-basis.pro'].
to load some extra code into
Prolog, but there was no such file available. This could happen
either because, although the file exists, it's in another directory,
or because you mis-spelled the filename. In this case, the file
is one that is often used in COMP9414 nlp assignments, and it is
spelled nlpbasis.pro not nlp-basis.pro
- i.e. no hyphen. Solution - fix the spelling of the filename in
your code. The :6: at the end of the first and third lines of the
messages is telling you that the problem was detected at line 6
of your code file. The extra "Warning" message is about the same
problem.
|
ERROR: /import/kamen/1/billw/filename.pl:12:0:
Syntax error: Unexpected end of file
| This says that, from the point of view of the Prolog system, your code stopped abruptly at line 12, without completing the rule or fact that it was half-way through. This might be exactly what has happened, or it might be that some syntax error in your code has caused Prolog to get confused about what you are trying to do. |
ERROR: /import/kamen/1/billw/filename.pl:92:0:
Syntax error: Unexpected end of clause
| This says that, from the point of view of the Prolog system, your code stopped abruptly at line 92, partway through a clause. This is similar to the previous message, but Prolog had passed the start of a clause when the problem occurred. |
ERROR: /import/kamen/1/billw/filename.pl:41: Full stop in clause-body? Cannot redefine ,/2 | Likely to occur with other messages, e.g. singleton variable
warnings. Probably means you have a punctuation error in a rule,
something like this:
likes(Person1, Person2) :- friendly(Person1).
shared_interests(Person1, Person2),
pleasant(Person2).
There should be a comma, not a full stop, at the end of the first line.
|
ERROR: predname/1: Arguments are not sufficiently instantiated | |
ERROR: predname/1: Type error: `character' expected, found `abc' |
I plan to add to the table as I encounter more such messages. Suggestions welcome, please send a cut-and-paste of the message, the dialogue with SWI Prolog that generated it, and the Prolog code as an attachment. This is not a free debugging service, but I'll try to include such examples in this list.
Bill Wilson's contact info
Last updated:
UNSW's CRICOS Provider No. is 00098G