如何从源代码编译Pascal S?

时间:2015-04-30 03:09:40

标签: compilation ide pascal compiler-warnings

我是计算机科学专业的学生,​​我正在学习Pascal的逻辑编程。

我找到了一个有趣的Pascal解释器, Pascal S http://www.moorecad.com/standardpascal/pascals.pas)。

要了解有关Pascal的更多信息,我正在尝试编译它们的源代码。并且,我使用 Turbo Pascal 7.0 取得了成功,但是 Free Pascal 2.6.4 失败了。

以下是使用 Ideone http://ideone.com/Tn9b87)编译时的结果。

Free Pascal Compiler version 2.6.4+dfsg-4 [2014/10/14] for i386
Copyright (c) 1993-2014 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling prog.pas
prog.pas(209,8) Fatal: Syntax error, "BEGIN" expected but "OBJECT" found
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

有没有办法在 Windows XP 上使用 Turbo Pascal 7.0 (无任何要求)或 Free Pascal 2.6.4 进行编译?

2 个答案:

答案 0 :(得分:2)

搜索整个单词'object'并将其替换为其他内容,例如'objectkind'。

答案 1 :(得分:1)

此程序在ISO模式下使用FPC 3.x进行编译(因为您是从ISO中心站点获得的),在评论行" srcfil:text"之后。看来摩尔的编译器接受重复的文件声明。

fpc -Miso pascals.pas
Free Pascal Compiler version 3.1.1 [2015/04/10] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Win32 for i386
Compiling pascals.pas
pascals.pas(399,30) Warning: Comparison might be always false due to range of constant and expression
Linking pascals.exe
1966 lines compiled, 0.1 sec, 82528 bytes code, 3396 bytes data
1 warning(s) issued
相关问题