
PURE - The Pure programming language.
==== = ==============================

Pure is a functional programming language based on term rewriting. It has a
modern syntax featuring curried function applications, lexical closures and
equational definitions with pattern matching, and thus is somewhat similar to
languages of the Haskell and ML variety. But Pure is also a very dynamic
language, and is more like Lisp in this respect. The interpreter has an LLVM
backend to do JIT compilation, hence programs run blazingly fast and
interfacing to C modules is easy.

WHERE TO GET IT
----- -- --- --

You can find tarballs, binary packages and the svn repository at
http://pure-lang.sf.net.

LICENSE
-------

GPL V3 or later. See the accompanying COPYING file for details. Note that the
sample scripts in the examples subdir, even though they are bundled with the
sources, are considered to be in the public domain, so feel free to use them
for whatever purpose.

INSTALLATION
------------

Please see the INSTALL file for detailed instructions. On most Unix-like
systems, the usual './configure && make && sudo make install' should do the
trick. This requires GNU make and g++. For other setups, you'll probably have
to fiddle with the Makefile and the sources. You'll also need LLVM for the
compiler backend (version 2.3 or later is required as of Pure 0.5). For your
convenience, instructions for installing LLVM are also included in the INSTALL
file.

USING PURE
----- ----

To start the Pure interpreter, just type 'pure' at the command prompt. You'll
be greeted with a sign-on message, after which the interpreter leaves you at
its prompt and you can start typing definitions and expressions to be
evaluated. Use the 'quit' command to exit the interpreter (on most systems you
can also just type EOF a.k.a. Ctrl-D at the beginning of the interpreter's
command line). For instance:

Pure 0.7 (i686-pc-linux-gnu) Copyright (c) 2008 by Albert Graef
This program is free software distributed under the GNU Public License
(GPL V3 or later). Please see the COPYING file for details.
Loaded prelude from /usr/local/lib/pure-0.7/prelude.pure.

> fact n = if n>0 then n*fact (n-1) else 1;
> map fact (1..10);
[1,2,6,24,120,720,5040,40320,362880,3628800]
> quit

Of course, you can also put your definitions into a script and run that script
from the command line:

$ pure -x factorial.pure

Add the -i option to force interactive mode when executing a script, and -q to
suppress the sign-on message:

$ pure -i -q -x factorial.pure
> 

Pure scripts are just ordinary text files, which can be created with any text
editor. The distribution contains some language definition files and
programming modes to provide syntax highlighting in various popular text
editors, such as Emacs, Gedit, Kate and Vim. The Emacs mode also lets you run
the Pure interpreter in an Emacs buffer, this is probably the most convenient
interface to the interpreter if you're friends with Emacs. A syntax file for
Andre Simon's highlight program is also included, this lets you pretty-print
Pure source in various output formats such as HTML and LaTeX. You can find all
this stuff in the etc subdirectory in the source distribution, installation
instructions are included in the files.

Online documentation is available as a manual page, which contains detailed
information on how to use the interpreter and a description of the Pure
language. You can invoke the manpage with 'man pure' after installation or
using the 'help' command inside the interpreter. When using Emacs, it can be
displayed using Emacs' built-in manpage reader (the 'help' command won't work
if the interpreter is running in an Emacs buffer).

Some example programs can be found in the examples subdir in the sources; in
particular, have a look at the hello.pure program which will quickly give you
an idea how Pure programs look like. You should also browse the scripts in the
lib directory which contain the "built-in" definitions readily available when
you start up the Pure interpreter.

This is currently all you get; more elaborate documentation of the Pure
language still needs to be written. But Pure is a really simple language; if
you have some experience using FPLs then you should be able to find your way
with the manual page and the provided examples. Of course, you can also post
questions to the Pure mailing list (see http://pure-lang.sf.net).

Enjoy! :)


Albert Graef
Dept. of Computer Music
Johannes Gutenberg University of Mainz
Germany

<Dr.Graef at t-online.de>
http://pure-lang.sf.net
