Escher (programming language)
Encyclopedia
Escher is a declarative
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...

 programming language
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....

 that supports both functional programming
Functional programming
In computer science, functional programming is a programming paradigm that treats computation as the evaluation of mathematical functions and avoids state and mutable data. It emphasizes the application of functions, in contrast to the imperative programming style, which emphasizes changes in state...

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

 models, developed by J.W. Lloyd in the mid-1990s. It was designed mostly as a research and teaching vehicle. The basic view of programming exhibited by Escher and related languages is that a program is a representation of a theory in some logic framework, and the program's execution (computation) is a deduction from the theory. The logic framework for Escher is Alonzo Church
Alonzo Church
Alonzo Church was an American mathematician and logician who made major contributions to mathematical logic and the foundations of theoretical computer science. He is best known for the lambda calculus, Church–Turing thesis, Frege–Church ontology, and the Church–Rosser theorem.-Life:Alonzo Church...

's simple theory of types.

Escher, notably, supports I/O through a monadic type representing the 'outside world', in the style of Haskell
Haskell (programming language)
Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language. As a functional programming language, the...

.
One of the goals of Escher's designers was to support meta-programming, and so the language has comprehensive support for generating and transforming programs.

Examples


MODULE Lambda.
CONSTRUCT Person/0.
FUNCTION Jane, Mary, John: One -> Person.

FUNCTION Mother : Person * Person -> Boolean.
Mother(x,y) =>
x=Jane & y=Mary.

FUNCTION Wife : Person * Person -> Boolean.
Wife(x,y) =>
x=John & y=Jane.

FUNCTION PrimitiveRel : (Person * Person -> Boolean) -> Boolean.
PrimitiveRel(r) =>
r=Mother \/ r=Wife.

FUNCTION Rel : (Person * Person -> Boolean) -> Boolean.
Rel(r) =>
PrimitiveRel(r) \/
(SOME [r1,r2]
(r = LAMBDA [u] (SOME [z] (r1(Fst(u),z) & r2(z,Snd(u)))) &
PrimitiveRel(r1) & PrimitiveRel(r2))).
The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK