Chapter 2
Syntax
Dylan Interchange Format
The Dylan interchange format is a standard file format for publishing Dylan source code. Such a file has two parts, the file header and the code body. The file header comes before the code body.
The code body consists of a source record.
The file header consists of one or more keyword-value pairs, as follows:
- A keyword is a letter, followed by zero or more letters, digits, and hyphens, followed by a colon. It contains only characters from the ISO 646 7-bit character set, and is case-independent.
- A keyword begins on a new line, and cannot be preceded by whitespace.
- All text (excluding whitespace) between the keyword and the next newline is considered to be the value. Additional lines can be added by having the additional lines start with whitespace. Leading whitespace is ignored on all lines.
- The meaning of the value is determined by the keyword.
- Implementations must recognize and handle standardized keywords properly, unless the specification for a keyword explicitly states that it can be ignored.
- When importing a file, implementations are free to ignore any nonstandard keyword-value pairs that they do not recognize.
- When exporting a file, implementations must use standard keywords properly. Implementations are free to use nonstandard keywords.
- The definition of a keyword may specify that the keyword may occur more than once in a single file header. If it does not, then it is an error for the keyword to occur more than once. If it does, it should specify the meaning of multiple occurrences.
The file header cannot contain comments, or other Dylan source code.
Blank lines may not appear in the file header. A blank line
defines the end of the file header and the beginning of the code body. The blank line is not
part of the code body. (A blank line
is a line consisting of zero or more space or
tab characters, ending in a newline character.)
The following standard keywords are defined:
language:
language-name [Header keyword]
The source record in the file is written in the named language. The only portable value for
this keyword is infix-dylan
.
module:
module-name [Header keyword]
The source record in the file is associated with the named module. This keyword is required.
author:
text [Header keyword]
copyright:
text [Header keyword]
version:
text [Header keyword]
These are provided for standardization. They are optional, and can be ignored by the implementation.
A typical Dylan source file might look like this:
module: quickdraw author: J. Random Rect Linear Wheels, Inc., "Where quality is a slogan!" rect@linear.com copyright: (c) 1995 Linear Wheels, Inc., All rights reserved version: 1.3 alpha (not fully tested) define constant $black-color = ...