Alma-0
Encyclopedia
Alma-0 is a multi-paradigm computer programming language
. This language is an augmented version of the imperative Modula-2
language with logic-programming features and convenient backtracking capability. It is small, strongly typed, and combines constraint programming
, a limited number of features inspired by logic programming
and supports imperative paradigms
. The language advocates declarative programming
, 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 the construction of search trees.
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
.
Programming language
A programming language is an artificial language designed to communicate instructions to a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely....
. This language is an augmented version of the imperative Modula-2
Modula-2
Modula-2 is a computer programming language designed and developed between 1977 and 1980 by Niklaus Wirth at ETH Zurich as a revision of Pascal to serve as the sole programming language for the operating system and application software for the personal workstation Lilith...
language with logic-programming features and convenient backtracking capability. It is small, strongly typed, and combines constraint programming
Constraint programming
Constraint programming is a programming paradigm wherein relations between variables are stated in the form of constraints. Constraints differ from the common primitives of imperative programming languages in that they do not specify a step or sequence of steps to execute, but rather the properties...
, a limited number of features inspired by logic programming
Logic programming
Logic programming is, in its broadest sense, the use of mathematical logic for computer programming. In this view of logic programming, which can be traced at least as far back as John McCarthy's [1958] advice-taker proposal, logic is used as a purely declarative representation language, and a...
and supports imperative paradigms
Programming paradigm
A programming paradigm is a fundamental style of computer programming. Paradigms differ in the concepts and abstractions used to represent the elements of a program and the steps that compose a computation A programming paradigm is a fundamental style of computer programming. (Compare with a...
. The language advocates declarative programming
Declarative programming
In computer science, declarative programming is a programming paradigm that expresses the logic of a computation without describing its control flow. Many languages applying this style attempt to minimize or eliminate side effects by describing what the program should accomplish, rather than...
, 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 the construction of search trees.
Overview
Since the designers of Alma-0 wanted to create a distinct and substantially simpler proposal than previous attempts at integration of declarative programming constructs (such as automatic backtracking) into imperative programming, the design of Alma-0 was guided by the following 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 programmingConstraint programmingConstraint programming is a programming paradigm wherein relations between variables are stated in the form of constraints. Constraints differ from the common primitives of imperative programming languages in that they do not specify a step or sequence of steps to execute, but rather the properties...
- 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
Modula-2 is a computer programming language designed and developed between 1977 and 1980 by Niklaus Wirth at ETH Zurich as a revision of Pascal to serve as the sole programming language for the operating system and application software for the personal workstation Lilith...
.
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-passingParameter (computer science)In computer programming, a parameter is a special kind of variable, used in a subroutine to refer to one of the pieces of data provided as input to the subroutine. These pieces of data are called arguments...
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.External links
- Towards an Imperative Constraint Programming Language Centrum Wiskunde & Informatica, CWI project home page
- Compiler download