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 MAA04085 for caml-redistribution; Thu, 12 Aug 1999 12:14:29 +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 XAA17501 for ; Tue, 3 Aug 1999 23:46:02 +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 XAA13680 for ; Tue, 3 Aug 1999 23:45:59 +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 RAA07888 for ; Tue, 3 Aug 1999 17:45:59 -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 RAA79568 for ; Tue, 3 Aug 1999 17:45:59 -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 RAA02205 for ; Tue, 3 Aug 1999 17:45:38 -0400 Message-Id: <199908032145.RAA02205@bismarck.chet.org> To: caml-list@inria.fr Subject: re-entrant CAMLYACC parsers? Date: Tue, 03 Aug 1999 17:45:38 -0400 Sender: weis 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? --chet-- P.S. I realize I could do this trivially with stream-parsers, but I'd prefer to write a yacc-parser for efficiency and declarativeness.