Re: A simpler way to tokenize and parse?

Lieven Marchand <mal@wyrd.be>
Sat, 25 Mar 2023 19:58:58 +0100

          From comp.compilers

Related articles
A simpler way to tokenize and parse? costello@mitre.org (Roger L Costello) (2023-03-24)
Re: A simpler way to tokenize and parse? mal@wyrd.be (Lieven Marchand) (2023-03-25)
Re: A simpler way to tokenize and parse? 864-117-4973@kylheku.com (Kaz Kylheku) (2023-03-26)
Re: A simpler way to tokenize and parse? spibou@gmail.com (Spiros Bousbouras) (2023-03-26)
Re: A simpler way to tokenize and parse? christopher.f.clark@compiler-resources.com (Christopher F Clark) (2023-03-26)
Re: A simpler way to tokenize and parse? 864-117-4973@kylheku.com (Kaz Kylheku) (2023-03-26)
Re: A simpler way to tokenize and parse? tkoenig@netcologne.de (Thomas Koenig) (2023-03-27)
Re: Lisp syntax, A simpler way to tokenize and parse? mal@wyrd.be (Lieven Marchand) (2023-03-27)
| List of all articles for this month |

From: Lieven Marchand <mal@wyrd.be>
Newsgroups: comp.compilers
Date: Sat, 25 Mar 2023 19:58:58 +0100
Organization: Compilers Central
References: 23-03-011
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="31968"; mail-complaints-to="abuse@iecc.com"
Keywords: Lisp, syntax
Posted-Date: 26 Mar 2023 05:14:12 EDT

Roger L Costello <costello@mitre.org> writes:


> I have done some work with Flex and Bison and recently I've done some work
> with building parsers using read. My experience is the latter is much easier.
> Why isn't read more widely discussed and used in the compiler community?
> Surely the concept that read embodies is not specific to Lisp and Scheme,
> right?


Apart from the already mentioned problem that it forces you into a
syntax that a lot of people don't like, there's also the problem that
you have to deal with hostile input. Where you expect "(+ 2 3)" someone
will enter "(+ 2 3 #.(progn (launch-the-nukes) 4))". A lot of security
problems in real world settings come from not correctly validating
inputs and by the time you have worked around all these problems read
isn't all that easy anymore. C for example has a somewhat similar
facility scanf that tries to pattern match input and is also considered
unsafe. A good rule of thumb for production ready software is to define
a grammar for valid input and provide a validating parser.


--
Laat hulle almal sterf. Ek is tevrede om die wêreld te sien brand en die vallende
konings te spot. Ek en my aasdier sal loop op die as van die verwoeste aarde.



Post a followup to this message

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