comp.lang.ada
 help / color / mirror / Atom feed
From: mfb@mbunix.mitre.org (Michael F Brenner)
Subject: Re: Gnat pretty printing
Date: 1998/12/11
Date: 1998-12-11T00:00:00+00:00	[thread overview]
Message-ID: <74r7ip$t1@top.mitre.org> (raw)
In-Reply-To: 74on70$m9o$1@cnn.Princeton.EDU

Martin > ... I have an independent study project slated for next semester
       > to reimplement the reformatting tool in AdaGIDE. It is also 
       > available as a standalone tool, and will generate colorized 
       > RTF output. Suggestions for requirements are welcome, although 
       > I don't promise to have the same preferences you do :-). 

It is okay to have different preferences, it is just not okay to 
force others into using our preferences. 

Here are the requirements for a pretty printer:
  (a) There should be the option to uncapitalize all reserved words 
      and all identifiers.
  (b) There should be the option to uncaptitalize all reserved words
      but let identifiers have consistently the case they had the 
      first time they appeared.
  (c) The semantics (object code generated) should not be modified.
  (d) The comments should still be associated in some way with
      the line on which they originated.
  (e) There should be the option to align terminating comments
      with their indentation after a given column.
  (f) There should be the option to align block comments
      with their indentation after a given column, for example, 81.
  (g) There should be the option to put things with or without arrows
      underneath each other (actual arguments, formal parameters,
      array constants, etc.) in one, two, three, or four columns.
      However, if they fit on one line, they should be put on one line.
      This transition from columnated to single-lined is important.
  (h) It should append onto a statistical file the following counts: 
      (A) loops without an invariant condition comment, 
      (B) loops without a precondition comment, 
      (C) loops without a postcondition comment, 
      (D) calls to procedures named assert, 
      (E) executable lines of code counted statically,
      (F) executable lines of code including generic expansions,
      (G) executable lines of code including generics and WITHed packages,   
      (H) executable lines of code including generics, and transitive WITHs,
      (I) test paths including goto statements and exception raising,
      (J) uses of multiple entries: in Ada this means gotos and unit pointers,
      (K) non-standard PRAGMAs,
      (L) type names that are not plural noun phrases,
      (M) functions that are not singluar noun phrases,
      (N) boolean variables or functions that are not predicate phrases,
      (O) archaic loops that use WHILE instead of EXIT,
      (P) unused WITHs,
      (Q) USE statements outside a package that could have been inside.
  (i) There should be the option to append onto a statistical file
      the following counts:
      (A) highly global references (outside the compilation unit), 
      (B) global references (outside the body not incl formal parameters),
      (C) semi-global references (static to the body not incl formal parms), 
      (D) local references, 
      (E) references to pointers of any kind,
      (F) calls to procedures named assert,
      (G) results of memory leakage analysis,
      (H) variables that could have been more local without semantic change,
  (j) There should be the option to do a radiation compile, which assumes
      that either radiation struck a memory chip violating a previously
      checked constraint or else there is a compiler bug; thus, every
      time any operator is used, or any compilation unit invoked, every
      variable in every actual argument is constraint checked regardless
      of the theorems already proved by the optimizer or code generator
      that those variables are definitely already within constraints.
  (k) Color RTF output is great because it can be converted to latex,
      eroff, or sloppy html; an immediate student project, however, should
      be to convert it to XML with VML annotations, because XML is rapidly
      increasing in importance to an Air Force whose applications are
      making ever more use of web technology, and VML is the only
      proposed way of making box diagrams in the context of a web
      typesetting language.
  (l) There should be an option for all statements referencing nonlocal
      variables and all statements causing a package to be non-pure
      to be typeset in bold (alternatively, to be colored dark red).
  (m) There should be the option to replace all numbers and strings
      outside the elaboration section, except 0 and 1, with named constants.
  (n) Pretty printing rules for newlines and indenting should be 
      overridden automatically when the whole thing fits on one line
      between the code starting column and the comment starting column.
  (o) It goes without saying that 
      (A) THEN goes on the same line as the IF when it fits;
      (B) IS goes on the same line as CASE when it fits;
      (C) IF, ELSIF, ELSE, and END IF are in the same column;
      (D) CASE, WHEN, and END CASE are in the same column; 
      (E) There is NEVER a space before a colon, semicolon, comma, or period;
      (F) There is an optional space before and after assignment operators;
      (G) the capitalization for IDs and keywords should default to NOT;
      (H) PROCEDURE, BEGIN, EXCEPTION, END are in the same column;
      (I) Assignment operators and other words like renames, etc., when 
          aesthetically pleasing, should be aligned, and it would be
          challenging to define aethetical here.
  (p) An option to substitute one name for another, with semantic correctness.
  (q) An option to list any WITHs that could have been move to separates.
  (r) Identify USE statements that could have been put later.





  parent reply	other threads:[~1998-12-11  0:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-12-09  0:00 Gnat pretty printing Matt Tyler
1998-12-09  0:00 ` Steve O'Neill
1998-12-10  0:00   ` okellogg
1998-12-11  0:00     ` dewarr
1998-12-09  0:00 ` dennison
1998-12-09  0:00 ` Marin David Condic
1998-12-09  0:00   ` David C. Hoos
1998-12-10  0:00   ` Martin C. Carlisle
1998-12-11  0:00     ` Marin David Condic
1998-12-12  0:00       ` Robert A Duff
1998-12-13  0:00         ` Ehud Lamm
1998-12-15  0:00         ` Marin David Condic
1998-12-12  0:00       ` Simon Wright
1998-12-14  0:00         ` dennison
1998-12-15  0:00         ` Marin David Condic
1998-12-15  0:00           ` dennison
1998-12-15  0:00             ` Marin David Condic
1998-12-16  0:00               ` Matthew Heaney
1998-12-16  0:00               ` dennison
1998-12-16  0:00                 ` Chris Morgan
1998-12-18  0:00                   ` dewar
1998-12-16  0:00                 ` Matthew Heaney
1998-12-17  0:00                 ` Dale Stanbrough
1998-12-15  0:00           ` Matthew Heaney
1998-12-15  0:00             ` Marin David Condic
1998-12-19  0:00               ` Lieven Marchand
1998-12-11  0:00     ` Michael F Brenner [this message]
1998-12-11  0:00       ` dewarr
1998-12-11  0:00       ` Bob Collins
1998-12-11  0:00       ` Stephane Barbey
1998-12-11  0:00       ` Bryce Bardin
1998-12-14  0:00     ` Robert I. Eachus
1998-12-21  0:00     ` BARDIN Marc
1998-12-09  0:00 ` Tom Moran
1998-12-09  0:00   ` dennison
1998-12-09  0:00     ` Tom Moran
1998-12-09  0:00 ` David C. Hoos
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox