GNAT Coding Style


Node: Top, Next: , Up: (dir)


Node: General, Next: , Previous: Top, Up: Top

1 General

Most of GNAT is written in Ada using a consistent style to ensure readability of the code. This document has been written to help maintain this consistent style, while having a large group of developers work on the compiler.

For the coding style in the C parts of the compiler and run time, see the GNU Coding Guidelines.

This document is structured after the Ada Reference manual. Those familiar with that document should be able to quickly lookup style rules for particular constructs.


Node: Lexical Elements, Next: , Previous: General, Up: Top

2 Lexical Elements

2.1 Character Set and Separators

2.2 Identifiers

2.3 Numeric Literals

2.4 Reserved Words

2.5 Comments


Node: Declarations and Types, Next: , Previous: Lexical Elements, Up: Top

3 Declarations and Types


Node: Expressions and Names, Next: , Previous: Declarations and Types, Up: Top

4 Expressions and Names


Node: Statements, Next: , Previous: Expressions and Names, Up: Top

5 Statements

5.1 Simple and Compound Statements

5.2 If Statements

5.3 Case Statements

5.4 Loop Statements

5.5 Block Statements


Node: Subprograms, Next: , Previous: Statements, Up: Top

6 Subprograms

6.1 Subprogram Declarations

6.2 Subprogram Bodies


Node: Packages, Next: , Previous: Subprograms, Up: Top

7 Packages and Visibility Rules


Node: Program Structure, Previous: Packages, Up: Top

8 Program Structure and Compilation Issues