Small introspective program
Magnus Olsson
magnus%thep.lu.se at Urd.lth.se
Thu Mar 14 19:24:52 AEST 1991
In article <1991Mar13.151756.2885 at en.ecn.purdue.edu> steele at en.ecn.purdue.edu@en.ecn.purdue.edu (Richard A. Steele) writes:
>In article <1991Mar13.032422.9438 at cavebbs.gen.nz> clear at cavebbs.gen.nz (Charlie Lear) writes:
>>Sorry, your entry is disqualified through being too large. REAL BASICs used
>>to be able to tokenise, and the winner is:
>> 1 L.
>>which when run would produce
>> 1 L.
>You sure? If the BASIC is tokenized, then L. will be expanded to LIST
>in the source code listing, so that you'd get
> 1 LIST
>when run. I have to admit, my only experience with tokenized basics is
>the old 8-bit Ataris; do other basics leave the abbreviation?
I'm afraid Charlie used the word `tokenize' in a non-canonical way...
Tokenization means that tokens (identifiers, keywords etc) are saved
just as numbers, not as text. The interpreter would recognize `L.' as
a valid abbreviation of LIST, and store the corresponding number.
The LIST command would then look up this number and write out the
corresponding word, i.e. `LIST'. Applesoft Basic did this, I believe -
`?' was accepted as an abbreviation for `PRINT', but the LIST command
printed it as `PRINT'.
Anyway, there *are* Basics that don't tokenize, but accept abbreviated
statements - like the one on the Acorn Atom (a 6502-based British machine).
A typical line from an Atom program would look something like
100F.I=1TOA.X;P.ZZX';GOS.200;N.
which would correspond to
100 FOR I=1 TO ABS(X) : PRINT ZZ(X) : GOSUB 200 : NEXT I
in Micrososft Basic.
Unfortunately, Atom Basic didn't allow LIST inside a program, so
Charlie's program wouldn't run on an Atom...
Magnus Olsson | \e+ /_
Dept. of Theoretical Physics | \ Z / q
University of Lund, Sweden | >----<
Internet: magnus at thep.lu.se | / \===== g
Bitnet: THEPMO at SELDC52 | /e- \q
More information about the Comp.lang.c
mailing list