caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christian RINDERKNECHT <rinderkn@hugo.int-evry.fr>
To: Vesa Karvonen <vesa.karvonen@housemarque.fi>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] On ocamlyacc and ocamllex
Date: Mon, 24 Sep 2001 03:05:55 +0200	[thread overview]
Message-ID: <20010924030555.A15441@hugo.int-evry.fr> (raw)
In-Reply-To: <000b01c143aa$d5218690$422aa8c0@housemarque.fi>; from Vesa Karvonen on Sun, Sep 23, 2001 at 12:09:14AM +0300

Hi,

Vesa Karvonen wrote:
> Currently the generated lexer is dependent on the parser, because the
> parser generates the token type. This means that each time the grammar is
> modified, but not the token definitions, the lexer is recompiled. 

Sometimes ago, I wrote a software handling more than six lexers and
parsers, and hence maintenance was complex. So I decided to enhance
ocamllex with the following facilities through the command-line: 

  (1) It can produce a functorized lexer whose argument defines the
      tokens. You need to use to same %token clauses as in ocamlyacc.
      This way different parsers can share the same lexer (the only
      constraint is that the %token clause in the ocamllyacc-generated
      parsers must be given in the same order).

  (2) It is possible to specify a signature to be shared among
      different generated lexers.

  (3) If you don't want a functorized lexer to be produced, you can
      nevertheless specify the module defining the tokens (not
      necessarily the ocamlyacc-generated parser). This allows you to
      produce from the same ocamllex specification either a
      functorized lexer or a non-functorized lexer.

  (3bis) You can even allow the functorized lexer to import a module
      whose signature is given by a new clause: %import.

Note also that:

  (4) By default, the behaviour is exactly the same as for the
      distributed ocamllex.

  (5) I integrated the patch of Christian Lindig, allowing you to give
      arguments to your lexing rules (e.g. rule skip_line (loc) =
      parse ...). In think this will help you to write functionnal
      lexers in a readable way.

  (6) I documented the options in an enhanced version of the man page.

  (7) It is up-to-date with respect to the latest distribution of
      ocamllex. 

If you are interested, please send me an e-mail.

Best regards,

-- 

Christian

------------------------------------------------------------------------
Christian Rinderknecht                     Phone  +82 42 866 6147
Network Architecture Laboratory            Fax    +82 42 866 6154
Information and Communications University  WWW    http://nalab.icu.ac.kr
58-4 Hwaam-dong, Yuseong-gu, Daejeon,      e-mail rinderkn@icu.ac.kr
305-752, Korea
-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  parent reply	other threads:[~2001-09-24  8:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-09-22 21:09 Vesa Karvonen
2001-09-23  1:10 ` Christian Lindig
2001-09-23 16:27   ` Vesa Karvonen
2001-09-23 17:44     ` Christian Lindig
2001-09-23 19:32       ` Vesa Karvonen
2001-09-23 20:09         ` Christian Lindig
2001-09-23 20:51           ` Vesa Karvonen
2001-10-22 17:09           ` John Max Skaller
2001-10-22 16:47       ` John Max Skaller
2001-09-24  1:05 ` Christian RINDERKNECHT [this message]
2001-09-24 11:17   ` Vesa Karvonen
2001-10-22 17:24     ` John Max Skaller

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=20010924030555.A15441@hugo.int-evry.fr \
    --to=rinderkn@hugo.int-evry.fr \
    --cc=caml-list@inria.fr \
    --cc=vesa.karvonen@housemarque.fi \
    /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).