caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: skaller <skaller@maxtal.com.au>
To: frouaix@liquidmarket.com
Cc: caml-list@inria.fr
Subject: Re: ocamlyacc/lex reentrancy
Date: Fri, 31 Dec 1999 06:09:39 +1100	[thread overview]
Message-ID: <386BADF3.80F07395@maxtal.com.au> (raw)
In-Reply-To: <199912301830.KAA12278@fiji01.liquidmarket.com>

Francois Rouaix wrote:
> 
> 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

	Ahhhh! Thank you. I see how this works.

-- 
John Skaller, mailto:skaller@maxtal.com.au
10/1 Toxteth Rd Glebe NSW 2037 Australia
homepage: http://www.maxtal.com.au/~skaller
voice: 61-2-9660-0850




  reply	other threads:[~2000-01-01  1:32 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
1999-12-30 19:09   ` skaller [this message]
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=386BADF3.80F07395@maxtal.com.au \
    --to=skaller@maxtal.com.au \
    --cc=caml-list@inria.fr \
    --cc=frouaix@liquidmarket.com \
    /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).