Download current PDF version

Transcript
6
BERKELEY LOGO 6.0
that has not been defined, Logo first looks for a file in the current directory named ‘proc.lg’
where proc is the procedure name in lower case letters. If such a file exists, Logo loads that
file. If the missing procedure is still undefined, or if there is no such file, Logo then looks in
the library directory for a file named ‘proc ’ (no ‘.lg’) and, if it exists, loads it. If neither
file contains a definition for the procedure, then Logo signals an error. Several procedures
that are primitive in most versions of Logo are included in the default library, so if you use
a different library you may want to include some or all of the default library in it.
1.4 Tokenization
Names of procedures, variables, and property lists are case-insensitive. So are the special
words END, TRUE, and FALSE. Case of letters is preserved in everything you type, however.
Within square brackets, words are delimited only by spaces and square brackets. [2+3] is
a list containing one word. Note, however, that the Logo primitives that interpret such a
list as a Logo instruction or expression (RUN, IF, etc.) reparse the list as if it had not been
typed inside brackets.
After a quotation mark outside square brackets, a word is delimited by a space, a square
bracket, or a parenthesis.
A word not after a quotation mark or inside square brackets is delimited by a space, a
bracket, a parenthesis, or an infix operator +-*/=<>. Note that words following colons
are in this category. Note that quote and colon are not delimiters. Each infix operator
character is a word in itself, except that the two-character sequences <=, >=, and <> (the
latter meaning not-equal) with no intervening space are recognized as a single word.
A word consisting of a question mark followed by a number (e.g., ?37), when runparsed
(i.e., where a procedure name is expected), is treated as if it were the sequence
( ? 37 )
making the number an input to the ? procedure. (See the discussion of templates, below.)
This special treatment does not apply to words read as data, to words with a non-number
following the question mark, or if the question mark is backslashed.
A line (an instruction line or one read by READLIST or READWORD) can be continued onto
the following line if its last character is a tilde (~). READWORD preserves the tilde and the
newline; READLIST does not.
Lines read with READRAWLINE are never continued.
An instruction line or a line read by READLIST (but not by READWORD) is automatically continued to the next line, as if ended with a tilde, if there are unmatched brackets, parentheses,
braces, or vertical bars pending. However, it’s an error if the continuation line contains only
the word END; this is to prevent runaway procedure definitions. Lines explicitly continued
with a tilde avoid this restriction.
If a line being typed interactively on the keyboard is continued, either with a tilde or
automatically, Logo will display a tilde as a prompt character for the continuation line.