Path: csiph.com!weretis.net!feeder6.news.weretis.net!news.misty.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Lieven Marchand Newsgroups: comp.compilers Subject: Re: A simpler way to tokenize and parse? Date: Sat, 25 Mar 2023 19:58:58 +0100 Organization: Compilers Central Sender: johnl@iecc.com Approved: comp.compilers@iecc.com Message-ID: <23-03-019@comp.compilers> References: <23-03-011@comp.compilers> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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 X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:3421 Roger L Costello 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.