Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.compilers > #3421

Re: A simpler way to tokenize and parse?

From Lieven Marchand <mal@wyrd.be>
Newsgroups comp.compilers
Subject Re: A simpler way to tokenize and parse?
Date 2023-03-25 19:58 +0100
Organization Compilers Central
Message-ID <23-03-019@comp.compilers> (permalink)
References <23-03-011@comp.compilers>

Show all headers | View raw


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.

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

A simpler way to tokenize and parse? Roger L Costello <costello@mitre.org> - 2023-03-24 14:45 +0000
  Re: Lisp syntax, was A simpler way to tokenize and parse? Spiros Bousbouras <spibou@gmail.com> - 2023-03-25 11:55 +0000
    Re: Lisp syntax, was A simpler way to tokenize and parse? gah4 <gah4@u.washington.edu> - 2023-03-25 14:32 -0700
  Re: Lisp syntax, was A simpler way to tokenize and parse? anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2023-03-25 13:14 +0000
    Re: Lisp syntax, was A simpler way to tokenize and parse? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-03-26 00:46 +0000
  Re: A simpler way to tokenize and parse? Lieven Marchand <mal@wyrd.be> - 2023-03-25 19:58 +0100
    Re: A simpler way to tokenize and parse? Spiros Bousbouras <spibou@gmail.com> - 2023-03-26 14:10 +0000
    Re: A simpler way to tokenize and parse? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-03-26 18:19 +0000
      Re: Lisp syntax, A simpler way to tokenize and parse? Lieven Marchand <mal@wyrd.be> - 2023-03-27 23:15 +0200
  Re: A simpler way to tokenize and parse? Kaz Kylheku <864-117-4973@kylheku.com> - 2023-03-26 01:17 +0000

csiph-web