caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Pretty-printing the OCaml AST from the toplevel
@ 2007-10-08 10:57 Joel Reymont
  2007-10-08 12:49 ` [Caml-list] " Nicolas Pouillard
  0 siblings, 1 reply; 2+ messages in thread
From: Joel Reymont @ 2007-10-08 10:57 UTC (permalink / raw)
  To: Caml List

Are there any examples of pretty-printing the OCaml AST from the  
toplevel?

I'm looking to use this during interactive debugging.

I see the following example in the camlp4 changes doc

camlp4 -parser OCaml -printer OCamlr foo.ml

but I'm still browsing through Camlp4.ml to figure out what that does  
exactly.

	Thanks, Joel

--
http://wagerlabs.com




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

* Re: [Caml-list] Pretty-printing the OCaml AST from the toplevel
  2007-10-08 10:57 Pretty-printing the OCaml AST from the toplevel Joel Reymont
@ 2007-10-08 12:49 ` Nicolas Pouillard
  0 siblings, 0 replies; 2+ messages in thread
From: Nicolas Pouillard @ 2007-10-08 12:49 UTC (permalink / raw)
  To: joelr1; +Cc: caml-list

Excerpts from joelr1's message of Mon Oct 08 12:57:56 +0200 2007:
> Are there any examples of pretty-printing the OCaml AST from the  
> toplevel?

$ rlwrap ocaml camlp4of.cma
open Camlp4.PreCast;;
module PP = Camlp4.Printers.OCaml.Make(Syntax);;
let pp = new PP.printer ();;
let ghost = Loc.ghost;;
module PP = Camlp4.Printers.OCaml.Make(Syntax);;
Format.eprintf "%a@." pp#expr <:expr@ghost< 3 + 4 >>;;

> I'm looking to use this during interactive debugging.
> 
> I see the following example in the camlp4 changes doc
> 
> camlp4 -parser OCaml -printer OCamlr foo.ml
> 
> but I'm still browsing through Camlp4.ml to figure out what that does  
> exactly.

Camlp4.ml  is  a  generated file. It's perhaps not the best way to read camlp4
sources.

-- 
Nicolas Pouillard aka Ertai


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

end of thread, other threads:[~2007-10-08 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-08 10:57 Pretty-printing the OCaml AST from the toplevel Joel Reymont
2007-10-08 12:49 ` [Caml-list] " 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).