English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
How to Write a Pretty Printer for a DSL Using camlp4
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2007-11-25 (10:37)
From: Nicolas Pouillard <nicolas.pouillard@g...>
Subject: Re: [Caml-list] How to Write a Pretty Printer for a DSL Using camlp4
Excerpts from echinuz echinuz's message of Sun Nov 25 09:46:22 +0100 2007:
> Hi,
>      I'm writing a DSL where I'd like to leverage camlp4 for parsing and
> printing.  Right now, I'm having trouble with the pretty printer.  As an
> example, let's take the simple calculator example.  With the following code, I
> can replace the OCaml toplevel and and print the AST for a simple algebraic
> expression:


> module Make (Syntax : Camlp4.Sig.Syntax) : Camlp4.Sig.Printer(Syntax.Ast).S =

module Make (Syntax : Camlp4.Sig.Camlp4Syntax) : Camlp4.Sig.Printer(Syntax.Ast).S =


> module M = Camlp4.Register.Printer(Id)(Make)

module M = Camlp4.Register.OCamlPrinter(Id)(Make)


Nicolas Pouillard aka Ertai