Ada is a
structured
Structuring, also known as smurfing in banking jargon, is the practice of executing financial transactions such as making bank deposits in a specific pattern, calculated to avoid triggering financial institutions to file reports required by law ...
,
statically typed,
imperative, and
object-oriented
Object-oriented programming (OOP) is a programming paradigm based on the concept of " objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of p ...
high-level programming language
In computer science, a high-level programming language is a programming language with strong abstraction from the details of the computer. In contrast to low-level programming languages, it may use natural language ''elements'', be easier to us ...
, extended from
Pascal and other languages. It has built-in language support for ''
design by contract'' (DbC), extremely
strong typing, explicit concurrency, tasks, synchronous message passing, protected objects, and
non-determinism. Ada improves code safety and maintainability by using the
compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
to find errors in favor of
runtime errors. Ada is an
international
International is an adjective (also used as a noun) meaning "between nations".
International may also refer to:
Music Albums
* ''International'' (Kevin Michael album), 2011
* ''International'' (New Order album), 2002
* ''International'' (The T ...
technical standard
A technical standard is an established norm or requirement for a repeatable technical task which is applied to a common and repeated use of rules, conditions, guidelines or characteristics for products or related processes and production methods, ...
, jointly defined by the
International Organization for Standardization
The International Organization for Standardization (ISO ) is an international standard development organization composed of representatives from the national standards organizations of member countries. Membership requirements are given in Art ...
(ISO), and the
International Electrotechnical Commission (IEC). , the standard, called Ada 2012 informally, is ISO/IEC 8652:2012.
Ada was originally designed by a team led by French
computer scientist Jean Ichbiah
Jean David Ichbiah (25 March 1940 – 26 January 2007) was a French computer scientist and the initial chief designer (1977–1983) of Ada, a general-purpose, strongly typed programming language with certified validated compilers.
Ea ...
of
CII Honeywell Bull
Bull SAS (also known as Groupe Bull, Bull Information Systems, or simply Bull) is a French computer company headquartered in Les Clayes-sous-Bois, in the western suburbs of Paris. The company has also been known at various times as Bull General ...
under contract to the
United States Department of Defense
The United States Department of Defense (DoD, USDOD or DOD) is an executive branch department of the federal government charged with coordinating and supervising all agencies and functions of the government directly related to national secu ...
(DoD) from 1977 to 1983 to supersede over 450 programming languages used by the DoD at that time.
Ada was named after
Ada Lovelace (1815–1852), who has been credited as the first computer programmer.
Features
Ada was originally designed for
embedded and
real-time
Real-time or real time describes various operations in computing or other processes that must guarantee response times within a specified time (deadline), usually a relatively short time. A real-time process is generally one that happens in defined ...
systems. The Ada 95 revision, designed by S. Tucker Taft of
Intermetrics
AverStar (formerly Intermetrics, Inc.) was a software company founded in Cambridge, Massachusetts in 1969 by several veterans of M.I.T.'s Instrumentation Laboratory who had worked on the software for NASA's Apollo Program including the Apollo ...
between 1992 and 1995, improved support for systems, numerical, financial, and
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
(OOP).
Features of Ada include:
strong typing,
modular programming
Modular programming is a software design technique that emphasizes separating the functionality of a Computer program, program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of th ...
mechanisms (packages),
run-time checking
Runtime error detection is a software verification method that analyzes a software application as it executes and reports defects that are detected during that execution. It can be applied during unit testing, component testing, integration test ...
,
parallel processing (
tasks, synchronous
message passing
In computer science, message passing is a technique for invoking behavior (i.e., running a program) on a computer. The invoking program sends a message to a process (which may be an actor or object) and relies on that process and its support ...
, protected objects, and nondeterministic
select statements),
exception handling
In computing and computer programming, exception handling is the process of responding to the occurrence of ''exceptions'' – anomalous or exceptional conditions requiring special processing – during the execution of a program. In general, an ...
, and
generics. Ada 95 added support for
object-oriented programming
Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of pr ...
, including
dynamic dispatch
In computer science, dynamic dispatch is the process of selecting which implementation of a polymorphic operation (method or function) to call at run time. It is commonly employed in, and considered a prime characteristic of, object-oriented ...
.
The syntax of Ada minimizes choices of ways to perform basic operations, and prefers English keywords (such as "or else" and "and then") to symbols (such as ", , " and "&&"). Ada uses the basic arithmetical operators "+", "-", "*", and "/", but avoids using other symbols. 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.g., ''if ... end if'', ''loop ... end loop''). In the case of conditional blocks this avoids a ''
dangling else
The dangling else is a problem in programming of parser generators in which an optional else clause in an if–then(–else) statement results in nested conditionals being ambiguous. Formally, the reference context-free grammar of the language i ...
'' 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.) either during compile-time, or otherwise during run-time. As concurrency is part of the language specification, the compiler can in some cases detect potential deadlocks. Compilers also commonly check for misspelled identifiers, visibility of packages, redundant declarations, etc. and can provide warnings and useful suggestions on how to fix the error.
Ada also supports run-time checks to protect against access to unallocated memory,
buffer overflow
In information security and programming, a buffer overflow, or buffer overrun, is an anomaly whereby a program, while writing data to a buffer, overruns the buffer's boundary and overwrites adjacent memory locations.
Buffers are areas of memo ...
errors, range violations,
off-by-one error
An off-by-one error or off-by-one bug (known by acronyms OBOE, OBO, OB1 and OBOB) is a logic error involving the discrete equivalent of a boundary condition. It often occurs in computer programming when an iterative loop iterates one time too m ...
s, 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
In the context of hardware and software systems, formal verification is the act of proving or disproving the correctness of intended algorithms underlying a system with respect to a certain formal specification or property, using formal metho ...
. For these reasons, Ada is widely used in critical systems, where any
anomaly might lead to very serious consequences, e.g., accidental death, injury or severe financial loss. Examples of systems where Ada is used include
avionics
Avionics (a blend of ''aviation'' and ''electronics'') are the electronic systems used on aircraft. Avionic systems include communications, navigation, the display and management of multiple systems, and the hundreds of systems that are fit ...
,
air traffic control
Air traffic control (ATC) is a service provided by ground-based air traffic controllers who direct aircraft on the ground and through a given section of controlled airspace, and can provide advisory services to aircraft in non-controlled airs ...
, railways, banking, military and space technology.
Ada's dynamic
memory management
Memory management is a form of resource management applied to computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and free it for reuse when ...
is high-level and type-safe. Ada has no generic or untyped
pointers
Pointer may refer to:
Places
* Pointer, Kentucky
* Pointers, New Jersey
* Pointers Airport, Wasco County, Oregon, United States
* The Pointers, a pair of rocks off Antarctica
People with the name
* Pointer (surname), a surname (including a lis ...
; 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
Non-uniform memory access (NUMA) is a computer memory design used in multiprocessing, where the memory access time depends on the memory location relative to the processor. Under NUMA, a processor can access its own local memory faster than non ...
). 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
Waste collection is a part of the process of waste management. It is the transfer of solid waste from the point of use and disposal to the point of treatment or landfill. Waste collection also includes the curbside collection of recyclabl ...
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
In computer science, region-based memory management is a type of memory management in which each allocated object is assigned to a region. A region, also called a zone, arena, area, or memory context, is a collection of allocated objects that ca ...
; 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
The dash is a punctuation mark consisting of a long horizontal line. It is similar in appearance to the hyphen but is longer and sometimes higher from the baseline. The most common versions are the endash , generally longer than the hyphen b ...
("--"), 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 "--". While clearly denoting disabled code with a column of repeated "--" down the page this renders the experimental dis/re-enablement of large blocks a more drawn out process.
The semicolon (";") is a
statement terminator
This comparison of programming languages compares the features of language syntax (format) for over 50 computer programming languages.
Expressions
Programming language expressions can be broadly classified into four syntax structures:
;pre ...
, and the null or no-operation statement is
null;
. A single
;
without a statement to terminate is not allowed.
Unlike most
ISO
ISO is the most common abbreviation for the International Organization for Standardization.
ISO or Iso may also refer to: Business and finance
* Iso (supermarket), a chain of Danish supermarkets incorporated into the SuperBest chain in 2007
* Iso ...
standards, the Ada language definition (known as the ''Ada Reference Manual'' or ''ARM'', or sometimes the ''Language Reference Manual'' or ''LRM'') is
free content. 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.
One notable
free software
Free software or libre software is computer software distributed under terms that allow users to run the software for any purpose as well as to study, change, and distribute it and any adapted versions. Free software is a matter of liberty, no ...
tool that is used by many Ada programmers to aid them in writing Ada source code is the
GNAT Programming Studio
GNAT Programming Studio (GPS, formerly known as the GNAT Programming System) is a free multi-language integrated development environment (IDE) by AdaCore. GPS uses compilers from the GNU Compiler Collection, taking its name from GNAT, the GNU co ...
, and
GNAT
A gnat () is any of many species of tiny flying insects in the dipterid suborder Nematocera, especially those in the families Mycetophilidae, Anisopodidae and Sciaridae. They can be both biting and non-biting. Most often they fly in large ...
which is part of the
GNU Compiler Collection
The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software ...
.
History
In the 1970s the
US Department of Defense
The United States Department of Defense (DoD, USDOD or DOD) is an executive branch department of the federal government charged with coordinating and supervising all agencies and functions of the government directly related to national secu ...
(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. In 1975, a
working group
A working group, or working party, is a group of experts working together to achieve specified goals. The groups are domain-specific and focus on discussion or activity around a specific subject area. The term can sometimes refer to an interdis ...
, the
High Order Language Working Group The High Order Language Working Group (HOLWG) was a working group instrumental in developing the Ada computer programming language. The group was established in 1975 with the goal of establishing a single high-level programming language appropriate ...
(HOLWG), was formed with the intent to reduce this number by finding or creating a programming language generally suitable for the department's and the
UK Ministry of Defence
The Ministry of Defence (MOD or MoD) is the department responsible for implementing the defence policy set by His Majesty's Government, and is the headquarters of the British Armed Forces.
The MOD states that its principal objectives are to ...
's requirements. After many iterations beginning with an origina
Straw man proposalthe eventual programming language was named Ada. The total number of high-level programming languages in use for such projects fell from over 450 in 1983 to 37 by 1996.
HOLWG 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 1977 that no existing language met the specifications.
Requests for proposals for a new programming language were issued and four contractors were hired to develop their proposals under the names of Red (
Intermetrics
AverStar (formerly Intermetrics, Inc.) was a software company founded in Cambridge, Massachusetts in 1969 by several veterans of M.I.T.'s Instrumentation Laboratory who had worked on the software for NASA's Apollo Program including the Apollo ...
led by Benjamin Brosgol), Green (
CII Honeywell Bull
Bull SAS (also known as Groupe Bull, Bull Information Systems, or simply Bull) is a French computer company headquartered in Les Clayes-sous-Bois, in the western suburbs of Paris. The company has also been known at various times as Bull General ...
, led by
Jean Ichbiah
Jean David Ichbiah (25 March 1940 – 26 January 2007) was a French computer scientist and the initial chief designer (1977–1983) of Ada, a general-purpose, strongly typed programming language with certified validated compilers.
Ea ...
), Blue (
SofTech
SofTech, Inc. was a computer software company with offices in the United States and headquarters established in Lowell, Massachusetts. SofTech was a significant provider of software engineering tools and solutions in the 1970's as well as Product ...
, led by John Goodenough) and Yellow (
SRI International
SRI International (SRI) is an American nonprofit scientific research institute and organization headquartered in Menlo Park, California. The trustees of Stanford University established SRI in 1946 as a center of innovation to support economic ...
, led by Jay Spitzen). In April 1978, after public scrutiny, the Red and Green proposals passed to the next phase. In May 1979, the Green proposal, designed by Jean Ichbiah at CII Honeywell Bull, was chosen and given the name Ada—after
Augusta Ada, Countess of Lovelace. This proposal was influenced by the language
LIS that Ichbiah and his group had developed in the 1970s. The preliminary Ada reference manual was published in ACM SIGPLAN Notices in June 1979. The Military Standard reference manual was approved on December 10, 1980 (
Ada Lovelace's birthday), and given the number MIL-STD-1815 in honor of Ada Lovelace's birth year. In 1981,
C. A. R. Hoare took advantage of his
Turing Award
The ACM A. M. Turing Award is an annual prize given by the Association for Computing Machinery (ACM) for contributions of lasting and major technical importance to computer science. It is generally recognized as the highest distinction in comput ...
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.
Ada attracted much attention from the programming community as a whole during its early days. Its backers and others predicted that it might become a dominant language for general purpose programming and not only defense-related work.
Ichbiah publicly stated that within ten years, only two programming languages would remain: Ada and
Lisp.
Early Ada compilers struggled to implement the large, complex language, and both compile-time and run-time performance tended to be slow and tools primitive.
Compiler vendors expended most of their efforts in passing the massive, language-conformance-testing, government-required
Ada Compiler Validation Capability
Ada may refer to:
Places
Africa
* Ada Foah, a town in Ghana
* Ada (Ghana parliament constituency)
* Ada, Osun, a town in Nigeria
Asia
* Ada, Urmia, a village in West Azerbaijan Province, Iran
* Ada, Karaman, a village in Karaman Province, Tu ...
(ACVC) validation suite that was required in another novel feature of the Ada language effort.
The Jargon File
The Jargon File is a glossary and usage dictionary of slang used by computer programmers. The original Jargon File was a collection of terms from technical cultures such as the MIT AI Lab, the Stanford AI Lab (SAIL) and others of the old ARPANET A ...
, a dictionary of computer hacker slang originating in 1975–1983, notes in a
entry on Adathat "it is precisely what one might expect given that kind of endorsement by fiat; designed by committee...difficult to use, and overall a disastrous, multi-billion-dollar boondoggle...Ada Lovelace...would almost certainly blanch at the use her name has been latterly put to; the kindest thing that has been said about it is that there is probably a good small language screaming to get out from inside its vast, elephantine bulk."
The first validated Ada implementation was the NYU Ada/Ed translator, certified on April 11, 1983. NYU Ada/Ed is implemented in the high-level set language
SETL
SETL (SET Language) is a very high-level programming language based on the mathematical theory of sets. It was originally developed by (Jack) Jacob T. Schwartz at the New York University (NYU) Courant Institute of Mathematical Sciences in the ...
. Several commercial companies began offering Ada compilers and associated development tools, including
Alsys Alsys, SA. (founded 1980, merged 1995) was a software development company created to support initial work on the Ada programming language.
In July 1995, Alsys merged to become Thomson Software Products (TSP), which merged into Aonix in 1996.
Hist ...
,
TeleSoft TeleSoft, Inc. (sometimes written Telesoft) was an American software development company founded in 1981 and based in San Diego, California, that specialized in development tools for the Ada programming language.
History
In 1981, University of Cali ...
,
DDC-I
DDC-I, Inc. is a privately held company providing software development of real-time operating systems, software development tools, and software services for Life-critical system, safety-critical embedded applications, headquartered in Phoenix, Ari ...
,
Advanced Computer Techniques
Advanced Computer Techniques (ACT) was a computer software company most active from the early 1960s through the early 1990s that made software products, especially language compilers and related tools. It also engaged in information technology con ...
,
Tartan Laboratories
Tartan Laboratories, Inc., later renamed Tartan, Inc., was an American software company founded in 1981 and based in Pittsburgh, Pennsylvania, that specialized in programming language compilers, especially for the language Ada. It was based on wor ...
,
Irvine Compiler Irvine may refer to:
Places On Earth Antarctica
*Irvine Glacier
*Mount Irvine (Antarctica)
Australia
* Irvine Island
*Mount Irvine, New South Wales
Canada
* Irvine, Alberta
* Irvine Inlet, Nunavut
United Kingdom
*Irvine, North Ayrshire, Scot ...
,
TLD Systems
TLD Systems, Ltd. was an American software company active in the 1980s and 1990s and based in Torrance, California, that specialized in language compilers for the JOVIAL and Ada programming languages that were targeted to embedded systems.
TLD ...
, and
Verdix
Verdix Corporation was an American software company active in the 1980s and 1990s and based in Fairfax County, Virginia, that specialized in language compilers for the Ada programming language.
Verdix was founded in 1982 by George Cowan and Donn ...
.
Computer manufacturers who had a significant business in the defense, aerospace, or related industries, also offered Ada compilers and tools on their platforms; these included
Concurrent Computer Corporation
Concurrent Computer Corporation was an American computer company, in existence from 1985 to 2017, that made real-time computing and parallel processing systems. Its products powered a variety of applications including process control, simulators ...
,
Cray Research, Inc.
Cray Inc., a subsidiary of Hewlett Packard Enterprise, is an American supercomputer manufacturer headquartered in Seattle, Washington. It also manufactures systems for data storage and analytics. Several Cray supercomputer systems are listed i ...
,
Harris Computer Systems
Harris Computer Systems Corporation was an American computer company, in existence during the mid-1990s, that made real-time computing systems. Its products powered a variety of applications, including those for aerospace simulation, Data acquis ...
, and
Siemens Nixdorf Informationssysteme AG
Siemens Nixdorf Informationssysteme, AG (SNI) was formed in 1990 by the merger of Nixdorf Computer and the Data Information Services (DIS) division of Siemens.
It functioned as a separate company within Siemens.
It was the largest information ...
.
In 1991, 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.
The Department of Defense Ada mandate was effectively removed in 1997, as the DoD began to embrace commercial off-the-shelf (
COTS) technology.
Similar requirements existed in other
NATO
The North Atlantic Treaty Organization (NATO, ; french: Organisation du traité de l'Atlantique nord, ), also called the North Atlantic Alliance, is an intergovernmental military alliance between 30 member states – 28 European and two No ...
countries: Ada was required for NATO systems involving command and control and other functions, and Ada was the mandated or preferred language for defense-related applications in countries such as Sweden, Germany, and Canada.
By the late 1980s and early 1990s, Ada compilers had improved in performance, but there were still barriers to fully exploiting Ada's abilities, including a tasking model that was different from what most real-time programmers were used to.
Because of Ada's
safety-critical
A safety-critical system (SCS) or life-critical system is a system whose failure or malfunction may result in one (or more) of the following outcomes:
* death or serious injury to people
* loss or severe damage to equipment/property
* environme ...
support features, it is now used not only for military applications, but also in commercial projects where a software bug can have severe consequences, e.g.,
avionics
Avionics (a blend of ''aviation'' and ''electronics'') are the electronic systems used on aircraft. Avionic systems include communications, navigation, the display and management of multiple systems, and the hundreds of systems that are fit ...
and
air traffic control
Air traffic control (ATC) is a service provided by ground-based air traffic controllers who direct aircraft on the ground and through a given section of controlled airspace, and can provide advisory services to aircraft in non-controlled airs ...
, commercial rockets such as the
Ariane 4 and 5,
satellite
A satellite or artificial satellite is an object intentionally placed into orbit in outer space. Except for passive satellites, most satellites have an electricity generation system for equipment on board, such as solar panels or radioisotope ...
s and other space systems, railway transport and banking.
For example, the
Airplane Information Management System, the
fly-by-wire
Fly-by-wire (FBW) is a system that replaces the conventional manual flight controls of an aircraft with an electronic interface. The movements of flight controls are converted to electronic signals transmitted by wires, and flight control ...
system software in the
Boeing 777
The Boeing 777, commonly referred to as the Triple Seven, is an American long-range wide-body airliner developed and manufactured by Boeing Commercial Airplanes. It is the world's largest twinjet.
The 777 was designed to bridge the gap betw ...
, was written in Ada.
Developed by
Honeywell Air Transport Systems in collaboration with consultants from
DDC-I
DDC-I, Inc. is a privately held company providing software development of real-time operating systems, software development tools, and software services for Life-critical system, safety-critical embedded applications, headquartered in Phoenix, Ari ...
, it became arguably the best-known of any Ada project, civilian or military.
The Canadian Automated Air Traffic System was written in 1 million lines of Ada (
SLOC count). It featured advanced
distributed processing
A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...
, a distributed Ada database, and object-oriented design. Ada is also used in other air traffic systems, e.g., the UK's next-generation Interim Future Area Control Tools Support () air traffic control system is designed and implemented using
SPARK
Spark commonly refers to:
* Spark (fire), a small glowing particle or ember
* Electric spark, a form of electrical discharge
Spark may also refer to:
Places
* Spark Point, a rocky point in the South Shetland Islands
People
* Spark (surname)
* ...
Ada.
It is also used in the
French TVM in-
cab signalling
Cab signaling is a railway safety system that communicates track status and condition information to the cab, crew compartment or driver's compartment of a locomotive, railcar or multiple unit. The information is continually updated giving an e ...
system on the
TGV
The TGV (french: Train à Grande Vitesse, "high-speed train"; previously french: TurboTrain à Grande Vitesse, label=none) is France's intercity high-speed rail service, operated by SNCF. SNCF worked on a high-speed rail network from 1966 to 19 ...
high-speed rail system, and the metro suburban trains in Paris, London, Hong Kong and New York City.
Standardization
Preliminary Ada can be found i
ACM Sigplan Notices Vol 14, No 6, June 1979
Ada was first published in 1980 as an
ANSI
The American National Standards Institute (ANSI ) is a private non-profit organization that oversees the development of voluntary consensus standards for products, services, processes, systems, and personnel in the United States. The organi ...
standard ANSI/MIL-STD 1815. As this very first version held many errors and inconsistencies (se
Summary of Ada Language Changes, the revised edition was published in 1983 as ANSI/MIL-STD 1815A. Without any further changes, it became an ISO standard in 1987
This version of the language is commonly known as Ada 83, from the date of its adoption by ANSI, but is sometimes referred to also as Ada 87, from the date of its adoption by ISO. This is th
There is also a French translation; DIN translated it into German as DIN 66268 in 1988.
Ada 95, the joint ISO/IEC/ANSI standar
(se
Ada 95 RM was published in February 1995, making it the first ISO standard object-oriented programming language. To help with the standard revision and future acceptance, the
US Air Force
The United States Air Force (USAF) is the air service branch of the United States Armed Forces, and is one of the eight uniformed services of the United States. Originally created on 1 August 1907, as a part of the United States Army Sig ...
funded the development of the
GNAT
A gnat () is any of many species of tiny flying insects in the dipterid suborder Nematocera, especially those in the families Mycetophilidae, Anisopodidae and Sciaridae. They can be both biting and non-biting. Most often they fly in large ...
Compiler
In computing, a compiler is a computer program that translates computer code written in one programming language (the ''source'' language) into another language (the ''target'' language). The name "compiler" is primarily used for programs tha ...
. Presently, the GNAT Compiler is part of the
GNU Compiler Collection
The GNU Compiler Collection (GCC) is an optimizing compiler produced by the GNU Project supporting various programming languages, hardware architectures and operating systems. The Free Software Foundation (FSF) distributes GCC as free software ...
.
Work has continued on improving and updating the technical content of the Ada language. A Technical Corrigendum to Ada 95 was published in October 2001
ISO/IEC 8652:1995/Corr 1:2001(se
, and a major Amendment
(se
was published on March 9, 2007, commonly known as Ada 2005 because work on the new standard was finished that year.
At the Ada-Europe 2012 conference in Stockholm, the Ada Resource Association (ARA) and Ada-Europe announced the completion of the design of the latest version of the Ada language and the submission of the reference manual to the
ISO/IEC JTC 1/SC 22 ISO/IEC JTC 1/SC 22 Programming languages, their environments and system software interfaces is a standardization subcommittee of the Joint Technical Committee ISO/IEC JTC 1 of the International Organization for Standardization (ISO) and the Interna ...
/WG 9 of the
International Organization for Standardization
The International Organization for Standardization (ISO ) is an international standard development organization composed of representatives from the national standards organizations of member countries. Membership requirements are given in Art ...
(ISO) and the
International Electrotechnical Commission (IEC) for approval
ISO/IEC 8652:2012(se
was published in December 2012, known as Ada 2012. A technical corrigendum was publishe
(se
.
Despite the names Ada 83, 95 etc., legally there is only one Ada standard, the one of the last ISO/IEC standard: with the acceptance of a new standard version, the previous one becomes withdrawn. The other names are just informal ones referencing a certain edition.
Other related standards include
ISO/IEC 8651-3:1988 ''Information processing systems—Computer graphics—Graphical Kernel System (GKS) language bindings—Part 3: Ada''.
Language constructs
Ada is an
ALGOL
ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
-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
A record, recording or records may refer to:
An item or collection of data Computing
* Record (computer science), a data structure
** Record, or row (database), a set of fields in a database related to one entity
** Boot sector or boot record, r ...
,
pointers
Pointer may refer to:
Places
* Pointer, Kentucky
* Pointers, New Jersey
* Pointers Airport, Wasco County, Oregon, United States
* The Pointers, a pair of rocks off Antarctica
People with the name
* Pointer (surname), a surname (including a lis ...
,
enumerations
An enumeration is a complete, ordered listing of all the items in a collection. The term is commonly used in mathematics and computer science to refer to a listing of all of the elements of a set. The precise requirements for an enumeration (fo ...
. Such constructs were in part inherited from or inspired by
Pascal.
"Hello, world!" in Ada
A common example of a language's
syntax is the
Hello world program
''Hello'' is a salutation or greeting in the English language. It is first attested in writing from 1826. Early uses
''Hello'', with that spelling, was used in publications in the U.S. as early as the 18 October 1826 edition of the '' Norwich ...
:
(hello.adb)
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line ("Hello, world!");
end Hello;
This program can be compiled by using the freely available open source compiler
GNAT
A gnat () is any of many species of tiny flying insects in the dipterid suborder Nematocera, especially those in the families Mycetophilidae, Anisopodidae and Sciaridae. They can be both biting and non-biting. Most often they fly in large ...
, by executing
gnatmake hello.adb
Data types
Ada's type system is not based on a set of predefined
primitive types
In computer science, primitive data types are a set of basic data types from which all other data types are constructed. Specifically it often refers to the limited set of data representations in use by a particular processor, which all compiled pr ...
but allows users to declare their own types. 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.e., range violations, buffer overruns, type consistency, etc.). 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.
For example, a date might be represented as:
type Day_type is range 1 .. 31;
type Month_type is range 1 .. 12;
type Year_type is range 1800 .. 2100;
type Hours is mod 24;
type Weekday is (Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday);
type Date is
record
Day : Day_type;
Month : Month_type;
Year : Year_type;
end record;
Important to note: Day_type, Month_type, Year_type, Hours are incompatible types, meaning that for instance the following expression is illegal:
Today: Day_type := 4;
Current_Month: Month_type := 10;
... Today + Current_Month ... -- illegal
The predefined plus-operator can only add values of the same type, so the expression is illegal.
Types can be refined by declaring
subtypes:
subtype Working_Hours is Hours range 0 .. 12; -- at most 12 Hours to work a day
subtype Working_Day is Weekday range Monday .. Friday; -- Days to work
Work_Load: constant array(Working_Day) of Working_Hours -- implicit type declaration
:= (Friday => 6, Monday => 4, others => 10); -- lookup table for working hours with initialization
Types can have modifiers such as ''limited, abstract, private'' etc. Private types do not show their inner structure; objects of limited types cannot be copied.
Ada 95 adds further features for object-oriented extension of types.
Control structures
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
GoTo (goto, GOTO, GO TO or other case combinations, depending on the programming language) is a statement found in many computer programming languages. It performs a one-way transfer of control to another line of code; in contrast a function c ...
" commands is seldom needed.
-- while a is not equal to b, loop.
while a /= b loop
Ada.Text_IO.Put_Line ("Waiting");
end loop;
if a > b then
Ada.Text_IO.Put_Line ("Condition met");
else
Ada.Text_IO.Put_Line ("Condition not met");
end if;
for i in 1 .. 10 loop
Ada.Text_IO.Put ("Iteration: ");
Ada.Text_IO.Put (i);
Ada.Text_IO.Put_Line;
end loop;
loop
a := a + 1;
exit when a = 10;
end loop;
case i is
when 0 => Ada.Text_IO.Put ("zero");
when 1 => Ada.Text_IO.Put ("one");
when 2 => Ada.Text_IO.Put ("two");
-- case statements have to cover all possible cases:
when others => Ada.Text_IO.Put ("none of the above");
end case;
for aWeekday in Weekday'Range loop -- loop over an enumeration
Put_Line ( Weekday'Image(aWeekday) ); -- output string representation of an enumeration
if aWeekday in Working_Day then -- check of a subtype of an enumeration
Put_Line ( " to work for " &
Working_Hours'Image (Work_Load(aWeekday)) ); -- access into a lookup table
end if;
end loop;
Packages, procedures and functions
Among the parts of an Ada program are packages, procedures and functions.
Example:
Package specification (example.ads)
package Example is
type Number is range 1 .. 11;
procedure Print_and_Increment (j: in out Number);
end Example;
Package body (example.adb)
with Ada.Text_IO;
package body Example is
i : Number := Number'First;
procedure Print_and_Increment (j: in out Number) is
function Next (k: in Number) return Number is
begin
return k + 1;
end Next;
begin
Ada.Text_IO.Put_Line ( "The total is: " & Number'Image(j) );
j := Next (j);
end Print_and_Increment;
-- package initialization executed when the package is elaborated
begin
while i < Number'Last loop
Print_and_Increment (i);
end loop;
end Example;
This program can be compiled, e.g., by using the freely available open-source compiler
GNAT
A gnat () is any of many species of tiny flying insects in the dipterid suborder Nematocera, especially those in the families Mycetophilidae, Anisopodidae and Sciaridae. They can be both biting and non-biting. Most often they fly in large ...
, by executing
gnatmake -z example.adb
Packages, procedures and functions can nest to any depth, and each can also be the logical outermost block.
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
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. In conjunction with ''select'' statements it is possible to define ''guards'' on accept statements (similar to Dijkstra's
guarded commands The Guarded Command Language (GCL) is a programming language defined by Edsger Dijkstra for predicate transformer semantics in EWD472. It combines programming concepts in a compact way. It makes it easier to develop a program and its proof hand-in-h ...
).
Ada also offers ''
protected object
Protection is any measure taken to guard a thing against damage caused by outside forces. Protection can be provided to physical objects, including organisms, to systems, and to intangible things like civil and political rights. Although th ...
s'' for
mutual exclusion
In computer science, mutual exclusion is a property of concurrency control, which is instituted for the purpose of preventing race conditions. It is the requirement that one thread of execution never enters a critical section while a concurrent ...
. 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.
with Ada.Text_IO; use Ada.Text_IO;
procedure Traffic is
type Airplane_ID is range 1..10; -- 10 airplanes
task type Airplane (ID: Airplane_ID); -- task representing airplanes, with ID as initialisation parameter
type Airplane_Access is access Airplane; -- reference type to Airplane
protected type Runway is -- the shared runway (protected to allow concurrent access)
entry Assign_Aircraft (ID: Airplane_ID); -- all entries are guaranteed mutually exclusive
entry Cleared_Runway (ID: Airplane_ID);
entry Wait_For_Clear;
private
Clear: Boolean := True; -- protected private data - generally more than only a flag...
end Runway;
type Runway_Access is access all Runway;
-- the air traffic controller task takes requests for takeoff and landing
task type Controller (My_Runway: Runway_Access) is
-- task entries for synchronous message passing
entry Request_Takeoff (ID: in Airplane_ID; Takeoff: out Runway_Access);
entry Request_Approach(ID: in Airplane_ID; Approach: out Runway_Access);
end Controller;
-- allocation of instances
Runway1 : aliased Runway; -- instantiate a runway
Controller1: Controller (Runway1'Access); -- and a controller to manage it
------ the implementations of the above types ------
protected body Runway is
entry Assign_Aircraft (ID: Airplane_ID)
when Clear is -- the entry guard - calling tasks are blocked until the condition is true
begin
Clear := False;
Put_Line (Airplane_ID'Image (ID) & " on runway ");
end;
entry Cleared_Runway (ID: Airplane_ID)
when not Clear is
begin
Clear := True;
Put_Line (Airplane_ID'Image (ID) & " cleared runway ");
end;
entry Wait_For_Clear
when Clear is
begin
null; -- no need to do anything here - a task can only enter if "Clear" is true
end;
end Runway;
task body Controller is
begin
loop
My_Runway.Wait_For_Clear; -- wait until runway is available (blocking call)
select -- wait for two types of requests (whichever is runnable first)
when Request_Approach'count = 0 => -- guard statement - only accept if there are no tasks queuing on Request_Approach
accept Request_Takeoff (ID: in Airplane_ID; Takeoff: out Runway_Access)
do -- start of synchronized part
My_Runway.Assign_Aircraft (ID); -- reserve runway (potentially blocking call if protected object busy or entry guard false)
Takeoff := My_Runway; -- assign "out" parameter value to tell airplane which runway
end Request_Takeoff; -- end of the synchronised part
or
accept Request_Approach (ID: in Airplane_ID; Approach: out Runway_Access) do
My_Runway.Assign_Aircraft (ID);
Approach := My_Runway;
end Request_Approach;
or -- terminate if no tasks left who could call
terminate;
end select;
end loop;
end;
task body Airplane is
Rwy : Runway_Access;
begin
Controller1.Request_Takeoff (ID, Rwy); -- This call blocks until Controller task accepts and completes the accept block
Put_Line (Airplane_ID'Image (ID) & " taking off...");
delay 2.0;
Rwy.Cleared_Runway (ID); -- call will not block as "Clear" in Rwy is now false and no other tasks should be inside protected object
delay 5.0; -- fly around a bit...
loop
select -- try to request a runway
Controller1.Request_Approach (ID, Rwy); -- this is a blocking call - will run on controller reaching accept block and return on completion
exit; -- if call returned we're clear for landing - leave select block and proceed...
or
delay 3.0; -- timeout - if no answer in 3 seconds, do something else (everything in following block)
Put_Line (Airplane_ID'Image (ID) & " in holding pattern"); -- simply print a message
end select;
end loop;
delay 4.0; -- do landing approach...
Put_Line (Airplane_ID'Image (ID) & " touched down!");
Rwy.Cleared_Runway (ID); -- notify runway that we're done here.
end;
New_Airplane: Airplane_Access;
begin
for I in Airplane_ID'Range loop -- create a few airplane tasks
New_Airplane := new Airplane (I); -- will start running directly after creation
delay 4.0;
end loop;
end Traffic;
Pragmas
A pragma is a
compiler directive
In computer programming, a directive or pragma (from "pragmatic") is a language construct that specifies how a compiler (or other translator) should process its input. Directives are not part of the grammar of a programming language, and may vary ...
that conveys information to the compiler to allow specific manipulating of compiled output.
Certain pragmas are built into the language,
while others are implementation-specific.
Examples of common usage of compiler pragmas would be to disable certain features, such as run-time type checking or array subscript boundary checking, or to instruct the compiler to insert object code instead of a function call (as C/C++ does with
inline function
In the C and C++ programming languages, an inline function is one qualified with the keyword inline; this serves two purposes:
# It serves as a compiler directive that suggests (but does not require) that the compiler substitute the body of ...
s).
Generics
See also
*
APSE
In architecture, an apse (plural apses; from Latin 'arch, vault' from Ancient Greek 'arch'; sometimes written apsis, plural apsides) is a semicircular recess covered with a hemispherical vault or semi-dome, also known as an '' exedra''. ...
– a specification for a programming environment to support software development in Ada
*
Ravenscar profile The Ravenscar profile is a subset of the Ada tasking features designed for safety-critical hard real-time computing. It was defined by a separate technical report in Ada 95; it is now part of the Ada 2012 Standard. It has been named after the Englis ...
– a subset of the Ada tasking features designed for safety-critical hard real-time computing
*
SPARK (programming language)
SPARK is a formally defined computer programming language based on the Ada programming language, intended for the development of high integrity software used in systems where predictable and highly reliable operation is essential. It facilita ...
– a programming language consisting of a highly restricted subset of Ada, annotated with meta-information describing desired component behavior and individual runtime requirements
References
International standards
*
ISO/IEC 8652
ISO/IEC 8652 ''Information technology — Programming languages — Ada'' is the international standard for the computer programming language Ada. It was produced by the Ada Working Group, ISO/IEC JTC1/SC22/WG 9, of the International Orga ...
: Information technology—Programming languages—Ada
*
ISO/IEC 15291: Information technology—Programming languages—Ada Semantic Interface Specification (
ASIS)
*
ISO/IEC 18009: Information technology—Programming languages—Ada: Conformity assessment of a language processor (
ACATS)
*
IEEE Standard 1003.5b-1996, the
POSIX
The Portable Operating System Interface (POSIX) is a family of standards specified by the IEEE Computer Society for maintaining compatibility between operating systems. POSIX defines both the system- and user-level application programming inter ...
Ada binding
Ada Language Mapping Specification the
CORBA
The Common Object Request Broker Architecture (CORBA) is a standard defined by the Object Management Group (OMG) designed to facilitate the communication of systems that are deployed on diverse platforms. CORBA enables collaboration between s ...
interface description language (IDL) to Ada mapping
Rationale
These documents have been published in various forms, including print.
* Also availabl
apps.dtic.mil pdf
*
*
Books
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
* 795 pages.
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
Archives
Ada Programming Language Materials, 1981–1990 Charles Babbage Institute
The IT History Society (ITHS) is an organization that supports the history and scholarship of information technology by encouraging, fostering, and facilitating archival and historical research. Formerly known as the Charles Babbage Foundation, ...
, University of Minnesota. Includes literature on software products designed for the Ada language; U.S. government publications, including Ada 9X project reports, technical reports, working papers, newsletters; and user group information.
External links
Ada - C/C++ changer - MapuSoftDOD Ada programming language (ANSI/MIL STD 1815A-1983) specificationJTC1/SC22/WG9 ISO home of Ada Standards*
{{Authority control
Programming languages
.NET programming languages
Avionics programming languages
High Integrity Programming Language
Multi-paradigm programming languages
Programming language standards
Programming languages created in 1980
Programming languages with an ISO standard
Statically typed programming languages
Systems programming languages
1980 software
High-level programming languages