Reputation: 315
I am a student in Computer Science, and I am learning about logic programming with Prolog.
I have found an interesting Prolog interpreter, VTProlog (https://github.com/Johnicholas/Hello-Github/blob/master/prolog-in-hundreds-of-loc/vtprolog-in-c/vtprolog.pas).
To know more about Prolog, I am trying to compile their source code. And, I got success with Turbo Pascal 7.0, but failed with Free Pascal 2.6.4.
- vtprolog.pas(1195,8) Error: Identifier not found "l"
- vtprolog.pas(1198,30) Error: Identifier not found "l"
- vtprolog.pas(1199,16) Error: Identifier not found "l"
- vtprolog.pas(1203,34) Error: Identifier not found "l"
- vtprolog.pas(1611) Fatal: There were 4 errors compiling module, stopping
- vtprolog.pas(0) Fatal: Compilation aborted
Is there any way to compile it both with Turbo Pascal 7.0 (without any requirement) or Free Pascal 2.6.4 on Windows XP?
Upvotes: 1
Views: 212
Reputation: 26376
Did you put Free Pascal in strict Turbo Pascal Mode with -Mtp ? If I do it compiles, even with older 2.6.2.
D:\testing>fpc vtprolog.pp -Mtp
Free Pascal Compiler version 2.6.2 [2013/02/12] for i386
Copyright (c) 1993-2012 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling vtprolog.pp
vtprolog.pp(222,3) Note: Local variable "num" is assigned but never used
vtprolog.pp(310,3) Note: Local variable "s" not used
vtprolog.pp(1253,13) Note: Local variable "p" not used
vtprolog.pp(100,3) Note: Local variable "source_file" not used
vtprolog.pp(102,13) Note: Local variable "text_chars" is assigned but never used
vtprolog.pp(103,46) Warning: Variable "HeapPtr" read but nowhere assigned
Linking vtprolog.exe
1610 lines compiled, 0.3 sec , 43712 bytes code, 2204 bytes data
1 warning(s) issued
5 note(s) issued
For ideone, you can simulate the commandline parameter by adding {$mode tp} as first thing in the file (before the (*$V-... *) line ). I tested it with ideone, and it compiled.
Upvotes: 2
Reputation: 44901
Without knowing too much about Pascal I think the problem is that part of line 1159:
Procedure print_functor (* l : node_ptr *) ;
has been commented out. Change that to:
Procedure print_functor (l : node_ptr) ;
and it should compile - at least it did when I tried with Ideone (using the Free Pascal Compiler). If the program will work as intended I can't say.
Upvotes: 3