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.1 required=5.0 tests=AWL 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 572B9BC69 for ; Wed, 28 Mar 2007 12:53:59 +0200 (CEST) Received: from mcr-smtp-002.bulldogdsl.com (smtp.bulldogdsl.com [212.158.248.8]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l2SArwNF000837 for ; Wed, 28 Mar 2007 12:53:59 +0200 Received: by mcr-smtp-002.bulldogdsl.com (Postfix, from userid 1010) id B4B0284614B; Wed, 28 Mar 2007 11:53:58 +0100 (BST) Received: from [192.168.123.191] (host-84-9-232-30.bulldogdsl.com [84.9.232.30]) by mcr-smtp-002.bulldogdsl.com (Postfix) with ESMTP id 2C966846093 for ; Wed, 28 Mar 2007 11:53:57 +0100 (BST) Message-ID: <460A4685.5080801@ed.ac.uk> Date: Wed, 28 Mar 2007 11:42:13 +0100 From: Jeremy Yallop User-Agent: Icedove 1.5.0.10 (X11/20070307) MIME-Version: 1.0 To: Caml List Subject: Re: [Caml-list] Passing arguments to a parser generated by ocamlyacc References: <7DC28F6C-1A47-4F3C-86C7-1B1BA76BE487@gmail.com> In-Reply-To: <7DC28F6C-1A47-4F3C-86C7-1B1BA76BE487@gmail.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 460A4946.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; parser:01 ocamlyacc:01 parser:01 ocamlyacc:01 ocamllex:01 symtab:01 symtab:01 workarounds:01 lexer:01 wrote:01 token:01 token:01 caml-list:01 let:03 passing:04 Joel Reymont wrote: > I need to pass a symbol table to the parser generated by ocamlyacc. I > can do this fine with ocamllex and thought I could do the following for > ocamlyacc: > > %start program > %type Easy.program> program > > It doesn't work, unfortunately. Are there any workarounds? One possible solution is to pass it as part of the value of each token returned by the lexer, e.g. %token TOKEN ... some_rule: TOKEN ... { let symtab = $1 in ... } Jeremy.