Mary (programming language)
Kongsberg Våpenfabrikk SM-4, Norsk Data Nord-10/ND-100, Univac-1100 series, ND-100/Sintran-III, i386, SPARC | |
---|---|
Influenced by | |
ALGOL 68 |
Mary is a programming language designed and implemented by RUNIT at Trondheim, Norway in the 1970s. It borrowed many features from ALGOL 68 but was designed for systems programming (machine-oriented programming).
An unusual feature of its syntax was that expressions were constructed using the conventional
Similar to C, several language features appear to have existed to allow producing reasonably well optimised code, despite a quite primitive code generator in the compiler. These included operators similar to the +=
et alter in C and explicit register declarations for variables.
Notable features:
- Dataflow syntax – values flow from left to right, including assignment
- Most constructs could be used in expressions: blocks, IF, CASE, etc.
- Text-based recursive macros
- Overloaded user-defined operators, not constrained to predefined identifiers as in C++
- Automatic building and dereferencing of pointers from type context
- Scalar range types
- Array and set enumeration in loop iterators
- Dynamic array descriptors (ROW)
A book describing Mary was printed in 1974 (Fourth and last edition in 1979): Mary Textbook by Reidar Conradi & Per Holager.
Compilers were made for
Mary is no longer maintained.
Example
BEGIN INT i := 10; %% Variable with initial value. REF INT ri := i; %% Pointer initialized to point to i. INT j := 11; j :- REF INT =: ri; %% Type conversion and assignment %% ri now points to j. i =: (ri :- VAL REF INT); %% Assignment and type conversion %% ri points to j so j is changed. IF j > 10 %% Conditional statement with result THEN %% used inside an arithmetic expression. 1 ELSE 2 FI + j =: j; END