Mary is a
programming language
A programming language is a system of notation for writing computer programs. Most programming languages are text-based formal languages, but they may also be graphical. They are a kind of computer language.
The description of a programming ...
designed and implemented by
RUNIT
runit is an init and service management scheme for Unix-like operating systems that initializes, supervises, and ends processes throughout the operating system. Runit is a reimplementation of the daemontools process supervision toolkit that r ...
at
Trondheim
Trondheim ( , , ; sma, Tråante), historically Kaupangen, Nidaros and Trondhjem (), is a city and municipality in Trøndelag county, Norway. As of 2020, it had a population of 205,332, was the third most populous municipality in Norway, and ...
,
Norway
Norway, officially the Kingdom of Norway, is a Nordic country in Northern Europe, the mainland territory of which comprises the western and northernmost portion of the Scandinavian Peninsula. The remote Arctic island of Jan Mayen and t ...
in the 1970s. It borrowed many features from
ALGOL 68
ALGOL 68 (short for ''Algorithmic Language 1968'') is an imperative programming language that was conceived as a successor to the ALGOL 60 programming language, designed with the goal of a much wider scope of application and more rigorously de ...
but was designed for
systems programming Systems programming, or system programming, is the activity of programming computer system software. The primary distinguishing characteristic of systems programming when compared to application programming is that application programming aims to pr ...
(machine-oriented programming).
An unusual feature of its syntax was that expressions were constructed using the conventional
infix
An infix is an affix inserted inside a word stem (an existing word or the core of a family of words). It contrasts with ''adfix,'' a rare term for an affix attached to the outside of a stem, such as a prefix or suffix.
When marking text for int ...
operators, but all of them had the same precedence and evaluation went from left to right unless there were brackets. Assignment had the destination on the right and assignment was considered just another operator.
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
Register or registration may refer to:
Arts entertainment, and media Music
* Register (music), the relative "height" or range of a note, melody, part, instrument, etc.
* ''Register'', a 2017 album by Travis Miller
* Registration (organ), th ...
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++
C++ (pronounced "C plus plus") is a high-level general-purpose programming language created by Danish computer scientist Bjarne Stroustrup as an extension of the C programming language, or "C with Classes". The language has expanded significan ...
* 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
Kongsberg Våpenfabrikk
Kongsberg Gruppen is an international technology group headquartered in Norway, that supplies high-technology systems to customers in the merchant marine, defence, aerospace, offshore oil and gas industries, and renewable and utilities industri ...
's SM-4 and
Norsk Data
Norsk Data was a minicomputer manufacturer located in Oslo, Norway. Existing from 1967 to 1998, it had its most active period from the early 1970s to the late 1980s. At the company's peak in 1987, it was the second largest company in Norway and em ...
Nord-10/ND-100 mini-computers. The original Mary compiler was written in NU
ALGOL
ALGOL (; short for "Algorithmic Language") is a family of imperative computer programming languages originally developed in 1958. ALGOL heavily influenced many other languages and was the standard method for algorithm description used by the ...
, ran on the Univac-1100 series and was used to bootstrap a native compiler for
ND-100/
Sintran-III.
RUNIT
runit is an init and service management scheme for Unix-like operating systems that initializes, supervises, and ends processes throughout the operating system. Runit is a reimplementation of the daemontools process supervision toolkit that r ...
implemented a
CHILL
In computing, CHILL (an acronym for CCITT High Level Language) is a procedural programming language designed for use in telecommunication switches (the hardware used inside telephone exchanges). The language is still used for legacy systems i ...
compiler written in Mary which ran on ND-100 and had
Intel 8086
The 8086 (also called iAPX 86) is a 16-bit microprocessor chip designed by Intel between early 1976 and June 8, 1978, when it was released. The Intel 8088, released July 1, 1979, is a slightly modified chip with an external 8-bit data bus (allowi ...
and
80286
The Intel 80286 (also marketed as the iAPX 286 and often called Intel 286) is a 16-bit microprocessor that was introduced on February 1, 1982. It was the first 8086-based CPU with separate, non- multiplexed address and data buses and also the ...
targets. When this compiler was ported to the
VAX
VAX (an acronym for Virtual Address eXtension) is a series of computers featuring a 32-bit instruction set architecture (ISA) and virtual memory that was developed and sold by Digital Equipment Corporation (DEC) in the late 20th century. The V ...
platform, a common backend for Mary and CHILL was implemented. Later, backends for
i386
The Intel 386, originally released as 80386 and later renamed i386, is a 32-bit microprocessor introduced in 1985. The first versions had 275,000 transistors[SPARC
SPARC (Scalable Processor Architecture) is a reduced instruction set computer (RISC) instruction set architecture originally developed by Sun Microsystems. Its design was strongly influenced by the experimental Berkeley RISC system developed ...]
were available. Since the Mary compiler was implemented in Mary, it was possible to run the compiler on all these platforms.
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
See also
*
ALGOL 68
ALGOL 68 (short for ''Algorithmic Language 1968'') is an imperative programming language that was conceived as a successor to the ALGOL 60 programming language, designed with the goal of a much wider scope of application and more rigorously de ...
{{ALGOL programming
ALGOL 68 dialect
Norsk Data software
Kongsberg Gruppen