Re: Languages with optional spaces

Martin Ward <martin@gkc.org.uk>
Tue, 25 Feb 2020 17:00:57 +0000

          From comp.compilers

Related articles
Languages with optional spaces maury.markowitz@gmail.com (Maury Markowitz) (2020-02-19)
Re: Languages with optional spaces awanderin@gmail.com (Jerry) (2020-02-20)
Re: Languages with optional spaces drikosev@gmail.com (Ev. Drikos) (2020-02-23)
Re: Languages with optional spaces maury.markowitz@gmail.com (Maury Markowitz) (2020-02-25)
Re: Languages with optional spaces maury.markowitz@gmail.com (Maury Markowitz) (2020-02-25)
Re: Languages with optional spaces martin@gkc.org.uk (Martin Ward) (2020-02-25)
Re: Languages with optional spaces 493-878-3164@kylheku.com (Kaz Kylheku) (2020-02-26)
Re: Languages with optional spaces awanderin@gmail.com (awanderin) (2020-02-26)
Re: Languages with optional spaces drikosev@gmail.com (Ev. Drikos) (2020-02-28)
Re: Languages with optional spaces christopher.f.clark@compiler-resources.com (Christopher F Clark) (2020-02-29)
Re: Languages with optional spaces drikosev@gmail.com (Ev. Drikos) (2020-02-29)
Re: Languages with optional spaces DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2020-03-01)
[9 later articles]
| List of all articles for this month |

From: Martin Ward <martin@gkc.org.uk>
Newsgroups: comp.compilers
Date: Tue, 25 Feb 2020 17:00:57 +0000
Organization: Compilers Central
References: 20-02-015 20-02-017
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="4024"; mail-complaints-to="abuse@iecc.com"
Keywords: lex, Basic, history
Posted-Date: 27 Feb 2020 17:33:10 EST
In-Reply-To: 20-02-017

On 23/02/20 10:33, Ev. Drikos wrote:
> [You can try start states but in my experience if the tokenizing rules
> are very context sensitive, it's easier to give up and hand-code the
> lexer. The lexical syntax of Basic isn't that big. -John]


The BASIC for the Compukit UK101 and Ohio Superboard stores
each line as a sequence of characters. As a line is entered
any keywords appearing anywhere on the line are replaced
by control characters. Keywords are not allowed anywhere
within a variable name. So any statement either starts
with a keyword (a control character), which determines
the statement type, or it is an assignment with the LET
keyword omitted.


Due to the small amount of memory available, variable names
are typically kept short and spaces are omitted. Short variable
names are less likely to include an embedded keyword.
Also, only the first two characters of a variable name are significant.
The program will also run faster with short variable names:
since the BASIC interpreter scans each line as it is interpreted.


More information and some sample BASIC software:


http://www.gkc.org.uk/martin/software/#UK101


A procedurally generated, open world, RTS (real time strategy) game
with destructable environments which runs in 8K of RAM:


http://www.gkc.org.uk/martin/software/startrek.html


--
Martin


Dr Martin Ward | Email: martin@gkc.org.uk | http://www.gkc.org.uk
G.K.Chesterton site: http://www.gkc.org.uk/gkc | Erdos number: 4


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.