From: "Nicolas Pouillard" <nicolas.pouillard@inria.fr>
To: "Martin Jambon" <martin.jambon@ens-lyon.org>
Cc: "Pietro Abate" <Pietro.Abate@anu.edu.au>,
"ocaml ml" <caml-list@inria.fr>
Subject: Re: using camlp4 api [WAS: Re: [Caml-list] parsing problem.]
Date: Thu, 25 Jan 2007 10:36:55 +0100 [thread overview]
Message-ID: <cd67f63a0701250136m7ef57135p1fff32c67a35af04@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.58.0701241426590.21415@localhost>
On 1/24/07, Martin Jambon <martin.jambon@ens-lyon.org> wrote:
> On Thu, 25 Jan 2007, Pietro Abate wrote:
>
> > where in the first part there is a grammar definition and in the second part
> > the grammar is used to parse the argument of the match statement.
> >
> > my question: Is it possible to do something similar with camlp4 ?
> >
> > In the library documentation I can see that this might be possible, but I don't
> > quite understand where to start. The first step should be to write a small
> > parser to interpret the language definition and then to generate, by using the
> > Grammar (extensible grammars) module, other production that extend the current
> > grammar to parse the rest of the file. The trick part is that I cannot write (I
> > think) and EXTEND statement on the fly (as it should be parsed itself), but I
> > have to use the quotation library directly, and this is very verbose...
> >
> > Did anybody do anything similar ? One small example ?
>
Yes, Coq is one example but not a small one :)
Indeed Coq parsing uses camlp4. And Coq have a syntax extensible on the fly.
Coq < Definition myeq (x : nat) (y : nat) := x = y.
myeq is defined
Coq < Notation "x '=?=' y" := (myeq x y) (at level 70, no associativity).
Coq < Check (3 =?= 4).
3 =?= 4
: Prop
--
Nicolas Pouillard
prev parent reply other threads:[~2007-01-25 9:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-23 23:59 parsing problem Pietro Abate
2007-01-24 21:53 ` using camlp4 api [WAS: Re: [Caml-list] parsing problem.] Pietro Abate
2007-01-24 22:37 ` Martin Jambon
2007-01-25 9:36 ` Nicolas Pouillard [this message]
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=cd67f63a0701250136m7ef57135p1fff32c67a35af04@mail.gmail.com \
--to=nicolas.pouillard@inria.fr \
--cc=Pietro.Abate@anu.edu.au \
--cc=caml-list@inria.fr \
--cc=martin.jambon@ens-lyon.org \
/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).