Re: Languages with optional spaces

Maury Markowitz <maury.markowitz@gmail.com>
Tue, 25 Feb 2020 06:11:18 -0800 (PST)

          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)
[11 later articles]
| List of all articles for this month |

From: Maury Markowitz <maury.markowitz@gmail.com>
Newsgroups: comp.compilers
Date: Tue, 25 Feb 2020 06:11:18 -0800 (PST)
Organization: Compilers Central
References: 20-02-015
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="43974"; mail-complaints-to="abuse@iecc.com"
Keywords: Basic, lex, comment
Posted-Date: 25 Feb 2020 10:47:06 EST
In-Reply-To: 20-02-015

So it seems the most basic answer is "no, it won't do that". Perhaps this should be a feature? "Tokens are immediate terminals" or somesuch.


I originally chose flex/bison because it is widely available on almost any platform (although on Windows it is sub-optimal) and I found a reasonable BASIC starting point online.


In any event, it does seem the practical solution is to make my own lexer. Luckily there are any number that exist already in cross-platform form.


Perhaps you all have some starting points I should look at? I'm most interested in plain C although I am definitely going to look at Jerry's code.
[Writing a lexer for Basic shouldn't be very hard since the token structure is pretty straightforward. The hardest part
is being sure you detect and deal with invalid input in all the places it can occur. C lexers tend to be loops with
big switch statements on the input characters, and you need to remember to have a default in all of them. -John]


Post a followup to this message

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