English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
There's an elephant in the room: Solution to sharing a symbol table
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-05-02 (09:04)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Re: [Menhir-list] There's an elephant in the room: Solution to sharing a symbol table
On Wed, 2007-05-02 at 06:58 +0100, Joel Reymont wrote:
> On May 2, 2007, at 6:44 AM, Francois Pottier wrote:

> 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?

You can't. Don't be confused by functor interface in Menhir. 
It is useless for maintaining state.

What you need is a feature I asked for .. the possibility of
passing a state argument to the parser the same way you can
now do for ocamllex: you just write

	rule fred state = parse ...

and now 'state' is passed to all actions. That's ocamllex,
we need the same for parsing.

[I thought this was implemented but can't see it anywhere
in the Menhir manual]

This IS a way to hack this .. by using the ocamllex feature
and cheating by wrapping stuff inside tokens so that
the parser user actions can get at the state object.

John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net