Re: re-entrant CAMLYACC parsers?

From: chet@watson.ibm.com
Date: Fri Aug 13 1999 - 23:18:57 MET DST


From: chet@watson.ibm.com
Message-Id: <199908132118.RAA01096@bismarck.chet.org>
To: Gerd.Stolpmann@darmstadt.netsurf.de
Subject: Re: re-entrant CAMLYACC parsers?
Date: Fri, 13 Aug 1999 17:18:57 -0400

How amusing! I'm hacking an XML parser in CAML, too!

It sure was easy!

I ended up hacking caml-yacc to do it -- added a slot in the
parser_env, and a method to fetch the slot in parser actions.

--chet--
>>>>> "GS" == Gerd Stolpmann <Gerd.Stolpmann@darmstadt.netsurf.de> writes:

    GS> On Tue, 03 Aug 1999, chet@watson.ibm.com wrote:
>> How do most people implement re-entrancy in caml-yacc parsers
>> which must manipulate side-state? E.g., if I want to have some
>> hashtable to store a mapping from name to right-hand-side,
>> which the lexer will expand dynamically and push back onto the
>> lexbuf (I've enclosed the code I use to do that -- it looks
>> right, and it works, but I'm not certain that I got the
>> semantics of Lexing.lexbuf down), it'd be nice to store that
>> someplace on the stack, so that I don't have to count on
>> serialization of calls to the parser.
>>
>> I've thought about hacking Parsing to have an extra slot in the
>> parsing_env record, of polymorphic type, and then adding some
>> syntax to the caml-yacc language to fetch that value.
>>
>> Anybody done anything like this?
>>
 
    GS> I had recently the same problem for my XML parser (BTW: will
    GS> be available soon). The idea is simple: make the parser an
    GS> object!



This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:24 MET