caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Camlp4: example/parse_files.ml
@ 2008-04-02 23:13 Hendrik Tews
  2008-04-03 15:32 ` [Caml-list] " Nicolas Pouillard
  0 siblings, 1 reply; 10+ messages in thread
From: Hendrik Tews @ 2008-04-02 23:13 UTC (permalink / raw)
  To: caml-list

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)))

2. Ast, Gram, Quotation come from Camlp4.PreCast. Do I miss
   something if I simplify further to

    module Caml =
       Camlp4OCamlParser.Make
	(Camlp4OCamlRevisedParser.Make(Camlp4.PreCast.Syntax))

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
	()

   ?

Bye,

Hendrik


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2008-04-07  8:10 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-02 23:13 Camlp4: example/parse_files.ml Hendrik Tews
2008-04-03 15:32 ` [Caml-list] " Nicolas Pouillard
2008-04-03 21:24   ` 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

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).