type definitions, records, pointers, enumerations. 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.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, by executing gnatmake hello.adb Data types Ada's type system is not based on a set of predefined primitive types 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