LEXICAL CONVENTIONS


The following conventions must be followed when entering XLISP programs:

Comments in XLISP code begin with a semi-colon character and continue to the end of the line.

Except when escape sequences are used, symbol names in XLISP can consist of any sequence of non-blank printable characters except the terminating macro characters:

	( ) ' ` , " ;
and the escape characters:

	\ |
In addition, the first character may not be '#' (non-terminating macro character), nor may the symbol have identical syntax with a numeric literal. Uppercase and lowercase characters are not distinguished within symbol names because, by default, lowercase characters are mapped to uppercase on input.

Any printing character, including whitespace, may be part of a symbol name when escape characters are used. The backslash escapes the following character, while multiple characters can be escaped by placing them between vertical bars. At all times the backslash must be used to escape either escape characters.

For semantic reasons, certain chararacter sequences should/can never be used as symbols in XLISP. A single period is used to denote dotted lists. The symbol T is also reserved for use as the truth value. The symbol NIL represents an empty list.

Symbols starting with a colon are keywords, and will always evaluate to themselves. When the package facility is compiled as part of XLISP, colons have a special significance. Thus colons should not be used as part of a symbol name, except for these special uses.

Fixnum (integer) literals consist of a sequence of digits optionally beginning with a sign ('+' or '-'). The range of values an integer can represent is limited by the size of a C 'long' on the machine on which XLISP is running.

Ratio literals consist of two integer literals separated by a slash character ('/'). The second number, the denominator, must be positive. Ratios are automatically reduced to their cannonical form; if they are integral, then they are reduced to an integer.

Flonum (floating point) literals consist of a sequence of digits optionally beginning with a sign ('+' or '-') and including one or both of an embedded decimal point or a trailing exponent. The optional exponent is denoted by an 'E' or 'e' followed by an optional sign and one or more digits. The range of values a floating point number can represent is limited by the size of a C 'double' on most machines on which XLISP is running.

Numeric literals cannot have embedded escape characters. If they do, they are treated as symbols. Thus '12\3' is a symbol even though it would appear to be identical to '123'.

Complex literals are constructed using a read-macro of the format #C(r i), where r is the real part and i is the imaginary part. The numeric fields can be any valid fixnum, ratio, or flonum literal. If either field has a ratio or flonum literal, then both values are converted to flonums. Fixnum complex literals with a zero imaginary part are automatically reduced to fixnums.

Character literals are handled via the #\ read-macro construct:

	#\<char>	== the ASCII code of the printing character
	#\newline	== ASCII linefeed character
	#\space	== ASCII space character
	#\rubout	== ASCII rubout (DEL)
	#\C-<char>	== ASCII control character
	#\M-<char>	== ASCII character with msb set (Meta character)
	#\M-C-<char>	== ASCII control character with msb set
Literal strings are sequences of characters surrounded by double quotes (the " read-macro). Within quoted strings the '\' character is used to allow non-printable characters to be included. The codes recognized are:

	\\	means the character '\'
	\n	means newline
	\t	means tab
	\r	means return
	\f	means form feed
	\nnn	means the character whose octal code is nnn

XLISP-PLUS - Version 2.1g - Tom Almy tom.almy@tek.com - 18 JUL 94
Generated with WebMaker