From: "Krishnaswami, Neel" <neelk@cswcasa.com>
To: caml-list@inria.fr
Subject: Re: [Caml-list] Camlp4 "vs" JSE
Date: Thu, 7 Feb 2002 09:08:50 -0500 [thread overview]
Message-ID: <B1E4D3274D57D411BE8400D0B783FF32A8D6A1@exchange1.cswv.com> (raw)
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
next reply other threads:[~2002-02-07 14:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-02-07 14:08 Krishnaswami, Neel [this message]
-- strict thread matches above, loose matches on Subject: below --
2002-02-06 13:37 Dave Berry
2002-02-06 14:59 ` Daniel de Rauglaudre
2002-02-06 22:14 ` Chris Hecker
2002-02-07 5:25 ` Daniel de Rauglaudre
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=B1E4D3274D57D411BE8400D0B783FF32A8D6A1@exchange1.cswv.com \
--to=neelk@cswcasa.com \
--cc=caml-list@inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).