caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jeremy Yallop <jeremy.yallop@ed.ac.uk>
To: Caml List <caml-list@inria.fr>
Subject: Re: [Caml-list] Passing arguments to a parser generated by ocamlyacc
Date: Wed, 28 Mar 2007 11:42:13 +0100	[thread overview]
Message-ID: <460A4685.5080801@ed.ac.uk> (raw)
In-Reply-To: <7DC28F6C-1A47-4F3C-86C7-1B1BA76BE487@gmail.com>

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 <Symtab.symtab -> 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 <Symtab.symtab> TOKEN

    ...
    some_rule:
      TOKEN ...    { let symtab = $1 in ... }

Jeremy.


      reply	other threads:[~2007-03-28 10:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-28 10:25 Joel Reymont
2007-03-28 10:42 ` Jeremy Yallop [this message]

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=460A4685.5080801@ed.ac.uk \
    --to=jeremy.yallop@ed.ac.uk \
    --cc=caml-list@inria.fr \
    /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).