Alma-0 is a
multi-paradigm
Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms.
Some paradigms are concerned mainly with implications for the execution model of the language, su ...
computer
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 ...
. This language is an augmented version of the imperative
Modula-2
Modula-2 is a structured, procedural programming language developed between 1977 and 1985/8 by Niklaus Wirth at ETH Zurich. It was created as the language for the operating system and application software of the Lilith personal workstation. It ...
language with logic-programming features and convenient
backtracking
Backtracking is a class of algorithms for finding solutions to some computational problems, notably constraint satisfaction problems, that incrementally builds candidates to the solutions, and abandons a candidate ("backtracks") as soon as it d ...
ability. It is small,
strongly typed, and combines
constraint programming
Constraint programming (CP) is a paradigm for solving combinatorial problems that draws on a wide range of techniques from artificial intelligence, computer science, and operations research. In constraint programming, users declaratively state t ...
, a limited number of features inspired by
logic programming
Logic programming is a programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic prog ...
and supports
imperative paradigms
In science and philosophy, a paradigm () is a distinct set of concepts or thought patterns, including theories, research methods, postulates, and standards for what constitute legitimate contributions to a field.
Etymology
''Paradigm'' comes ...
. The language advocates
declarative programming
In computer science, declarative programming is a programming paradigm—a style of building the structure and elements of computer programs—that expresses the logic of a computation without describing its control flow.
Many languages that ...
. The designers claim that search-oriented solutions built with it are substantially simpler than their counterparts written in purely imperative or logic programming style. Alma-0 provides natural, high-level constructs for building search trees.
Overview
Since the designers of Alma-0 wanted to create a distinct and substantially simpler proposal than prior attempts to integrate declarative programming constructs (such as automatic backtracking) into imperative programming, the design of Alma-0 was guided by four principles:
* The logic-based extension should be ''downward'' compatible with the underlying imperative programming language
* The logic-based extension should be ''upward'' compatible with a future extension that will support
constraint programming
Constraint programming (CP) is a paradigm for solving combinatorial problems that draws on a wide range of techniques from artificial intelligence, computer science, and operations research. In constraint programming, users declaratively state t ...
* The constructs that will implement the extension should support and encourage declarative programming
* The extension should be kept small: nine new features have been proposed and implemented
Alma-0 can be viewed not only as a specific and concrete programming language proposal, but also as an example of a ''generic method'' for extending any imperative programming language with features that support declarative programming.
The feasibility of the Alma-0 approach has been demonstrated through a full implementation of the language (including a description of its semantics) for a subset of
Modula-2
Modula-2 is a structured, procedural programming language developed between 1977 and 1985/8 by Niklaus Wirth at ETH Zurich. It was created as the language for the operating system and application software of the Lilith personal workstation. It ...
.
Features
The implemented features in Alma-0 include:
*Use of boolean expressions as statements and vice versa
*A dual for the
FOR
statement that introduces non-determinism in the form of ''choice points'' and ''backtracking''
*A
FORALL
statement that introduces a controlled form of iteration over the backtracking
*
Unification which, although limited to the use of equality as assignment, yields a new
parameter-passing mechanism.
Imperative and logic programming modes
The Alma-0 designers claim that the assignment, which is usually shunned in pure declarative and logic programming, is actually needed in a number of natural situations, including for counting and recording purposes. They also affirm that the means of expression of such "natural" uses of assignment within the logic programming paradigm are unnatural.
References
* Jacob Brunekreef (1998)
"Annotated Algebraic Specification of the Syntax and Semantics of the Programming Language Alma-0"
*
Krzysztof R. Apt, Jacob Brunekreef, Vincent Partington, Andrea Schaerf (1998)
"Alma-0: An Imperative Language that Supports Declarative Programming"
*
Krzysztof R. Apt, Andrea Schaerf (1998)
"Programming in Alma-0, or Imperative and Declarative Programming Reconciled"
*
Krzysztof R. Apt, Andrea Schaerf (1998)
"Integrating Constraints into an Imperative Programming Language"
*
Krzysztof R. Apt, Andrea Schaerf (1999)
"The Alma Project, or How First-Order Logic Can Help Us in Imperative Programming"
{{Modula, Oberon
Modula programming language family
Systems programming languages
Procedural programming languages
Logic programming languages
Multi-paradigm programming languages
Programming languages created in the 20th century
Constraint programming languages