Programs: Compiler


The compiler is the program that translates the script files into a binary data files that the interpreter can understand. It also converts data files (such as ".pcx" files) into AGAST resource files (with the help of other utility programs like "2sprite.exe"), and can optionally compress all the loose resource files into a single file. These files are called "Game.data" and "Resource.data".

When there is a detectable error, the compiler will report it. In most cases, it will give the name of the script file, along with the row and column that the error appeared. The first error is the most accurate, so it should be corrected first in case further errors are caused by it.

Often there is a generic syntax error which means the compiler found some symbol which does not make sense in the context it was read. During debugging, it might be helpful to look at the statement right before the one with the error, to verify that, for instance, a semicolon is not missing.

The compiler requires the script file "Game.s" to exist in the game directory. This is just to prevent the accidental compilation of a non-game directory (which is harmless but annoying). The file can be empty of script code, or even have a size of zero bytes. (Specifying the game directory on the command-line overrides this safety check.)

Command-Line Options

The compiler accepts command-line options which (by their very name), are optional: none are required when the compiler is executed from the game directory.

Specify Game Directory (-g gamedir)
If the game is not in the current directory, use this option to tell the compiler where it is.

Specify Tools Directory (-t tooldir)
In order for the compiler to use the conversion programs, it has to be able to find them first. This option lets you specify that directory without fiddling with the path environment variable.

Final (-f)
Instructs the compiler to create a resource data file for final distribution. This will compress all the game resource files into one large file called "Resource.data". (It may take some time, but there is no reason to do this during development.)

Rebuild Resource (-r)
This tells the compiler to convert all resource files files regardless of their time stamp.

Help (-?)
Shows this list of options.

Files

Once the final distribution version is compiled, the only files needed in the distribution are the interpreter "Play.exe", and the data files "Game.data" and "Resource.data".

The compiler also creates a "proofreadme.txt" file containing all the literal strings in the game for convenient spell-checking and proofreading. There are no filename or line numbers references in this text file lest they interfere with automated spell-checkers, but one can easily find the orginal location of a literal string using a utility such as grep, a "Find-in-files" feature of a text editor, or by using the "Conatining Text" field in the "Find in Files" dialog of the Windows start-menu.