This file describe the lexical aspects of lambda Prolog as implemented in Terzo. Please send questions, comments, or corrections to Philip Wickline . Reserved Words: --------------- The following are the reserved words, and as such, may not be used as identifiers. type kind local module localkind infix & , ; => :- ( ) -> %( )% % : Identifiers: ------------ There are three type of identifiers in lambda Prolog: upper case identifiers, lower case identifiers, and quoted identifiers. Upper and lower case identifiers are made from upper and lower case letters, the numbers 0 through 9, and the symbols: ! @ $ ^ = ~ ` ' < > * + ? | / - In addition, no reserved word may be used as an identifier, and the following restrictions serve to differentiate upper and lower case identifiers. Upper case identifiers - Must begin with an upper case letter or an under-bar (_). Examples: X _XYZ Z87232aba''' Lower case identifiers - must begin with a lower case letter or one of these symbols: ! @ $ ^ = ~ ` < > * + ? | / -. Examples: x ----> x23' Quoted identifiers are any string not including the tab (\t), space (\ ), newline (\n), form-feed (\012), or single quote (') characters which is enclosed in a pair of single quotes ('). Examples: '&^%$##(' 'word' '()' Built-in types: --------------- This implementation has a number of built-in types: integers, real, strings, characters, and IO streams. Integers and Reals- We use the lexical definitions given in "The Definition of Standard ML": An integer constant is any non-empty sequence of digits, possibly proceeded by a negation symbol. A real constant is an integer constant, possibly followed by a point (.) and one or more digits, possibly followed by an exponent symbol E and an integer constant; at least one of the optional parts must occur, hence no integer constant is a real constant. Examples: 0.7 3.32E5 3E~7. We denote the type of integers with int, and the type of reals with real. Strings - We use the lexical definition of strings given in "The Definition of Standard ML", that is: A string constant is a sequence, between quotes ("), of zero or more printable characters (i.e., numbered 33-126), spaces or escape sequences. Each escape sequence starts with the character \, and stands for a character sequence. The escape sequences are: \n A single character interpreted by the system as end-of-line. \t Tab. \^c The control character c, where c may be any character with number 64-95. The number of \^c is 64 less than the number of c. \ddd The single character with number ddd (3 decimal digits denoting an integer in the interval [0,255]). \" " \\ \ \f..f\ This sequence is ignored, where f..f stands for a sequence of one or more formating characters. The formating characters are a subset of the non-printable characters including at least space, tab, newline, form-feed. This last form allows long strings to be written on more than one line, by writing \ at the end of one line and at the start of the next. The type of strings is written string. Streams - Terzo provides two kinds of streams: in_stream and out_stream. Neither type of stream has any meaningful printing value, and with the exception of the predefined std_in, std_out, and std_err (which correspond to the usual Un*x/C notions of standard IO) a user cannot "enter" a stream.