Sign up & Download
Sign in

Multi-paradigm Declarative Languages

by Michael Hanus
Lecture Notes in Computer Science (2007)

Abstract

Declarative programming languages advocate a programming style expressing the properties of problems and their solutions rather than how to compute individual solutions. Depending on the underlying formalism to express such properties, one can distinguish different classes of declarative languages, like functional, logic, or constraint programming languages. This paper surveys approaches to combine these different classes into a single programming language.

Cite this document (BETA)

Available from www.springerlink.com
Page 1
hidden

Multi-paradigm Declarative Languages

Multi-paradigm Declarative Languages?
Michael Hanus
Institut fu¨r Informatik, CAU Kiel, D-24098 Kiel, Germany.
mh@informatik.uni-kiel.de
c© Springer-Verlag
In Proc. of the International Conference on Logic Programming, ICLP 2007.
Springer LNCS 4670, pp. 45-75, 2007
Abstract. Declarative programming languages advocate a program-
ming style expressing the properties of problems and their solutions
rather than how to compute individual solutions. Depending on the un-
derlying formalism to express such properties, one can distinguish differ-
ent classes of declarative languages, like functional, logic, or constraint
programming languages. This paper surveys approaches to combine these
different classes into a single programming language.
1 Introduction
Compared to traditional imperative languages, declarative programming lan-
guages provide a higher and more abstract level of programming that leads to
reliable and maintainable programs. This is mainly due to the fact that, in con-
trast to imperative programming, one does not describe how to obtain a solution
to a problem by performing a sequence of steps but what are the properties of
the problem and the expected solutions. In order to define a concrete declarative
language, one has to fix a base formalism that has a clear mathematical founda-
tion as well as a reasonable execution model (since we consider a programming
language rather than a specification language). Depending on such formalisms,
the following important classes of declarative languages can be distinguished:
– Functional languages: They are based on the lambda calculus and term
rewriting. Programs consist of functions defined by equations that are used
from left to right to evaluate expressions.
– Logic languages: They are based on a subset of predicate logic to ensure an
effective execution model (linear resolution). Programs consist of predicates
defined by definite clauses. The execution model is goal solving based on the
resolution principle.
– Constraint languages: They are based on constraint structures with spe-
cific methods to solve constraints. Programs consist of specifications of con-
straints of the considered application domain based on a set of primitive
constraints and appropriate combinators. Constraint languages are often
embedded in other languages where logic programming is a natural can-
didate. In this case, constraint logic programming [61] can be considered as
a generalization of logic programming where unification on Herbrand terms
is considered as a specific built-in constraint solver.
? This work was partially supported by the German Research Council (DFG) under
grant Ha 2457/5-2 and the NSF under grant CCR-0218224.
Page 2
hidden
The different declarative programming paradigms offer a variety of programming
concepts to the programmer. For instance, functional programming emphasizes
generic programming using higher-order functions and polymorphic typing, and
efficient and (under particular conditions) optimal evaluation strategies using
demand-driven evaluation, which contributes to modularity in programming [59].
Logic programming supports the computation with partial information (logic
variables) and nondeterministic search for solutions, where constraint program-
ming adds efficient constraint solving capabilities for particular domains. Since
all these features have been shown to be useful in application programming
and declarative languages are based on common grounds, it is a natural idea to
combine these worlds of programming into a single multi-paradigm declarative
language. However, the interactions between the different features are complex
in detail so that the concrete design of a multi-paradigm declarative language
is non-trivial. This is demonstrated by many different proposals and a lot of
research work on the semantics, operational principles, and implementation of
multi-paradigm declarative languages since more than two decades. In the fol-
lowing, we survey some of these proposals.
One can find two basic approaches to amalgamate functional and logic lan-
guages: either extend a functional language with logic programming features or
extend a logic language with features for functional programming. Since func-
tions can be considered as specific relations, there is a straightforward way to
implement the second approach: extend a logic language with syntactic sugar to
allow functional notation (e.g., defining equations, nested functional expressions)
which is translated by some preprocessor into the logic kernel language. A recent
approach of this kind is [25] where functional notation is added to Ciao-Prolog.
The language Mercury [83] is based on a logic programming syntax with func-
tional and higher-order extensions. Since Mercury is designed towards a highly
efficient implementation, typical logic programming features are restricted. In
particular, predicates and functions must have distinct modes so that their ar-
guments are either ground or unbound at call time. This inhibits the application
of typical logic programming techniques, like computation with partially instan-
tiated structures, so that some programming techniques developed for functional
logic programming languages [11, 43, 44] can not be applied. This condition has
been relaxed in the language HAL [33] which adds constraint solving possibilities.
However, Mercury as well as HAL are based on a strict operational semantics
that does not support optimal evaluation as in functional programming. This
is also true for Oz [82]. The computation model of Oz extends the concurrent
constraint programming paradigm [78] with features for distributed program-
ming and stateful computations. It provides functional notation but restricts
their use compared to predicates, i.e., function calls are suspended if the argu-
ments are not instantiated in order to reduce them in a deterministic way. Thus,
nondeterministic computations must be explicitly represented as disjunctions so
that functions used to solve equations require different definitions than func-
tions to rewrite expressions. In some sense, these approaches do not exploit the
semantical information provided by the presence of functions.
2

Sign up today - FREE

Mendeley saves you time finding and organizing research. Learn more

  • All your research in one place
  • Add and import papers easily
  • Access it anywhere, anytime

Start using Mendeley in seconds!

Already have an account? Sign in

Readership Statistics

12 Readers on Mendeley
by Discipline
 
by Academic Status
 
42% Ph.D. Student
 
17% Other Professional
 
8% Librarian
by Country
 
42% United States
 
17% United Kingdom
 
8% Belgium