Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Christian Lindig <lindig@ips.cs.tu-bs.de>
To: John Skaller <skaller@maxtal.com.au>,
	Jean-Marc EBER <Jean-Marc.Eber@socgen.com>
Cc: Caml Mailing List <caml-list@inria.fr>
Subject: Re: lexer, parser
Date: Mon, 14 Jun 1999 09:15:43 +0200	[thread overview]
Message-ID: <19990614091543.A21998@ips.cs.tu-bs.de> (raw)
In-Reply-To: <3.0.6.32.19990603215554.0097b100@triode.net.au>; from John Skaller on Thu, Jun 03, 1999 at 09:55:54PM +1000

Quoting John Skaller (skaller@maxtal.com.au):
> I need to maintain state, but the component also need
> to be re-entrant.

Quoting Jean-Marc EBER (Jean-Marc.Eber@socgen.com):
> You should certainly be in contact with Christian Lindig, who has
> done interesting work on OCamlLex.
> 
> lindig@ips.cs.tu-bs.de
> http://www.cs.tu-bs.de/softech/people/lindig/index.html

Hi,

Like Jean-Marc Eber pointed out have I suggested two extension for
OCamlLex that makes maintaining state easier:

http://www.cs.tu-bs.de/softech/people/lindig/software/lex-patch.html

A patched version of OCamlLex allows for additional parameters to
rules:

    rule scan x y = parse 
    ...

Parameters like x and y make it easier to accumulate results across
many calls of the same or different rules in a lexer.  They help to
avoid global variables which make a scanner no longer re-entrant.

Using the patched version of OCamlLex is fairly uncritical because
only the generated code if different from the original version. 

Maintaining state across different invocations of a lexer requires
some more effort:

http://www.cs.tu-bs.de/softech/people/lindig/software/lexing.html

I have proposed a new Lexing module with a new `lexbuf' type.  The
lexbuf type is used by scanners to maintain state but currently does
not hold user provided state.  The proposed module permits to store
user state in lexbuf as well. 

Unfortunately is it not possible to simply exchange the new module for
the old.  The whole OCaml system must be recompiled with the new
module.  However, all old code compiles with the new system.

I still would like to see both proposals added to the OCaml system
since both are backward compatible at the source code level.

-- Christian

-- 
 Christian Lindig       Technische Universitaet Braunschweig, Germany
                        http://www.cs.tu-bs.de/softech/people/lindig
                        lindig@ips.cs.tu-bs.de phone:+49-531-391-3276




      parent reply	other threads:[~1999-06-14 15:46 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0580637621241002*/c=FR/admd=ATLAS/prmd=SG/o=INFI/s=EBER/g=JEAN-MARC/@MHS>
     [not found] ` <0579137620FCB001*/c=FR/admd=ATLAS/prmd=SG/o=INFI/s=EBER/g=JEAN-MARC/@MHS>
1999-06-03 11:55   ` John Skaller
1999-06-12 12:02     ` Markus Mottl
1999-06-15  2:01       ` Jacques GARRIGUE
1999-06-15 10:20         ` Markus Mottl
1999-06-14  7:15     ` Christian Lindig [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=19990614091543.A21998@ips.cs.tu-bs.de \
    --to=lindig@ips.cs.tu-bs.de \
    --cc=Jean-Marc.Eber@socgen.com \
    --cc=caml-list@inria.fr \
    --cc=skaller@maxtal.com.au \
    /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