| < Language grammars | Index | Adventure language > |
The compiler is used to translate data files according to a grammar into binary data. The compiler may be called from the command line or from its GUI. The data files are interpreted according to the grammar and some special compiler directives.
If you start the compiler without any argument, its GUI is displayed. There, you may specify files for the input, for the grammar, and for the output. Only the input file is mandatory. If no grammar file is specified, the grammar selection between adventure game and look and the grammar version number is used instead. In addition, the compiler may be directed to store item names and to check for double items and for item types. Compilation is started with the Compile button. During compilation, a log window may log the ongoing processes on file or item level. The Info button shows information about the compiler and the language versions. The GUI is closed using the Exit button.
If started from the command line, at least the name of the data file must be given as a parameter. In this case, the most current adventure game grammar is used. Other parameters start with a slash and have to stand before the data file.
/m: don't show messages
/d: don't check for double items
/t: don't check for item types
/n: don't write token names
/l: use the most current adventure look grammar
/w: don't show log window
/i: log item processing
/vXXX: use grammar version XXX
/gfile: use grammar file file (/v will be ignored)
The compiler recognizes the following directives that have to be in a single line.
//: a line starting with a double slash is ignored
/* ... */: these lines and all in between are ignored
#message bool: turns error messages on/off
#doubleItems bool: turns check for double items on/off
#itemType bool: turns check for item type on/off
#itemName bool: turns output of item name on/off
#logItems bool: turns logging of item processing on/off
#include file: includes the file named file
#define def value: defines a replacement; if def is used as a value,
it is replaced by value; def has to begin with a letter
#type name type1 ... typen: defines the new item type
name by enumerating item types typei; each typei may be defined later
Note: Defintions are overwritten without warning. The last definition read is used for the total file.
Note: An included file is inserted at the position of the include directive. The file may have a relative or absolute path. If the path is relative, the file is searched in the current directory, in the directory of the compiled file, and then in the directory of the compiler itself.
A macro defines a pattern to create similar items or groups of items. The macro declaration consists of three parts:
#macro macro_name(parameter1, ... , parametern):
Each macro is identified by a unique name. It has a list of parameters which are also names.
#orcam: A single line with #orcam ends the macro declaration.
To create items from a macro, the macro is instantiated by assigning values to the declared parameters.
The syntax is:
macro_name {value1 | ... | valuen}
In the macro pattern, the parameter names are replaced then by the values to create new items.