From: Aleksey Nogin <nogin@cs.caltech.edu>
To: Nicolas Pouillard <nicolas.pouillard@gmail.com>
Cc: OCaml Mailing List <caml-list@yquem.inria.fr>,
MetaPRL Developers <metaprl-devel@metaprl.org>
Subject: Re: [Caml-list] [Camlp4] Beta-release
Date: Tue, 16 May 2006 13:16:31 -0700 [thread overview]
Message-ID: <446A331F.4000205@cs.caltech.edu> (raw)
In-Reply-To: <cd67f63a0605150441l60ad0e10ra4502fa8c98082f1@mail.gmail.com>
I have a question/feature request.
For our camlp4 usage (in MetaPRL theorem prover - http://metaprl.org/ ),
we need to:
- extend the OCaml grammar
- refer to a "state" when parsing the extensions.
Currently we have to put the state in a global ref (yuck!), which causes
all kinds of difficulties.
Is this something that can be done better in your reimplementation? Can
something like this be added to your reimplementation?
Basically, I would really like to see camlp4 help with the following:
1) Defining parsers that depend on a shared state that is passed around.
Currently one can either
a) use a global pointer ref, or
b) manually define the productions of "state -> ..." type and manually
pass the state around.
(a) is obviously bad, but even (b) is not only a lot of extra typing,
but also means that the execution of productions will be delayed until
the whole thing is parsed, which would mean that when something goes
wrong, you would often get a campl4 parsing error instead of a (usually
more meaningful) error generated by the production code.
2) Allow passing shared state even for grammars that extend things like
OCaml grammar.
3) (completely unrelated) I wish there was a way to tell camlp4 to
detect and report conflicts!
P.S. The bulk of our camlp4 code is in
http://svn.metaprl.org/viewcvs/mojave/metaprl/filter/filter/term_grammar.ml
(the shared state is hidden in a way here - the grammar is created in a
functor where the input module provides functions like mk_opname; when
the functor will be instantiated, the functions would be made dependent
on a number of global refs) and in
http://svn.metaprl.org/viewcvs/mojave/metaprl/filter/filter/filter_parse.ml
(here we actually extend the OCaml grammar, using some of the stuff from
term_grammar.ml in that extension).
If you are interested in downloading MetaPRL sources to look at this
stuff in more detail, please see the download instructions at
http://metaprl.org/install.html
--
Aleksey Nogin
Home Page: http://nogin.org/
E-Mail: nogin@cs.caltech.edu (office), aleksey@nogin.org (personal)
Office: Moore 04, tel: (626) 395-2200
next prev parent reply other threads:[~2006-05-16 20:16 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-15 11:41 Nicolas Pouillard
2006-05-16 14:55 ` [Caml-list] " Alain Frisch
2006-05-16 20:16 ` Aleksey Nogin [this message]
2006-05-17 7:52 ` Nicolas Pouillard
2006-05-22 22:39 ` Aleksey Nogin
2006-05-18 14:36 ` Stefano Zacchiroli
2006-05-18 14:41 ` Nicolas Pouillard
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=446A331F.4000205@cs.caltech.edu \
--to=nogin@cs.caltech.edu \
--cc=caml-list@yquem.inria.fr \
--cc=metaprl-devel@metaprl.org \
--cc=nicolas.pouillard@gmail.com \
/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