Languages Features Creators Calendar CSV Resources Blog About Pricing Add Language
GitHub icon

Ada

Ada - Programming language

< >

Ada is a programming language created in 1980 by Jean Ichbiah.

#22on PLDB 43Years Old 12.1kUsers
64Books 50Papers 5kRepos

Try now: Riju

Ada is a structured, statically typed, imperative, wide-spectrum, and object-oriented high-level computer programming language, extended from Pascal and other languages. It has built-in language support for design-by-contract, extremely strong typing, explicit concurrency, offering tasks, synchronous message passing, protected objects, and non-determinism. Ada improves code safety and maintainability by using the compiler to find errors in favor of runtime errors. Read more on Wikipedia...


Example from Compiler Explorer:
-- This pragma will remove the warning produced by the default -- CE filename and the procedure name differing, -- see : https://gcc.gnu.org/onlinedocs/gcc-8.2.0/gnat_rm/Pragma-Source_005fFile_005fName.html#Pragma-Source_005fFile_005fName pragma Source_File_Name (Square, Body_File_Name => "example.adb"); -- Type your code here, or load an example. function Square(num : Integer) return Integer is begin return num**2; end Square; -- Ada 2012 also provides Expression Functions -- (http://www.ada-auth.org/standards/12rm/html/RM-6-8.html) -- as a short hand for functions whose body consists of a -- single return statement. However they cannot be used as a -- compilation unit. -- function Square(num : Integer) return Integer is (num**2);
Example from Riju:
with Ada.Text_IO; procedure Main is begin Ada.Text_IO.Put_Line("Hello, world!"); end Main;
Example from hello-world:
with Ada.Text_IO; procedure Hello_World is use Ada.Text_IO; begin Put_line ("Hello World"); end Hello_World;
-- Hello World in Ada with Text_IO; procedure Hello_World is begin Text_IO.Put_Line("Hello World!"); end Hello_World;
Example from Wikipedia:
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 just 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;

Keywords in Ada

abort else new return abs elsif not reverse abstract end null accept entry select access exception of separate aliased exit or some all others subtype and for out synchronized array function overriding at tagged generic package task begin goto pragma terminate body private then if procedure type case in protected constant interface until is raise use declare range delay limited record when delta loop rem while digits renames with do mod requeue xor

Language features

Feature Supported Token Example
Scientific Notation ✓
Fixed Point Numbers ✓
Integers ✓
-- [0-9_]+
Floats ✓
-- [0-9_]+\.[0-9_]*
Hexadecimals ✓
-- [0-9_]+#[0-9a-f_\.]+#
Conditionals ✓
Functions ✓
While Loops ✓
Booleans ✓ True False
Strings ✓ "
"Hello world"
Assignment ✓ :=
Print() Debugging ✓ Text_IO.Put_Line
Line Comments ✓ --
-- A comment
Case Insensitive Identifiers ✓
with Gnat.Io; use Gnat.Io;
procedure Numbers is
   Score: Integer;
   F: Float := 1.0;
begin
   Score := 3 + 2#1011#;
   Put(score);
   New_Line;
   Score := Score + 1_000_000;
   Put(Score);
   New_Line;
end Numbers;
Operator Overloading ✓
Directives ✓
Comments ✓
-- A comment
Generics ✓
generic
   Max_Size : Natural; -- a generic formal value
   type Element_Type is private; -- a generic formal type; accepts any nonlimited type
package Stacks is
   type Size_Type is range 0 .. Max_Size;
   type Stack is limited private;
   procedure Create (S : out Stack;
                     Initial_Size : in Size_Type := Max_Size);
   procedure Push (Into : in out Stack; Element : in Element_Type);
   procedure Pop (From : in out Stack; Element : out Element_Type);
   Overflow : exception;
   Underflow : exception;
private
   subtype Index_Type is Size_Type range 1 .. Max_Size;
   type Vector is array (Index_Type range <>) of Element_Type;
   type Stack (Allocated_Size : Size_Type := 0) is record
      Top : Index_Type;
      Storage : Vector (1 .. Allocated_Size);
   end record;
end Stacks;
Pointers ✓
Case Sensitivity X
Semantic Indentation X
MultiLine Comments X

Books about Ada from ISBNdb

title authors year publisher
Programming in Ada 2012 Barnes, John 2014 Cambridge University Press
Ada 95: Problem Solving and Program Design (3rd Edition) Feldman, Michael B. and Koffman, Elliot B. 1999 Addison-Wesley
The Calculating Passion of Ada Byron Baum, Joan 1986 Archon Books
Programming in Ada 2005 with CD Barnes, John 2006 Pearson
Power Programming With Ada For The Ibm Pc Winters and John W. 1987 Tab Books
Ada For Multi-microprocessors (the Ada Companion Series) M. Tedd 1984 Cambridge University Press
Rendezvous with ADA 95 2e J. Naiditch, David 1995 John Wiley &Sons
Dreaming in Code: Ada Byron Lovelace, Computer Pioneer McCully, Emily Arnold 2019 Candlewick
Programming in Ada: Plus an Overview of Ada 9X (International computer science series) Barnes, J. G. P. 1993 Addison-Wesley
Ada Programming With Applications Eugen N Vasilescu 1986 Allyn And Bacon
Ada Gehani, Narain 1991 Silicon Press
Distributed Programming in ADA with Protected Objects Ledru, Pascal 1998 Dissertation.Com.
Ada Programming Success In A Day Sam Key 2015 Lulu.com
Consolidated Ada reference manual: language and standard libraries : international standard ISO/IEC 8652/1995(E) with technical corrigendum 1 N/a 2002 Springer
Programming And Problem Solving With Ada Nell Dale and Et Al 1994 Jones And Bartlett Publishers, Inc
Consolidated Ada Reference Manual Erhard Ploedereder; S. Tucker Taft; Randall L. Brukardt 20030806 Springer Nature
Beginning Ada Programming: From Novice to Professional Shvets, Andrew T. 2019 Apress
Beginning Ada Programming: From Novice to Professional Shvets, Andrew T. 2019 Apress
Ada 2012 Reference Manual. Language and Standard Libraries L. Loh 20140114 Springer Nature
Ada Lace and the Suspicious Artist (5) (An Ada Lace Adventure) Calandrelli, Emily 2019 Simon & Schuster Books for Young Readers
Introduction to Ada Programming, 2nd Edition Shvets, Andrew T. 2018 CreateSpace Independent Publishing Platform
Ada Lovelace: The Making of a Computer Scientist Hollings, Christopher and Martin, Ursula and Rice, Adrian 2018 Bodleian Library, University of Oxford
Programming in Ada 2012 with a Preview of Ada 2022 Barnes, John 2022 Cambridge University Press
Programming in Ada 95 (2nd Edition) (International Computer Science Series) Barnes, John 1998 Addison-Wesley Professional
Ada Programmer's Handbook and Language Reference Manual Gonzalez, Dean W. 1990 Addison-Wesley
Ada 95 for C and C ++ Programmers (International Computer Science Series) Johnston, Simon 1997 Addison-Wesley
Real Time Systems and Programming Languages: Ada 95, Real-Time Java and Real-Time C/POSIX (3rd Edition) Burns, Alan and Wellings, Andy 2001-04-05T00:00:01Z Addison Wesley
Programming Pioneer Ada Lovelace (STEM Trailblazer Bios) Bodden, Valerie 2016 LernerClassroom
Concurrent and Real-Time Programming in Ada Burns, Alan and Wellings, Andy 2007 Cambridge University Press
Programming and Problem Solving with Ada 95 Nell B. Dale and Chip Weems and John W. McCormick 2000 Jones & Bartlett Learning
Programming and Problem Solving with Ada 95 Nell B. Dale and Chip Weems and John W. McCormick 2000 Jones & Bartlett Learning
Building Parallel, Embedded, and Real-Time Applications with Ada McCormick, John W. and Singhoff, Frank and Hugues, Jérôme 2011-05-16T00:00:01Z Cambridge University Press
Programming in Ada 95 (International Computer Science Series) Barnes, John 1995 Pearson Education
Programming in ADA (International computer science series) Barnes, J. G. P 1984T Addison-Wesley
Software Construction and Data Structures with Ada 95 (2nd Edition) Feldman, Michael B. 1996 Addison-Wesley
Ada 95: The Craft of Object-Oriented Programming English, John 1996-10-24T00:00:01Z Prentice Hall
ADA Programming Success In A Day: Beginner’s guide to fast, easy and efficient learning of ADA programming Key, Sam 2015 CreateSpace Independent Publishing Platform
Programming in ADA (International computer science series) Barnes, J. G. P 1989T Addison-Wesley
Introduction to Programming Using Ada Volper, Dennis and Katz, Martin D. 1990 Prentice Hall
Programming in ADA Sincovec, Richard F. and Wiener, Richard 1983 Horizon Pubs & Distributors Inc
File Structures With Ada (Benjamin Cummings Series in Computer Science) Miller, Nancy E. and Petersen, Charles G. 1990 Benjamin-Cummings Pub Co
The Ada programming language: A guide for programmers Pyle, I. C 1981 Prentice Hall International
Computer Programming: From ADA Lovelace to Mark Zuckerberg (Stem Stories) Doudna, Kelly 2018 Abdo Publishing
Ada 95 Rationale: The Language - The Standard Libraries (Lecture Notes in Computer Science, 1247) 1997 Springer
Ada 2012 Rationale: The Language -- The Standard Libraries (Lecture Notes in Computer Science (8338)) Barnes, John 2013 Springer
The Programming Languages: Pascal, Modula, Chill and Ada Smedema, Kees 1983 Prentice Hall
Programming in Ada Plus Language Reference Manual (International Computer Science Series) Barnes 1991 Addison-Wesley
Rationale for the Design of the Ada Programming Language (The Ada Companion Series) Ichbiah, J. 1991 Cambridge University Press
Concepts and Semantics of Programming Languages 2: Modular and Object-oriented Constructs with OCaml, Python, C++, Ada and Java Hardin, Therese and Jaume, Mathieu and Pessaux, François and Viguie Donzeau-Gouge, Veronique 2021 Wiley-ISTE
Introduction to Ada Cooling, J. E. and Cooling, N. 1993-03-01T00:00:01Z Chapman & Hall
Reliable Software Technologies - Ada Europe 96: 1996 Ada-Europe International Conference on Reliable Software Technologies, Montreux, Switzerland, ... (Lecture Notes in Computer Science, 1088) 1996 Springer
Programming Embedded Systems With Ada Downes, Valerie A. 1982 Prentice Hall
Ada, an advanced introduction: Including reference manual for the Ada programming language (Prentice-Hall software series) Gehani, Narain 1984T Prentice-Hall
Ada Minimanual to Accompany Programming Languages Benjamin 1996 McGraw-Hill College
Problem Solving with ADA (Wiley Medical Publication) Mayoh, B. H. 1982 John Wiley & Sons
Programming Languages: Paradigm and Practice: Ada Mini-Manual Appleby 1991-11-01 McGraw Hill Higher Education
Distributed Ada: Developments and Experiences: Proceedings of the Distributed Ada '89 Symposium, University of Southampton, 11–12 December 1989 Bishop, Judy M. 1990 Cambridge University Press
Programming with Specifications: An Introduction to ANNA, A Language for Specifying Ada Programs (Monographs in Computer Science) Luckham, David 1990 Springer
Programming and Problem Solving With Ada Nell B. Dale and Chip Weems and John W. McCormick 1996 Jones & Bartlett Learning
Introduction to Abstract Data Types Using Ada Hillam, Bruce 1993 Prentice Hall
Reference Manual for the ADA Programming Language Ichbiah, Jean D. & etc. 1983 Castle House Publications Ltd
Building Parallel, Embedded, And Real-time Applications With Ada John W. McCormick and Frank Singhoff and Jérôme Hugues 2011 Cambridge University Press
Ada Programming Language: Ada Books and LLC 2010
Ada Narain Gehani 1988 Eyrolles

Publications about Ada from Semantic Scholar

title authors year citations influentialCitations
The Programming Language Ada Reference Manual American National Standards Institute, Inc. ANSI/MIL-STD-1815A-1983 G. Goos and J. Hartmanis and D. Barstow and W. Brauer and P. B. Hansen and D. Gries and D. Luckham and C. Moler and A. Pnueli and G. Seegmüller and J. Stoer and N. Wirth 1983 478 0
Rationale for the design of the Ada programming language J. Ichbiah and B. Krieg-Brueckner and B. Wichmann and J. Barnes and O. Roubine and J. Heliard 1979 423 16
The Programming Language Ada G. Goos and J. Hartmanis and W. Brauer and P. B. Hansen and D. Gries and C. Moler and G. Seegmüller and J. Stoer and N. Wirth 1983 146 1
Programming with Specifications: An Introduction to ANNA, A Language for Specifying Ada Programs D. Luckham 1990 95 1
The programming language ADA reference manual: Springer-Verlag (1981) pp 243, $7.90, DM 16.50 S. J. Young 1982 74 1
"Review of ""The Ada programming language by Ian C. Pyle"", Prentice-Hall, Inc., Englewood Cliffs, N.J., 1981." P. Hilfinger 1982 53 0
Reference Manual for the Ada Programming Language. Proposed Standard Document J. Ichbiah and B. Krieg-Brueckner and B. Wichmann and H. Ledgard and J. Heliard 1980 49 0
The ada programming language S. Saib and R. E. Fritz 1983 46 2
Guidance for the use of the Ada programming language in high integrity systems B. Wichmann 1998 44 1
The ada programming language I. Pyle 1985 42 1
The ADA programming language: Pyle, I C, Prentice-Hall International (1981) pp 293, £8.95 S. J. Young 1982 39 0
Object-Based Computing and the Ada Programming Language G. Buzzard and T. Mudge 1985 34 0
Using Ada as a programming language for robot-based manufacturing cells R. Volz and T. Mudge and D. A. Gal 1984 26 0
Programming in Ada 2012 J. Barnes 2014 17 0
Why Ada is not just another programming language J. Sammet 1983 17 0
A Survey of Real-Time Performance Benchmarks for the Ada Programming Language P. Donohoe 1987 15 0
Safe parallel programming in ada with language extensions S. Taft and B. Moore and L. M. Pinho and S. Michell 2014 13 0
Implementing Ada as the primary programming language Howard Evans and W. Patterson 1985 9 1
Converging safety and high-performance domains: Integrating OpenMP into Ada Sara Royuela and L. M. Pinho and E. Quiñones 2018 8 0
The importance of Ada programming support environments T. Standish 1899 7 0
Ada 95: An Effective Concurrent Programming Language A. Burns and A. Wellings 1996 7 0
Using Ada as the first programming language: a retrospective R. K. Allen and D. Grant and R. Smith 1996 6 0
Self-assessment procedure VIII: a self-assessment procedure dealing with the programming language Ada P. Wegner 1981 6 0
Built-in reliability in the Ada programming language T. Wu 1990 6 1
Towards a Runtime Verification Framework for the Ada Programming Language A. Pedro and D. Pereira and L. M. Pinho and J. Pinto 2014 6 0
Engineering VAX Ada for a multi-language programming environment C. Mitchell 1986 5 0
Ada as a language for programming clusters of SMPs Przemysław Stpiczyński 2003 5 1
TCOL Ada : an intermediate representation for the DOD standard programming language B. Schatz 1979 5 0
Experience with Ada as a first programming language Atanas Radensky and Emilia Zivkova and V. Petrova and Rumiana Lesseva and Christina Zascheva 1988 5 0
Some comments on ADA as a real-time programming language A. Mahjoub 1981 5 0
Can Ada be used as a primary programming language?: major problems and their solutions by means of subsets Atanas Radensky 1990 5 0
Is Ada an object oriented programming language? H. Touati 1987 5 0
Ada programming language for numerical computation T. Wu 1994 5 0
The use of the Ada language for programming a distributed system V. Downes and S. Goldsack 1980 4 1
Types in the Programming Language Ada B. Krieg-Brückner 1982 4 0
Information Technology. Programming Language. The SQL Ada Module Description Language (SAMeDL). M. Graham 1995 4 1
ADDS - A Dialogue Development System for the Ada Programming Language A. Burns and J. Robinson 1986 4 0
The Evolution of Real-Time Programming Revisited: Programming the Giotto Model in Ada 2005 A. Wellings and A. Burns 2010 3 0
AdaStreams: A Type-Based Programming Extension for Stream-Parallelism with Ada 2005 Jingun Hong and Kirak Hong and Bernd Burgstaller and Johann Blieberger 2010 3 0
VADS APSE: an integrated Ada programming support environment E. Matthews and G. Burns 1991 3 0
Some short comments on the definition and the documentation of the ADA programming language R. Nicolescu 1980 3 0
Rationale For The Design Of The Ada Programming Language S. Eberhart 2016 3 1
IAda: A language for robot programming based on Ada D. Duhaut and P. Bidaud and D. Fontaine 1992 2 0
The current programming language standards scene VIIIA: ADA A. McGettrick 1983 2 0
Why the Expressive Power of Programming Languages Such as Ada Is Needed for Future Cyber Physical Systems A. Burns 2016 2 0
Proposals for enhancement of the Ada programming language Mats Weber 1994 2 0
"Comments on the suggested implementation of tasking facilities in the ""rationale for the design of the ADA programming language""" K. Tai and K. Garrard 1980 2 0
Teaching 'Concepts of Programming Languages' with Ada T. Tempelmeier 2012 1 0
Ada programming language standardization Paul M. Cohen 1981 1 0
From Byron to the Ada Programming Language J. Barnes 2015 1 0
scala.html · ada.html · swift.html

View source

- Build the next great programming language · Search · v2023 · Day 205 · Docs · Acknowledgements · Traffic · Traffic Today · Mirrors · GitHub · feedback@pldb.com