Version française
Home     About     Download     Resources     Contact us    
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: -- (:)
From: Joel Reymont <joelr1@g...>
Subject: Re: [Menhir-list] There's an elephant in the room: Solution to sharing a symbol table

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/