Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Joel Reymont <joelr1@gmail.com>
To: Francois.Pottier@inria.fr
Cc: Caml List <caml-list@inria.fr>,
	skaller <skaller@users.sourceforge.net>,
	menhir-list@yquem.inria.fr
Subject: Re: [Menhir-list] There's an elephant in the room: Solution to sharing a symbol table
Date: Wed, 2 May 2007 06:58:47 +0100	[thread overview]
Message-ID: <8C011A98-CE76-4A83-B24C-BA37B66DF15D@gmail.com> (raw)
In-Reply-To: <20070502054411.GB726@yquem.inria.fr>


On May 2, 2007, at 6:44 AM, Francois Pottier wrote:

> Functors can be applied at run-time (via "let module"), so a  
> functor parameter
> *can* provide a parser with runtime information. I would still  
> recommend the
> %parameter approach, since it is syntactically lighter and more  
> efficient (the
> semantic actions won't be delayed).

I have been butting my head against this for a few days now. Please,  
please provide an example!!! I'm not talking about a general example  
of a %parameter approach but an example of using that approach with a  
lexer.

Consider this function that should parser a string and return an AST:

let parse str =
   let lexbuf = Lexing.from_string str in
   program (token tab) lexbuf

The token lexer above takes a tab argument before lexbuf but program  
always expects (Lexing.lexbuf -> token) so we give program the  
curried function.

How do you write parse above with the %parameter approach to ensure  
that parse ALWAYS uses a new symbol table that is shared between the  
lexer and the parser in this parsing run?

	Thanks, Joel

--
http://wagerlabs.com/






  reply	other threads:[~2007-05-02  5:58 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-05-01 21:39 Joel Reymont
2007-05-02  5:44 ` [Menhir-list] " Francois Pottier
2007-05-02  5:58   ` Joel Reymont [this message]
     [not found]     ` <20070502070345.GA5242@yquem.inria.fr>
2007-05-02  7:35       ` Joel Reymont
2007-05-02  9:04     ` [Caml-list] " skaller
2007-05-02 11:56       ` Francois Pottier
2007-05-02 16:07         ` skaller
2007-05-02 18:30           ` Francois Pottier
2007-05-03  1:17             ` skaller
2007-05-03  8:48               ` Joel Reymont

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=8C011A98-CE76-4A83-B24C-BA37B66DF15D@gmail.com \
    --to=joelr1@gmail.com \
    --cc=Francois.Pottier@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=menhir-list@yquem.inria.fr \
    --cc=skaller@users.sourceforge.net \
    /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