Features[ edit ] Ada was originally designed for embedded and real-time systems. Tucker Taft of Intermetrics between and , improved support for systems, numerical, financial, and object-oriented programming OOP. Features of Ada include: strong typing , modular programming mechanisms packages , run-time checking , parallel processing tasks , synchronous message passing , protected objects, and nondeterministic select statements , exception handling , and generics. Code blocks are delimited by words such as "declare", "begin", and "end", where the "end" in most cases is followed by the identifier of the block it closes e. In the case of conditional blocks this avoids a dangling else that could pair with the wrong nested if-expression in other languages like C or Java.
|Published (Last):||2 June 2013|
|PDF File Size:||6.3 Mb|
|ePub File Size:||16.91 Mb|
|Price:||Free* [*Free Regsitration Required]|
Features[ edit ] Ada was originally designed for embedded and real-time systems. Tucker Taft of Intermetrics between and , improved support for systems, numerical, financial, and object-oriented programming OOP. Features of Ada include: strong typing , modular programming mechanisms packages , run-time checking , parallel processing tasks , synchronous message passing , protected objects, and nondeterministic select statements , exception handling , and generics.
Code blocks are delimited by words such as "declare", "begin", and "end", where the "end" in most cases is followed by the identifier of the block it closes e.
In the case of conditional blocks this avoids a dangling else that could pair with the wrong nested if-expression in other languages like C or Java. Ada is designed for developing very large software systems. Ada packages can be compiled separately.
Ada package specifications the package interface can also be compiled separately without the implementation to check for consistency. This makes it possible to detect problems early during the design phase, before implementation starts. A large number of compile-time checks are supported to help avoid bugs that would not be detectable until run-time in some other languages or would require explicit checks to be added to the source code.
For example, the syntax requires explicitly named closing of blocks to prevent errors due to mismatched end tokens. The adherence to strong typing allows detecting many common software errors wrong parameters, range violations, invalid references, mismatched types, etc.
As concurrency is part of the language specification, the compiler can in some cases detect potential deadlocks. Ada also supports run-time checks to protect against access to unallocated memory, buffer overflow errors, range violations, off-by-one errors , array access errors, and other detectable bugs. These checks can be disabled in the interest of runtime efficiency, but can often be compiled efficiently.
It also includes facilities to help program verification. For these reasons, Ada is widely used in critical systems, where any anomaly might lead to very serious consequences, e. Examples of systems where Ada is used include avionics , air traffic control , railways, banking, military and space technology. Ada has no generic or untyped pointers ; nor does it implicitly declare any pointer type. Instead, all dynamic memory allocation and deallocation must occur via explicitly declared access types.
Each access type has an associated storage pool that handles the low-level details of memory management; the programmer can either use the default storage pool or define new ones this is particularly relevant for Non-Uniform Memory Access. It is even possible to declare several different access types that all designate the same type but use different storage pools.
Also, the language provides for accessibility checks, both at compile time and at run time, that ensures that an access value cannot outlive the type of the object it points to. Though the semantics of the language allow automatic garbage collection of inaccessible objects, most implementations do not support it by default, as it would cause unpredictable behaviour in real-time systems. Ada does support a limited form of region-based memory management ; also, creative use of storage pools can provide for a limited form of automatic garbage collection, since destroying a storage pool also destroys all the objects in the pool.
A double- dash "--" , resembling an em dash , denotes comment text. Comments stop at end of line, to prevent unclosed comments from accidentally voiding whole sections of source code. Disabling a whole block of code now requires the prefixing of each line or column individually with "--". The semicolon ";" is a statement terminator , and the null or no-operation statement is null;.
A single ; without a statement to terminate is not allowed. Thus, it is a common reference for Ada programmers, not only programmers implementing Ada compilers. Apart from the reference manual, there is also an extensive rationale document which explains the language design and the use of various language constructs.
This document is also widely used by programmers. When the language was revised, a new rationale document was written. History[ edit ] In the s the US Department of Defense DoD became concerned by the number of different programming languages being used for its embedded computer system projects, many of which were obsolete or hardware-dependent, and none of which supported safe modular programming. After many iterations beginning with an original Straw man proposal the eventual programming language was named Ada.
The total number of high-level programming languages in use for such projects fell from over in to 37 by The HOLWG working group crafted the Steelman language requirements , a series of documents stating the requirements they felt a programming language should satisfy. Many existing languages were formally reviewed, but the team concluded in that no existing language met the specifications. In April , after public scrutiny, the Red and Green proposals passed to the next phase.
This proposal was influenced by the language LIS that Ichbiah and his group had developed in the s. In , C. Hoare took advantage of his Turing Award speech to criticize Ada for being overly complex and hence unreliable,  but subsequently seemed to recant in the foreword he wrote for an Ada textbook. Its backers and others predicted that it might become a dominant language for general purpose programming and not only defense-related work.
Ada Lovelace In , the US Department of Defense began to require the use of Ada the Ada mandate for all software,  though exceptions to this rule were often granted. It featured advanced distributed processing, a distributed Ada database, and object-oriented design. Ada is also used in other air traffic systems, e. Work has continued on improving and updating the technical content of the Ada language. Language constructs[ edit ] Ada is an ALGOL -like programming language featuring control structures with reserved words such as if, then, else, while, for, and so on.
However, Ada also has many data structuring facilities and other abstractions which were not included in the original ALGOL 60 , such as type definitions , records , pointers , enumerations. Such constructs were in part inherited from or inspired by Pascal. This declaration in turn is not based on the internal representation of the type but on describing the goal which should be achieved.
This allows the compiler to determine a suitable memory size for the type, and to check for violations of the type definition at compile time and run time i. Ada supports numerical types defined by a range, modulo types, aggregate types records and arrays , and enumeration types. Access types define a reference to an instance of a specified type; untyped pointers are not permitted.
Special types provided by the language are task types and protected types. Private types can only be accessed and limited types can only be modified or copied within the scope of the package that defines them. Control structures[ edit ] Ada is a structured programming language, meaning that the flow of control is structured into standard statements. All standard constructs and deep-level early exit are supported, so the use of the also supported " go to " commands is seldom needed.
Put "Iteration: " ; Ada. Put i ; Ada. Example: Package specification example. Each package, procedure or function can have its own declarations of constants, types, variables, and other procedures, functions and packages, which can be declared in any order.
Concurrency[ edit ] Ada has language support for task-based concurrency. The fundamental concurrent unit in Ada is a task, which is a built-in limited type.
Tasks are specified in two parts — the task declaration defines the task interface similar to a type declaration , the task body specifies the implementation of the task. Depending on the implementation, Ada tasks are either mapped to operating system threads or processes, or are scheduled internally by the Ada runtime. Tasks can have entries for synchronisation a form of synchronous message passing. Task entries are declared in the task specification. Each task entry can have one or more accept statements within the task body.
If the control flow of the task reaches an accept statement, the task is blocked until the corresponding entry is called by another task similarly, a calling task is blocked until the called task reaches the corresponding accept statement.
Task entries can have parameters similar to procedures, allowing tasks to synchronously exchange data. Ada also offers protected objects for mutual exclusion. Protected objects are a monitor-like construct, but use guards instead of conditional variables for signaling similar to conditional critical regions.
Protected objects combine the data encapsulation and safe mutual exclusion from monitors, and entry guards from conditional critical regions. The main advantage over classical monitors is that conditional variables are not required for signaling, avoiding potential deadlocks due to incorrect locking semantics. Like tasks, the protected object is a built-in limited type, and it also has a declaration part and a body.
A protected object consists of encapsulated private data which can only be accessed from within the protected object , and procedures, functions and entries which are guaranteed to be mutually exclusive with the only exception of functions, which are required to be side effect free and can therefore run concurrently with other functions. A task calling a protected object is blocked if another task is currently executing inside the same protected object, and released when this other task leaves the protected object.
Blocked tasks are queued on the protected object ordered by time of arrival. Protected object entries are similar to procedures, but additionally have guards. If a guard evaluates to false, a calling task is blocked and added to the queue of that entry; now another task can be admitted to the protected object, as no task is currently executing inside the protected object.
Guards are re-evaluated whenever a task leaves the protected object, as this is the only time when the evaluation of guards can have changed. Calls to entries can be requeued to other entries with the same signature. A task that is requeued is blocked and added to the queue of the target entry; this means that the protected object is released and allows admission of another task.
The select statement in Ada can be used to implement non-blocking entry calls and accepts, non-deterministic selection of entries also with guards , time-outs and aborts. The following example illustrates some concepts of concurrent programming in Ada.
APSE — a specification for a programming environment to support software development in Ada Ravenscar profile — a subset of the Ada tasking features designed for safety-critical hard real-time computing SPARK programming language — a programming language consisting of a highly restricted subset of Ada, annotated with meta information describing desired component behavior and individual runtime requirements.
II Highlights of Ada 95
The introductory part is a general discussion of the scope and objectives of Ada 95 and its major technical features. The second part contains a more detailed step by step account of the core language. The third part consists of several annexes addressing the predefined environment and specialized application areas. Book Description Part One: Introduction to Ada 95 This first part is designed to give the reader a general appreciation of the overall scope and objectives of Ada 95 and its main technical features. The opening chapter describes the background to the development of the requirements leading to the new standard.
Rationale for Ada 2012
Copyright Contents Index Previous Next II Highlights of Ada 95 The brightest highlights of Ada 95 are its inherent reliability and its ability to provide abstraction through the package and private type. These features already exist in Ada 83 and so in a real sense Ada 83 already contains the best of Ada Indeed, Ada 83 is already a very good language. However, time and technology do not stand still, and Ada 95 is designed to meet increased requirements which have arisen from three directions. These are: feedback from the use of existing paradigms; additional market requirements to match evolving hardware capability; and increased fundamental understanding which has introduced new paradigms. As we will see, Ada 95 follows on from the tradition of excellence of Ada 83 and meets these additional requirements in an outstanding manner. One of the great strengths of Ada 83 is its reliability.
Ada 95 Rationale