0

I'm running a Prolog program that I wrote (a proof tester in natural deduction), and when I run the program (run_all_tests('proof_tester.pl').) the program runs, prints stuff from my program in the console(I barely have time to see what), and then closes SWI Prolog. It just disappears, without a warning or error message or anything. What could this possibly be?

Rickard
  • 1,289
  • 1
  • 17
  • 27
  • You're probably overflowing the stack with a predicate that is recursing to deeply and/or trying to use more than the available memory for the size of a generated list. – lurker Oct 21 '13 at 19:22
  • This clearly should never occur and may be a mistake for example in the engine or the console code. Please report it on the SWI mailing list. The system should never crash like this. If it runs out of a resource, it should throw an exception, as it does in the cases mentioned by @mbratch. – mat Oct 21 '13 at 20:13
  • 2
    Are you sure that the program crashes? Could there be a call to `halt/0`or `halt/1` in the program that halts execution when the computations end? Could be that the output is supposed to be redirected to a file? – Paulo Moura Oct 21 '13 at 21:10
  • There was a "halt" at the end of the program, and when I removed it the program worked and didn't crash the console. However, I have another solution to the same problem(also without the halt) which still crashes the console. I had enough time to see 2-3 red warnings, but nothing else. – Rickard Oct 21 '13 at 21:32
  • 1
    Maybe you can redirect the program output to a text file and post those warnings for further advice? – Paulo Moura Oct 22 '13 at 13:08

1 Answers1

1

When the console closes due to halt being invoked, it is not a "crash".

If you run the program swipl -s proof_tester.pl from a command line rather than the console, then if the code executes halt, your output will still be in the "terminal" window.

You may prefer to redirect messages from SWI-Prolog to a text file (Windows, Linux), which you can then read at your leisure, using a text editor or other means.

hardmath
  • 8,753
  • 2
  • 37
  • 65