The Ada programming language was the first language that called itself memory-safe (which is actually Memory Sanitize).
It was officially released in 1983 as a programming language for critical and real-time systems, with the goal of unifying and improving the reliability of software used by the United States government.
It was designed to solve the problems of portability, reliability and maintainability of software in embedded and real-time systems, especially in areas such as defense and aerospace.
Ada was created to replace previous programming languages, such as Fortran, C, ALGOL, and PL/1, which were used in the military environment, but with many interoperability and reliability problems. The first version of the Ada compiler was written in Assembly, but, like any modern language, Ada was later implemented by compilers written in it, becoming self-sufficient.
To have Ada(GNAT) on your system, simply use your operating system’s package manager.
Examples with: winget, Chocolatey, Scoop, APT, Brew and others on Windows, macOS, Ubuntu and other systems. Or even download the pre-compiled binaries for your system directly from the official GNAT website: https://www.adacore.com/download (Follow the instructions and add it to your PATH to easily use it in the terminal).
Examples:
Chocolatey on Windows:
choco install gnat
To install Chocolatey you can use PowerShell:
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
Scoop on Windows:
scoop bucket add extras
scoop install gnat
To install Scoop:
iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
.
Brew on macOS:
brew install gnat
If you don’t have Brew installed, run:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
.
APT on Ubuntu:
sudo apt install gnat
Once properly installed, test the version:
gnat --version
Example output:
GNAT 13.3.0
Copyright (C) 1996-2023, Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Getting started with Ada.
Use the .adb
extension to create Ada code, for example: main.adb
with Ada.Text_IO;
procedure Hello is
begin
Ada.Text_IO.Put_Line("Hello, Ada!");
end Hello;
Compile and run:
gnatmake main.adb
./main
If you want to have the complete Ada development environment on your system, install the development tools:
Text editors;
and Appropriate debuggers.
You can install additional packages such as gprbuild
(for compiling Ada projects) and gnat-gps
(an IDE for Ada):
sudo apt install gprbuild gnat-gps
For more information, visit the official address: https://www.adacore.com/ and Wikipedia.