File extension:
.adb
.ads
(like mli file in ocaml)Attributes of a name are accessed using '
(called a
'tick')
Integer'size
Ada is case insensitive.
Comments: starts with --
Functions are called 'subprograms'
Apparently, we can't control variance of subtypes in ada.
Strong typing
SPARK
ARM: Ada reference manual
GNAT: ada compiler that is part of gcc
gnatmake: basic build manager
gprbuild: gnat project manager
Alire: a package manager for ada
Community: https://groups.google.com/g/comp.lang.ada/ (looks unmoderated though..)
Emacs mode: https://www.gnu.org/software/emacs/manual/html_mono/ada-mode.html
limited
: makes assignment to declared variable
impossible
const
in cpp.with Ada.Text_IO;
use Ada.Text_IO;
procedure Hello is begin
("Hello world!");
Put_Line end Hello;
https://gcc.gnu.org/onlinedocs/gnat_ugn/Running-a-Simple-Ada-Program.html
with
: make a package available to current fileuse
: opens the namespace ??gnatmake
or
gprbuild
'Image and ~'Value
Convert a value to string and vice-versa.
declare
: Integer := 10;
X begin
-- "10"
(Integer'Image (X));
Put_Line
-- 20
:= Integer'Value ("20");
X end;
-- A new type. Like {x: Integer | x ∈ [0,23]}
type Hours24 is new Integer range 0 .. 23;
-- A subtype
subtype Hours is Hours24 range 0 .. 11;
-- a char array of size 10
: array (0 .. 9) of Character; Name
type Day is
(Mon,
,
Tue,
Wed,
Thu,
Fri,
Sat); Sun
Representation clause ?? can be used if needed:
for Day use
(Mon => 10,
=> 11,
Tue => 12,
Wed => 13,
Thu => 14,
Fri => 15,
Sat => 16); Sun
https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Developer/chapters/05_Type_System.html
parallel
blocks