Jump to content

Alma-0

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by DavidGries (talk | contribs) at 14:36, 9 November 2022 (links to "Krzysztof R. Apt"). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Alma-0
Paradigmmulti-paradigm: constraint, imperative, logic
FamilyWirth Modula
Designed byKrzysztof Apt, Marc Bezem, Jacob Brunekree, Vincent Partington, Andrea Schaerf
DeveloperCentrum Wiskunde & Informatica
First appeared1997; 27 years ago (1997)
Typing disciplinestatic
ScopeLexical (static)
Websitewww.cwi.nl/en/alma
Major implementations
Alma-0
Influenced by
Modula-2

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 ability.[1] 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.[2] Alma-0 provides natural, high-level constructs for building search trees.[3]

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
  • 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.

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

  1. ^ Liu, Jed; Myers, Andrew C. (2003). JMatch: Iterable Abstract Pattern Matching for Java. Vol. 2562/2003. pp. 110–127. doi:10.1007/3-540-36388-2_9. ISBN 978-3-540-00389-2. {{cite book}}: |journal= ignored (help)
  2. ^ Partington, Vincent (July 1997). Implementation of an Imperative Programming Language with Backtracking (PDF) (Report). University of Amsterdam Programming, Research Group. Retrieved 15 February 2021. Also in Postscript.
  3. ^ Van Hentenryck, Pascal; Perron, Laurent; Puget, Jean-François (October 2000). "Search and strategies in OPL". ACM Transactions on Computational Logic. 1 (2): 285–320. CiteSeerX 10.1.1.17.836. doi:10.1145/359496.359529. S2CID 15926704.