Pascal is a programming language its syntax is more oriented toward the software developer (especially beginners). It looks less cryptic and the chances of program crashes are less than in C. Borland Pascal was once very popular. Programs written in Pascal are less portable to different operating systems and to different hardware than C.

Free Pascal

There is the free pascal compiler emerge fpc and an ide emerge fpc-ide and the full blown featured IDE for gui applications and delphi lazarus emerge lazarus. Since fpc is a compiler, executable binaries are created that run directly.

Simple applications can be compiled directly on the command line as:



fpc -Tlinux<myprogram>.pas

to let it know that Linux is the target. To include units (in the example, units that are in the directory units next to the directory holding the pas file) that are in an other location run

fpc -Tlinux -Fu <../unit><myprogram>.pas

To run fpc-ide type fp and a text based window as good old turbo pascal appears. To debug there is option mode debug and compile options for the debugger. However there are many issues that fp has with gdb and so debugging fails. So the hard way comes, compile the file with -g option to have debug info fpc -Tlinux -Fu<../unit> -g <myprogram>.pas and start it with gdb in the console.

lazarus should just be used for gui applications (similar to borland delphi). Console applications however can be created via Project -> New project from file, where Program can be selected to get a console application. lazarus creates a project with many files, this might be an overkill for small pascal programs.To Debug gdb has to be selected in the menu. However lazarus does not show a console window when debugged.

For the non Pascal expert, the following includes the standard library crt that deals with cursor movements in the console (similar to ncurses):

uses crt;

If you want to use graphics by uses graph; You might get a -lvga error, this is since the vga library from is missing since it does not come with lazarus. Check the svgalib section in this document on how to install and setup this library.

An graph initialization for pascal VGA mode with 16 colors would look as follows:

var gd,gm:SmallInt;
  gd := D8bit;
  gm := m640x480;

Gnu Pascal

There is also gnu pascal it uses for the graph unit (that uses svgalib) and there are also various IDE as (this should work for both the gnu pascal and the free pascal complier and has gdb and insight debugging support) and and however those packages are quite old.

Eclipse Pascal

Finally there is pascaline a pascal plugin for eclipse: . The plugin is also included into gavab eclipse distribution

Debugging Pascal

Pascal programs can be debugged with gdb using ddd or not. There is also the debugger dbx that looks promising for pascal and can be used via emacs.

Linurs Servernest startpage