From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e9f0eae6d714d11c X-Google-Attributes: gid103376,public From: mfb@mbunix.mitre.org (Michael F Brenner) Subject: Re: Gnat pretty printing Date: 1998/12/11 Message-ID: <74r7ip$t1@top.mitre.org> X-Deja-AN: 421179513 References: <74lt16$9r0@romeo.logica.co.uk> <366E9E44.AA7370C7@pwfl.com> <74on70$m9o$1@cnn.Princeton.EDU> Organization: The MITRE Corporation, Bedford Mass. Newsgroups: comp.lang.ada Date: 1998-12-11T00:00:00+00:00 List-Id: 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.