Software Engineers Handbook/Language Dictionary/Ada

Ada
Ada is a strongly typed Multi-paradigmed programming language suitable for embedded systems, device drivers and other forms of system programming.

Type
Ada is a full Multi-paradigmed programming language implementing the following paradigmen: concurrent, distributed, generic (template metaprogramming), imperative and object-oriented (class-based) programming.

Execution Entry Point
The procedure name of the entry point can be freely choosen.

General Syntax
The typical statement is completed by a semi-colon. For the assignment of b to a use:

a b

Variable Declarations
Declarations can appear at the beginning of an block.

Declare i as an integer:

I Integer

Here are two ways to declare i as an integer and give it an initial value of 0:

I Integer  0

Method Declaration/Implementation
procedures and functions are declared by the keyword or  respectively. See Ada Programming/Subprograms for details.

A_Test (A, B: Integer; C:  Integer) C := A + B; A_Test;

Minimum (A, B : Integer) Integer A <= B        B;        A;     ; Minimum;

Class methods are primitive operations (procedures and functions) declared in the same scope as the class record. See Ada_Programming/Object_Orientation for details.

Scope
Scope is declared by the use of packages which may consist of three parts: public specification, private specification and body.

Package_With_Body Basic_Record ; Set_A (This :  Basic_Record;                     An_A :      Integer); Get_A (This : Basic_Record) Integer; Basic_Record A : Integer; ; Package_With_Body;

Package_With_Body Set_A (This :  Basic_Record;                     An_A :      Integer) This.A := An_A; Set_A; Get_A (This : Basic_Record) Integer This.A;    Get_A; Package_With_Body;

See Ada_Programming/Packages for details.

Conditional Statements


A Range_Type I_IO.Put (Item => A,                 Width => 3,                 Base  => 10); A < Range_Type'Last T_IO.Put (","); T_IO.New_Line; ;    ;

See Ada Programming/Control for details.

Output Statements


; Hello Ada.Text_IO.Put_Line("Hello, world!"); Hello;

See Ada_Programming/Libraries/Ada.Text_IO for details.

Error Handling/Recovery


See Ada_Programming/Exceptions for details.

Containers
The following predefined packages are now available natively within Ada (since Ada 2005):



These are definite versions - indefinite versions of each area also provided. All containers are unbounded.

Algorithms


Garbage collection
Carbage collections can be either manual or automatic - refer to your compiler handbook. If automatic collection is provided then  can deactivate atomatic collection for the named access type.

For manual deallocation the package is used.

See Ada Programming/Types/access for details.

Physical Structure


Tips


Web References

 * Ada Programming - - (|Index) (this wikibook is a tutorial)

Books and Articles

 * Subject: Ada programming language