From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id B12F9BC6C; Wed, 2 May 2007 11:04:57 +0200 (CEST) Received: from ipmail01.adl2.internode.on.net (ipmail01.adl2.internode.on.net [203.16.214.140]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l4294t4C021120; Wed, 2 May 2007 11:04:56 +0200 X-IronPort-AV: E=Sophos;i="4.14,478,1170595800"; d="scan'208";a="122333862" Received: from ppp8-148.lns1.syd7.internode.on.net (HELO [192.168.1.201]) ([59.167.8.148]) by ipmail01.adl2.internode.on.net with ESMTP; 02 May 2007 18:34:54 +0930 Subject: Re: [Caml-list] Re: [Menhir-list] There's an elephant in the room: Solution to sharing a symbol table From: skaller To: Joel Reymont Cc: Francois.Pottier@inria.fr, menhir-list@yquem.inria.fr, Caml List In-Reply-To: <8C011A98-CE76-4A83-B24C-BA37B66DF15D@gmail.com> References: <1EE80473-541D-478D-97F8-06A1B5F65F79@gmail.com> <20070502054411.GB726@yquem.inria.fr> <8C011A98-CE76-4A83-B24C-BA37B66DF15D@gmail.com> Content-Type: text/plain Date: Wed, 02 May 2007 19:04:50 +1000 Message-Id: <1178096690.13660.80.camel@rosella.wigram> Mime-Version: 1.0 X-Mailer: Evolution 2.10.1 Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 46385437.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; 0100,:01 lexer:01 parser:01 parsing:01 functor:01 parser:01 ocamllex:01 ocamllex:01 parsing:01 tokens:01 elephant:98 2007,:98 sourceforge:01 wrote:01 wrote:01 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 Felix, successor to C++: http://felix.sf.net