On 8/27/2006 at 11:01 PM Roy J. Tellason wrote:
> I think you are right about the '=' as
well - funny that they would
> "tokenize" in this manner - I've written several BASICs over the years
-
> some which operated on pure plain text (no tokenization at all), but
most
> replaced all keywords with a single easily
recognizable token - I don't
see
> what advantage this type of tokenization could
have done as it saves no
> space, and you still have to parse the whole word.
MS BASIC tokenizes its keywords. On listing back, it does a reverse lookup
into its keyword table and substitutes words for tokens.
Is there any chance that there are more than one
keyword that share the
same first few characters?
I think so, but on one of my old CP/M disks, I came across this table.
Does this look like the MS keyword table? I remember writing a converter
from MS BASIC80 to another dialect of BASIC, but
don't know if this is
related to the project.
"AND" 247
"ABS" 006
"ATN" 014
"ASC" 021
"AUTO" 171
"CLOSE" 195
"CONT" 154
"CLEAR" 146
"CINT" 028
"CSNG" 029
"CDBL" 030
"CVI" 043
"CVS" 044
"CVD" 045
"COS" 012
"CHR$" 022
"DATA" 132
"DIM" 134
"DEFSTR" 173
"DEFINT" 174
"DEFSNG" 175
"DEFDBL" 176
"DEF" 152
"DELETE" 170
"END" 129
"ELSE" 162
"ERASE" 166
"EDIT" 167
"ERROR" 168
"ERL" 214
"ERR" 215
"EXP" 011
"EOF" 047
"EQV" 250
"FOR" 130
"FIELD" 192
"FILES" 198
"FN" 211
"FRE" 015
"FIX" 031
"GOTO" 137
"GO TO" 137
"GOSUB" 141
"GET" 193
"HEX$" 026
"INPUT" 133
"IF" 139
"INSTR" 218
"INT" 005
"INP" 016
"IMP" 251
"KILL" 200
"LET" 136
"LINE" 177
"LOAD" 196
"LSET" 201
"LPRINT" 158
"LLIST" 159
"LPOS" 027
"LIST" 147
"LOG" 010
"LOC" 048
"LEN" 018
"LEFT$" 001
"LOF" 049
"MERGE" 197
"MOD" 252
"MKI$" 050
"MKS$" 051
"MKD$" 052
"MID$" 003
"NEXT" 131
"NULL" 150
"NAME" 199
"NEW" 148
"NOT" 213
"OUT" 157
"ON" 149
"OPEN" 191
"OR" 248
"OCT$" 025
"PUT" 194
"POKE" 153
"PRINT" 145
"POS" 017
"PEEK" 023
"READ" 135
"RUN" 138
"RESTORE" 140
"RETURN" 142
"REM" 143
"RESUME" 169
"RSET" 202
"RIGHT$" 002
"RND" 008
"RENUM" 172
"RESET" 204
"STOP" 144
"SAVE" 203
"SPC(" 212
"STEP" 209
"SGN" 004
"SQR" 007
"SIN" 009
"STR$" 019
"STRING$" 216
"SPACE$" 024
"SYSTEM" 189
"TRON" 163
"TROFF" 164
"TAB(" 208
"TO" 206
"THEN" 207
"TAN" 013
"USING" 217
"USR" 210
"VAL" 020
"VARPTR" 220
"WIDTH" 161
"WAIT" 151
"XOR" 249
"+" 242
"-" 243
"*" 244
"/" 245
"^" 246
"\" 253
"'" 219
">" 239
"=" 240
"<" 241
Cheers,
Chuck