From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA04983; Thu, 7 Feb 2002 15:03:17 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA05292 for ; Thu, 7 Feb 2002 15:03:16 +0100 (MET) Received: from smtp2.cswv.com (smtp2.cswv.com [4.17.129.20]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g17E3F905323 for ; Thu, 7 Feb 2002 15:03:15 +0100 (MET) Received: from smtp2.cswv.com ([10.2.3.6]) by smtp2.cswv.com with Microsoft SMTPSVC(5.5.1877.197.19); Thu, 7 Feb 2002 09:03:08 -0500 Received: FROM exchange1.cswv.com BY smtp2.cswv.com ; Thu Feb 07 09:03:08 2002 -0500 Received: by exchange1.cswv.com with Internet Mail Service (5.5.2653.19) id ; Thu, 7 Feb 2002 09:08:50 -0500 Message-ID: From: "Krishnaswami, Neel" To: caml-list@inria.fr Subject: Re: [Caml-list] Camlp4 "vs" JSE Date: Thu, 7 Feb 2002 09:08:50 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Daniel de Rauglaudre [mailto:daniel.de_rauglaudre@inria.fr] wrote: > On Wed, Feb 06, 2002 at 02:14:13PM -0800, Chris Hecker wrote: > > > What does that mean, "can't guarantee parseability?" > > Camlp4 is a preprocessor which parses, respecting a "grammar" (it's > why they say "grammar-based"), what sed or /lib/cpp don't really do: > they just look at what is interesting for them, even if the rest is > not correct C. > > Well, it is the way I interpreted what they said. I don't think this is it. The way I interpreted it is that Camlp4 works basically by letting the user add productions to the grammar. However, it looks like you can make Camlp4 crash at runtime by adding insufficiently left-factored grammar rules, since it uses recursive descent parsing. (Can you make Camlp4 loop with left-recursive rules? I haven't used it very much, so I don't know.) An example of a system that can "guarantee parseability" is the macro system that Schwartzbach and Brabrand developed for the Bigwig project. Their system will detect and reject at compile time any macro definitions that would not be parseable with their LL(1) parser. So the compiler guarantees parseability in the sense that you can't write a program that is generated by the grammar but can't be parsed by the compiler. It's kind of like static typing for macros. JSE doesn't guarantee parseability, because it's a procedural macro system. Since you can do arbitrary computations at compile time, obviously you can't guarantee termination. -- Neel Krishnaswami neelk@cswcasa.com ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr