From: "Nicolas Pouillard" <nicolas.pouillard@gmail.com>
To: Hendrik Tews <tews@cs.ru.nl>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Camlp4: example/parse_files.ml
Date: Thu, 03 Apr 2008 17:32:55 +0200 [thread overview]
Message-ID: <1207236568-sup-3680@port-ext16.ensta.fr> (raw)
In-Reply-To: <18420.4901.506029.744640@tandem.cs.ru.nl>
[-- Attachment #1: Type: text/plain, Size: 1762 bytes --]
Excerpts from Hendrik Tews's message of Thu Apr 03 01:13:41 +0200 2008:
> Hi,
>
> I have a few questions to the parse_files example.
>
> The example starts with building the parser and printer via the
> following functor application
>
> module Caml =
> Camlp4.Printers.OCaml.Make
> (Camlp4OCamlParser.Make
> (Camlp4OCamlRevisedParser.Make
> (Camlp4.OCamlInitSyntax.Make(Ast)(Gram)(Quotation))));;
>
>
> 1. Can I omit the printer functor if I am only interested in
> parsing files (and not printing) and simplify to
>
> module Caml =
> Camlp4OCamlParser.Make
> (Camlp4OCamlRevisedParser.Make
> (Camlp4.OCamlInitSyntax.Make(Ast)(Gram)(Quotation)))
Yes I think so.
> 2. Ast, Gram, Quotation come from Camlp4.PreCast.
Right.
> Do I miss
> something if I simplify further to
>
> module Caml =
> Camlp4OCamlParser.Make
> (Camlp4OCamlRevisedParser.Make(Camlp4.PreCast.Syntax))
You are applying original and revised parser, so if the current parser is
empty that's ok. Otherwise the extension can fail.
> 3. I looked into the registration of syntax extentions (Register
> functors) and how the syntax extention callbacks are called
> in Register.iter_and_take_callbacks. I have the impression
> that in camlp4 not the above nested functor application is
> performed but the Make functors are sequentially applied to
> the same Syntax functor. Therefore, can I further simplify to
>
> module Caml = Camlp4.PreCast.Syntax
> let () =
> let module M1 = Camlp4OCamlRevisedParser.Make(Caml) in
> let module M2 = Camlp4OCamlParser.Make(Caml)
> in
> ()
Right, assuming you're starting with an empty grammar.
--
Nicolas Pouillard aka Ertai
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]
next prev parent reply other threads:[~2008-04-03 15:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-02 23:13 Hendrik Tews
2008-04-03 15:32 ` Nicolas Pouillard [this message]
2008-04-03 21:24 ` [Caml-list] " Hendrik Tews
2008-04-04 13:40 ` Nicolas Pouillard
2008-04-04 14:01 ` Hendrik Tews
2008-04-04 14:19 ` Nicolas Pouillard
2008-04-04 21:30 ` Hendrik Tews
2008-04-05 10:00 ` Nicolas Pouillard
2008-04-07 7:31 ` Hendrik Tews
2008-04-07 8:10 ` 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=1207236568-sup-3680@port-ext16.ensta.fr \
--to=nicolas.pouillard@gmail.com \
--cc=caml-list@inria.fr \
--cc=tews@cs.ru.nl \
/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