caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Rouaix <Francois.Rouaix@inria.fr>
To: Christian Lindig <lindig@ips.cs.tu-bs.de>
Cc: caml-list@pauillac.inria.fr
Subject: Re: scanning and parsing short strings
Date: Thu, 17 Jul 1997 18:22:33 +0200	[thread overview]
Message-ID: <199707171622.SAA05148@madiran.inria.fr> (raw)
In-Reply-To: Your message of "Thu, 10 Jul 1997 16:42:52 +0200." <199707101442.QAA15363@infbsst5.ips.cs.tu-bs.de>

> many applications rely on protocols which they must parse. This can
> be either done ad hoc using regular expressions or scanner/parser
> generated by Camllex/yacc. Which method is advisable when the scanned
> items are relative short strings (< 100 Bytes)?
[...]
> The background of my question: I like to implement a CGI library.
> I already took a look at the MMM code which uses a mixed approach. 

I can't give performance comparisons, but here are some personal appreciations
on the various solutions.
* regular expressions dont scale
It's probably all right for CGI headers because these are small one-line
inputs, and their syntax is essentially trivial, but then it's also error
prone (you rarely write the correct pattern at once). Then, libstr also 
requires building custom binaries which make bigger applications (at least
with the bytecode compiler).
* camllex is easy. Besides lexical analysis, it can also handle simple
parsing strategies, such as recursive descent
* yacc (and therefore camlyacc) is a pain, and will always be. Moreover,
error handling is not that easy.

Also, streams and parsers are a possible alternative to camllex/yacc, although
here you will loose some speed.

--f








      reply	other threads:[~1997-07-17 16:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-07-10 14:42 Christian Lindig
1997-07-17 16:22 ` Francois Rouaix [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=199707171622.SAA05148@madiran.inria.fr \
    --to=francois.rouaix@inria.fr \
    --cc=caml-list@pauillac.inria.fr \
    --cc=lindig@ips.cs.tu-bs.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).