caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Francois Rouaix <frouaix@liquidmarket.com>
To: skaller <skaller@maxtal.com.au>
Cc: caml-list@inria.fr
Subject: Re: ocamlyacc/lex reentrancy
Date: Thu, 30 Dec 1999 10:30:39 -0800	[thread overview]
Message-ID: <199912301830.KAA12278@fiji01.liquidmarket.com> (raw)
In-Reply-To: Your message of "Sat, 25 Dec 1999 08:31:11 +1100." <3863E61F.E27029EF@maxtal.com.au>

I don't use ocamlyacc,  but I do have lots of ocamllex lexers that need
to be reentrant. I don't remember if I've  posted that trick to the list
already, but this is what you can do:

In your opening section of the lexer:

{
type t = <something to store the data>

let create_data () = ....    (* unit -> t *)

}

and then for all rules, use

rule somerule = parse
 | somepattern { (fun lexdata -> action) }


And, when invoking a lexer function or entry point,  you need to pass the
additionnal argument, a in
  somerule lexbuf lexdata

--f


  reply	other threads:[~1999-12-30 18:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-24 21:31 skaller
1999-12-30 18:30 ` Francois Rouaix [this message]
1999-12-30 19:09   ` skaller
2000-01-03  9:46     ` Markus Mottl

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=199912301830.KAA12278@fiji01.liquidmarket.com \
    --to=frouaix@liquidmarket.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;
as well as URLs for NNTP newsgroup(s).