Back to manual index

How to run scripts


There are two primary executables to run GibPascal scripts: gpascal and gpdebug. Scripts will normally end with the PAS extension. Running the script with 'gpascal' executable will create normal output.


With Linux, you might run a script like this at the command line:

./gpascal example.pas

Or like this internally in the script on the first line:

#!./gpascal


With Windows, the script on the command like can be run like this with the executable:

gpascal.exe example.pas


To show the version of GibPascal that is being used, run:

gpascal -v

Debug mode

Running the executable gpdebug will run the script with debugging mode on. Debug mode can also be called in gpascal with the -d flag after the file such as:

gpascal.exe example.pas -d

The following code in debug mode:
program HelloWorld;

var tString : string;
    dumbnum : integer;
    NotSmart : string;

begin
  tString := 'I am very';
  NotSmart := 'dumb';
  dumbnum := 12345;
  writeln('Hello World!');
  writeln(tString);
  writeln(dumbnum);
  writeln(NotSmart);
end.
Would produce the following output: C:\Temp\GibPascal>gpdebug test.pas **[VAR] Look at allocation: 'tString' **[VAR] Found string var **[VAR] Look at allocation: 'dumbnum' **[VAR] Found integer var **[VAR] Look at allocation: 'NotSmart' **[VAR] Found string var **[MAIN] possible variable match found 't...' at memory location 0: **[MAIN] found set match for 'String' **[MAIN] Value found and stored: 'I am very' **[MAIN] possible variable match found 'N...' at memory location 2: **[MAIN] found set match for 'smart' **[MAIN] Value found and stored: 'dumb' **[MAIN] possible variable match found 'd...' at memory location 1: **[MAIN] found set match for 'dumbnum' **[MAIN] Value found and stored: '12345' Hello World! **[writeln] variable name: 'tString' I am very **[writeln] variable name: 'dumbnum' 12345 **[writeln] variable name: 'NotSmart' dumb **[MAIN] Pascal script Terminated **[MAIN] Number of variables: 3