Re: Tools to "prettify" source code

"Ira D. Baxter" <idbaxter@semdesigns.com>
31 Mar 2001 02:31:26 -0500

          From comp.compilers

Related articles
Tools to "prettify" source code michael.stumpfl@jkh.uni-linz.ac.at (Michael Stumpfl) (2001-03-28)
Re: Tools to "prettify" source code idbaxter@semdesigns.com (Ira D. Baxter) (2001-03-31)
Re: Tools to "prettify" source code viola@pp.htv.fi (Pekka Enberg) (2001-03-31)
Re: Tools to "prettify" source code eliotm@pacbell.net (Eliot Miranda) (2001-04-04)
Re: Tools to "prettify" source code perkens@sdm.de (Burkhard Perkens-Golomb) (2001-04-04)
Re: Tools to "prettify" source code ericbr@oz.net (Eric Brown) (2001-04-04)
Re: Tools to "prettify" source code marcov@toad.stack.nl (2001-04-10)
Re: Tools to "prettify" source code idbaxter@semdesigns.com (Ira D. Baxter) (2001-04-10)
[2 later articles]
| List of all articles for this month |

From: "Ira D. Baxter" <idbaxter@semdesigns.com>
Newsgroups: comp.compilers
Date: 31 Mar 2001 02:31:26 -0500
Organization: Posted via Supernews, http://www.supernews.com
References: 01-03-155
Keywords: tools
Posted-Date: 31 Mar 2001 02:31:26 EST

Our DMS Reengineering Toolkit parses arbitrary langauges ("domains"),
builds ASTs (capturing all the lexical source information such as
comments, number formats, etc.), can apply source-to-source
transformations to the trees, and finally prettyprint the result.
This is driven by a "domain definition" including a grammar and
prettyprinting rules.


DMS works for many langagues, including C++ and Java. If you don't do
any transforms, this is just prettyprinting. (This is direct evidence
of the existence of a C++ prettyprinter :) What goes out is exactly
what comes in, modulo nice indentation and line breaks according to
the language rules.


The domain designer has complete control over how lexemes are
reconstructed during prettyprinting, so one can easily normalize case
or choose certiain lexical formats (e.g., force all floating point
numbers to be printed in scientific notation, say).


Addition of extra "comments" marking off sections of the text as shown
in the example below would be accomplished by simple transforms. Lots
of interesting variations of "prettyprinting" are possible with modest
transforms, including generation of "xxxdoc" (pick your favorite)
annotations of the source.


--
Ira D. Baxter, Ph.D. CTO Semantic Designs, Inc.
http://www.semdesigns.com




"Michael Stumpfl" <michael.stumpfl@jkh.uni-linz.ac.at> wrote in message
news:01-03-155@comp.compilers...
> Hi,
>
> I´ve just recently stumbled across this ng, so I'm not sure if my
> problem has already been discussed at full length: Does anybody of you
> know of a tool to "prettify" source code automatically (C++/JAVA)?


> You have some source code like this:
>
> #include<stdio.h>
> #define dEbUG
> #define constANT 1
> int VARIABLE=constANT;void main (void){printf("\r\nUseless example program
1.0\r\n");
> #ifdef dEbUG
> printf ("\r\nvariable = %d\r\n",VARIABLE);
> #endif
> }
>
>
> And after running "restyle test.cpp style-template.dat" you get something
like this:
>
> #include<stdio.h>
>
>
> //--------------------------- CONSTANTS ---------------------------
> #define DEBUG
> #define CONSTANT 1









Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.