[Next] [Previous] [Up] [Top] [Contents] [Index]

2 Syntax

Lexical Syntax

Dylan source code is a sequence of tokens. Whitespace is required between tokens if the tokens would otherwise blend together. Whitespace is optional between self-delimiting tokens. Alphabetic case is not significant except within character and string literals.

Whitespace can be a space character, a tab character, a newline character, or a comment. Implementations can define additional whitespace characters.

A comment can be single-line or delimited. Although comments count as whitespace, the beginning of a comment can blend with a preceding token, so in general comments should be surrounded by genuine whitespace.

A single-line comment consists of two slash characters in a row, followed by any number of characters up to and including the first newline character or the end of the source record. For example, // This line is a kludge!.

A delimited comment consists of a slash character immediately followed by a star character, any number of characters including balanced slash-star / star-slash pairs, and finally a star character immediately followed by a slash character. For example, /* set x to 3 */.

A single-line comment may appear within a delimited comment; occurances of slash-star or star-slash within the single line comment are ignored.

A token is a name, a #-word, an operator, a number, a character literal, a string literal, a symbol literal, or punctuation.

A name is one of the following four possibilities:

Dylan Reference Manual - 17 OCT 1995
[Next] [Previous] [Up] [Top] [Contents] [Index]

Generated with Harlequin WebMaker