[erlang-questions] where is the best erlang pretty printer

Joe Armstrong <>
Wed May 25 13:37:42 CEST 2011

On Wed, May 25, 2011 at 12:46 PM, Matthias Lang <>wrote:

> On Wednesday, May 25, Joe Armstrong wrote:
> > I need to identify the best possible erlang pretty printer.
> >
> > Are there several, or unpublished variants in existence?
> >
> > I want exact reproduction of inputted constants
> > it $a should be pretty printed as $a and NOT 97.
> I don't understand what you want.

Sorry  - to me a pretty printer takes the AST of a parsed function, and
turns into beautiful text.
The text should be the same as the original source with the exception of the
of white space to make the source prettier.

The round trip

    Source -> Parse Tree -> Reconstructed Source -> ParseTree1

Should preserve certain invariants

    ParseTree and ParseTree1 should be isomorphic to within white space
    Syntactic variants for writing integers in Source etc. should be
preserved in the reconstructed Source

I guess I need not only a pretty printer but also a more precise parser -

In writing this I'm wondering what to do with erlang that does not parse
correctly -

I know there is a pretty printer (erl_prettypr) in syntax tools - but I was
if there were others that I didn't know about. I guess wrangler and tidier
also have some
idea on prettyness.


> First I thought you were asking about a source-code pretty printer,
> but that can't be it, surely no source code pretty printer is going to
> mangle $a into 97!
> Then I thought you wanted a replacement for io:fwrite(), but that
> doesn't make sense either since $a is exactly the same thing as 97 by
> the time it's an argument. But you know that. So you must want
> something else again. But what?
> Matt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20110525/62909389/attachment.html>

More information about the erlang-questions mailing list