|[10 earlier articles]|
|Re: Languages with optional spaces email@example.com (Ev. Drikos) (2020-02-29)|
|Re: Languages with optional spaces DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2020-03-01)|
|Re: Languages with optional spaces firstname.lastname@example.org (Christopher F Clark) (2020-03-01)|
|Re: Languages with optional spaces email@example.com (Ev. Drikos) (2020-03-01)|
|Re: Languages with optional spaces firstname.lastname@example.org (Christopher F Clark) (2020-03-02)|
|Re: Languages with optional spaces email@example.com (Ev. Drikos) (2020-03-02)|
|Re: Languages with optional spaces firstname.lastname@example.org (2020-03-02)|
|Re: Languages with optional spaces email@example.com (Ev. Drikos) (2020-03-12)|
|Date:||Mon, 2 Mar 2020 21:12:23 -0800 (PST)|
|Injection-Info:||gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="44923"; mail-complaints-to="firstname.lastname@example.org"|
|Keywords:||lex, Basic, history|
|Posted-Date:||05 Mar 2020 12:06:41 EST|
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:
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:
and the PC-BASIC manual:
(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.
Return to the
Search the comp.compilers archives again.