Re: Approaches to code formatters

"Ira Baxter" <idbaxter@semdesigns.com>
3 Dec 2002 00:40:50 -0500

          From comp.compilers

Related articles
Approaches to code formatters pioter@terramail.CUTTHIS.pl (Piotr Zgorecki) (2002-12-01)
Re: Approaches to code formatters aka@mvps.org (Alex K. Angelopoulos) (2002-12-03)
Re: Approaches to code formatters nmh@t3x.org (Nils M Holm) (2002-12-03)
Re: Approaches to code formatters idbaxter@semdesigns.com (Ira Baxter) (2002-12-03)
Re: Approaches to code formatters root@candle.pha.pa.us (2002-12-07)
| List of all articles for this month |
From: "Ira Baxter" <idbaxter@semdesigns.com>
Newsgroups: comp.compilers
Date: 3 Dec 2002 00:40:50 -0500
Organization: Compilers Central
References: 02-12-024
Keywords: tools
Posted-Date: 03 Dec 2002 00:40:50 EST

We have formatters that work by parsing the source language.
Yes, they have trouble with badly placed preprocessor directives.
However, we accept (parse) preprocessor directives in the places
they tend to be used, so this isn't quite as bad as it might first sound.
We've found that only a little bit of editing to get rid of the truly
ugly ones is generally necessary, and IMHO, the source code
readability is often directly improved as a consequence of just
this editing anyway. The additional payoff is really nice formatting,
though :-}
See http://www.semdesigns.com/Products/Formatters/index.html.


--
Ira D. Baxter, Ph.D., CTO 512-250-1018
Semantic Designs, Inc. www.semdesigns.com


"Piotr Zgorecki" <pioter@terramail.CUTTHIS.pl> wrote in message
> Did anybody write a code formatter for C-like languages ? I'm writing
> one at the moment, and the farther I go, the more I dislike the
> approach I have taken. I decided not to have any parser, instead I
> merely take the tokens that lexer feeds me, and try to format "by
> hand", which means lots of scans through a token buffer. Now this is
> good for a simple paren or bracket indentation, but get's ugly with
> anything less trivial.


Post a followup to this message

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