Lisp HUG Maillist Archive

Using the lisp pretty printer to format C, C# or C++ code

Does anyone have an example of using the Lisp pretty printer to  
output C, C# or C++ code?

In fact, an example for any language other than Lisp would do so long  
as the pretty printer indents braces, etc. properly.

	Thanks, Joel

--
http://wagerlabs.com/






Re: Using the lisp pretty printer to format C, C# or C++ code

"Joel Reymont" <joelr1@gmail.com> wrote:

> Does anyone have an example of using the Lisp pretty printer to  output C, 
> C# or C++ code?
>
> In fact, an example for any language other than Lisp would do so long  as 
> the pretty printer indents braces, etc. properly.

A search on the Common Lisp Directory gives:
http://www.cl-user.net/asp/web-sites/tr1993-017

BTW The Common Lisp Directory Lispworks process uptime reached 500 days 
yesterday. In those 500 days it has served more than 142M HTTP requests. :)

Marc



Re: Using the lisp pretty printer to format C, C# or C++ code

It shouldn't be that difficult...  One of the original docs about the  
pretty printer showed how to use the PP to print Pascal-like stuff   
(see links below)

	http://www.merl.com/reports/docs/TR93-17.pdf
	http://dspace.mit.edu/handle/1721.1/6503

One thing I did once was to rewrite the CMUCL XP based pretty printer  
in Java and use it to output neatly indented code (in Esterel, but  
the concept is the same).  It worked like a charm, and the code was  
almost 1-to-1 Common Lisp.

Cheers

Marco





On Apr 25, 2007, at 2:28 PM, Joel Reymont wrote:

>
> Does anyone have an example of using the Lisp pretty printer to  
> output C, C# or C++ code?
>
> In fact, an example for any language other than Lisp would do so  
> long as the pretty printer indents braces, etc. properly.
>
> 	Thanks, Joel
>
> --
> http://wagerlabs.com/
>
>
>
>
>

--
Marco Antoniotti, Associate Professor
DISCo, Università Milano Bicocca
Via Bicocca degli Arcimboldi 8, U7, 4 piano
I-20126 Milan (MI) ITALY






Re: Using the lisp pretty printer to format C, C# or C++ code

Hi Joel,

Richard Waters has a wonderful technical report on the pretty printer  
and provides an example of printing Pascal code. Googling (http:// 
www.google.com/search?ie=utf8&oe=utf8&q=richard+merl+waters+pretty 
+printer) seems to do the trick.

Let me know if you want me to send it to you directly.


On Apr 25, 2007, at 8:28 AM, Joel Reymont wrote:

>
> Does anyone have an example of using the Lisp pretty printer to  
> output C, C# or C++ code?
>
> In fact, an example for any language other than Lisp would do so  
> long as the pretty printer indents braces, etc. properly.
>
> 	Thanks, Joel
>
> --
> http://wagerlabs.com/
>
>
>
>
>

--
Gary Warren King, metabang.com
Cell: (413) 885 9127
Fax: (206) 338-4052
gwkkwg on Skype * garethsan on AIM





Updated at: 2020-12-10 08:46 UTC