Go to the first, previous, next, last section, table of contents.

Lexical Elements

Numbers are introduced by a decimal digit, plus, or minus signs. They may contain only decimal digits, a decimal point, and be followed (immediately, no whitespace allowed) by a percent sign.

Strings are sequences of characters enclosed by doublequotes ("). They may contain any character except ASCII NUL ('\0'). To include a doublequote, use backslash, as in "a \"quoted\" string". To include a nonprinting or eight-bit character, use backslash followed by three octal digits, which will be interpreted as an eight-bit character code. (This is mostly the same syntax as in C.) Note that game design files may be passed over networks and between different kinds of computer systems, so non-ASCII characters should not be inserted verbatim into strings.

Symbols are sequences of characters that don't include any of the other special characters. If you wish to include such characters in a symbol, enclose it in vertical bars, for example |foo bar|. (The bars are not part of the symbol.) Symbols are case-sensitive, but this will be changed eventually.

Lists are a sequence of expressions enclosed in parentheses. The empty list is either nil or (). "Dotted pairs" are not allowed. Anything that is not a list is an atom.

All of these objects may range up to a very large size. (You may still run into bugs if you make strings or symbols over about 100 chars in length.)

Comments are enclosed either within #| |# (which nests properly, like Common Lisp and unlike C), or else extend from a semicolon ; to the end of the line. A comment is equivalent to whitespace, so (a#|bcd|#e) is the same as (a e), not (ae).

# by itself is a normal token.

True/false values are just the integers 0 and 1, with no special characteristics.

GlobalConstant: true

GlobalConstant: false

These constants are symbolic forms for 1 and 0. They are identical to numbers, but more descriptive for parameters that are boolean-valued.

Unit, material, and terrain types are distinct objects. However, they can be considered to have numeric "indices" assigned in order of the types' definition. These numbers are not directly visible in GDL, but they often affect sorting and ordering.

You may also supply numbers as "dice specs", which are used in several tables. The syntax is the familiar nndmm[+oo], where nn is the number of dice to throw, mm is the number of values on each die, and the optional oo is an value to be added to the result. The die are 0-based, so for instance 3d6 yields values between 0 and 15, while 3d6+3 is equivalent to the result of rolling 3 6-sided dice. The range of each value is severely limited; nn may range from 0 to 7, mm from 0 to 15, and oo from 0 to 127. Internally, dice specs are normal integers, in the range 16384 to 32767.


Go to the first, previous, next, last section, table of contents.