From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 2FA23BB9C for ; Mon, 5 Dec 2005 09:52:59 +0100 (CET) Received: from smtp1.adl2.internode.on.net (smtp1.adl2.internode.on.net [203.16.214.181]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id jB58qvd2009313 for ; Mon, 5 Dec 2005 09:52:58 +0100 Received: from rosella (ppp33-4.lns1.syd2.internode.on.net [59.167.33.4] (may be forged)) by smtp1.adl2.internode.on.net (8.12.9/8.12.6) with ESMTP id jB58qnCW010788; Mon, 5 Dec 2005 19:22:50 +1030 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] Another nasty with ocamlyacc: magic needed? From: skaller To: Alessandro Baretta Cc: caml-list@yquem.inria.fr In-Reply-To: <4393E75C.9000608@barettadeit.com> References: <1133760933.8957.125.camel@rosella> <4393E75C.9000608@barettadeit.com> Content-Type: text/plain Date: Mon, 05 Dec 2005 19:52:49 +1100 Message-Id: <1133772769.8957.168.camel@rosella> Mime-Version: 1.0 X-Mailer: Evolution 2.4.1 Content-Transfer-Encoding: 7bit X-Miltered: at nez-perce with ID 4393FFE9.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocamlyacc:01 baretta:01 showstopper:01 parsers:01 tokens:01 yup:01 parser:01 parser:01 grammar:01 lexer:01 ocamlyacc:01 ocamlc:01 wrote:01 wrote:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Mon, 2005-12-05 at 08:08 +0100, Alessandro Baretta wrote: > skaller wrote: > > I have what looks like a showstopper (meaning black magic > > seems to be the only solution). > > > > I need two *distinct* parsers which use the same set > > of tokens. This is currently impossible AFAICS without > > magic (distinct -- in a different module entirely) > Let's not overstate the problem. Yacc is an imperfect tool. Yup :) > Firstly, remember that can > define as many parser entry points as your heat desires. I do. It is useful. But the secondary parser is an RD parser interpreter. The idea isn't to allow arbitrary grammar extensions .. only to make particular yacc productions open-recursive closed by the dynamically built table of extensions. Thus the RD parser calls back into yacc entry points, and, the yacc productions call into the RD parser entry points. This is organised via the lexer. > Secondly, after compiling the automaton with ocamlyacc, you can always > delete and regenerate the interface with ocamlc -i. Yes, that is possible, but the result is contains undesired entry points (tables and whatnot). It also isn't clear how good a solution this is if I have to paste many other modules into it -- I can always build the whole program as a single module :) -- John Skaller Felix, successor to C++: http://felix.sf.net