Q - Equational Programming Language
Massimo Dentico
m.dentico@galactica.it
Wed, 13 Sep 2000 04:51:44 +0200
Excerpt from “Q - Equational Programming Language” home page
- http://www.musikwissenschaft.uni-mainz.de/~ag/q/
==================================================================
[...]
Using Q is supposed to be fairly simple: you throw together some
equations, start the interpreter and then type in the expressions
you wish to evaluate. All this can be done with a few keystrokes,
if you use the GNU emacs Q mode supplied with the package, or the
Qpad GUI frontend under Windows95/98/NT (see screenshot).
[...]
In difference to other functional languages, Q is entirely based
on the notions of rewrite rules, reductions and irreducible
expressions (also known as normal forms) pertaining to the term
rewriting calculus. A Q "program," called a script, is simply a
collection of equations which are treated as rewrite rules and are
used to reduce expressions to normal form. The normal form of an
expression denotes its value. Q has no rigid distinction between
"constructor" and "defined" function symbols and it also allows
you to evaluate expressions containing variables. Basically, both
sides of an equation may involve arbitrary expressions. Therefore
Q can also be used as a tool for symbolic expression evaluation.
The implementation is based on an efficient left-to-right tree
pattern matching algorithm and an abstract stack machine for the
leftmost-innermost evaluation of expression trees with automatic
tail-call elimination. It also provides an (IMHO) interesting
mechanism for handling lazy evaluation by means of so-called
"special forms," and it offers some features reminiscent of object-
oriented programming by means of the "type guard" concept. A
simple symbolic debugger, which is built into the interpreter,
allows you to trace the reductions performed during evaluations.
[...]
==================================================================
--
Massimo Dentico