Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Martin Ward Newsgroups: comp.compilers Subject: Re: Languages with optional spaces Date: Tue, 25 Feb 2020 17:00:57 +0000 Organization: Compilers Central Lines: 35 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <20-02-020@comp.compilers> References: <20-02-015@comp.compilers> <20-02-017@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com In-Reply-To: <20-02-017@comp.compilers> Xref: csiph.com comp.compilers:2458 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