From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA14309 for caml-redistribution; Sun, 22 Aug 1999 20:15:02 +0200 (MET DST) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id XAA03302 for ; Fri, 13 Aug 1999 23:19:30 +0200 (MET DST) Received: from igw3.watson.ibm.com (igw3.watson.ibm.com [198.81.209.18]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id XAA15424 for ; Fri, 13 Aug 1999 23:19:29 +0200 (MET DST) From: chet@watson.ibm.com Received: from mailhub.watson.ibm.com (mailhub.watson.ibm.com [9.2.250.97]) by igw3.watson.ibm.com (8.9.3/8.9.3/05-14-1999) with ESMTP id RAA09910; Fri, 13 Aug 1999 17:19:21 -0400 Received: from bismarck.chet.org (root@nyc-46.nyc.ibm.com [9.38.112.46]) by mailhub.watson.ibm.com (8.8.7/Feb-20-98) with ESMTP id RAA20676; Fri, 13 Aug 1999 17:19:20 -0400 Received: from bismarck.chet.org (chet@localhost [127.0.0.1]) by bismarck.chet.org (8.8.8/8.8.8/Debian/GNU) with ESMTP id RAA01096; Fri, 13 Aug 1999 17:18:57 -0400 Message-Id: <199908132118.RAA01096@bismarck.chet.org> To: Gerd.Stolpmann@darmstadt.netsurf.de cc: chet@watson.ibm.com, caml-list@inria.fr Subject: Re: re-entrant CAMLYACC parsers? In-reply-to: Your message of "Fri, 13 Aug 1999 21:52:00 +0200." <99081322272704.00491@schneemann> Date: Fri, 13 Aug 1999 17:18:57 -0400 Sender: weis 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 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!