Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2478
| From | gah4@u.washington.edu |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Languages with optional spaces |
| Date | 2020-03-02 21:12 -0800 |
| Organization | Compilers Central |
| Message-ID | <20-03-007@comp.compilers> (permalink) |
| References | <20-02-015@comp.compilers> |
On Wednesday, February 19, 2020 at 8:24:02 AM UTC-8, Maury Markowitz wrote: > I'm trying to write a lex/yacc (flex/bison) interpreter for classic BASICs > like the original DEC/MS, HP/DG etc. > I have it mostly working for a good chunk > of 101 BASIC Games (DEF FN is the last feature to add). > Then I got to Super Star Trek. To save memory, SST removes most spaces, so > lines look like this: > 100FORI=1TO10 The first BASIC systems I ever used were the HP TSB2000 systems that were very popular in the 1970's. These systems tokenize each line on entry, and also syntax check it. If a line fails, it isn't even stored. Extra spaces or none, the line is stored the same way. (And this is the system that many of the original Star Trek games were written on.) Also, numeric constants are converted to their internal representation. The LIST command converts the tokenized form back to text form, and adds appropriate blank space. Note also that the TSB2000 systems only allow the traditional single letter, or number-digit, form for variable names. The microcomputer BASIC systems that I remember tokenize lines, but don't do any more checking on them. As noted, blanks are stored and used when the LIST command displays the program. Looking at the GW-BASIC manual: http://www.divonasperi.it/divona/tam/tecnologia/dow-all/GW%20Basic%20(inglese).pdf and the PC-BASIC manual: https://robhagemans.github.io/pcbasic/doc/1.2/#memory (the latter intended to be bug-for-bug compatible with the MS version.) I don't see in either manual mention of the effects, or lack thereof, of blanks in statements. There is explanation of reserved words, and their possible use in variable names. It seems to me that the treatment of missing blanks is an accident of the parser design. Bug-for-bug emulation, then, needs to find all those accidents and implement them.
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
Languages with optional spaces Maury Markowitz <maury.markowitz@gmail.com> - 2020-02-19 07:35 -0800
Re: Languages with optional spaces Jerry <awanderin@gmail.com> - 2020-02-20 23:38 -0700
Re: Languages with optional spaces Maury Markowitz <maury.markowitz@gmail.com> - 2020-02-25 06:13 -0800
Re: Languages with optional spaces awanderin <awanderin@gmail.com> - 2020-02-26 10:03 -0700
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-03-12 17:45 +0200
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-02-23 12:33 +0200
Re: Languages with optional spaces Martin Ward <martin@gkc.org.uk> - 2020-02-25 17:00 +0000
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-02-28 13:34 +0200
Re: Languages with optional spaces Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2020-02-29 11:48 +0200
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-02-29 21:38 +0200
Re: Languages with optional spaces Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2020-03-01 10:07 +0200
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-03-01 19:41 +0200
Re: Languages with optional spaces Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2020-03-02 08:33 +0200
Re: Languages with optional spaces "Ev. Drikos" <drikosev@gmail.com> - 2020-03-02 20:04 +0200
Re: Languages with optional spaces Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-03-01 00:28 +0100
Re: Languages with optional spaces Maury Markowitz <maury.markowitz@gmail.com> - 2020-02-25 06:11 -0800
Re: Languages with optional spaces Kaz Kylheku <493-878-3164@kylheku.com> - 2020-02-26 08:06 +0000
Re: Languages with optional spaces and tools Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-02-28 20:16 +0100
Re: Languages with optional spaces gah4@u.washington.edu - 2020-03-02 21:12 -0800
Re: Languages with optional spaces Gene <gene.ressler@gmail.com> - 2020-04-14 10:08 -0700
Re: Languages with optional spaces mertesthomas@gmail.com - 2020-04-19 04:04 -0700
Re: Languages with optional spaces aston.goldsmith@gmail.com - 2020-05-05 13:05 -0700
csiph-web