
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.googlecode.com.

LICENSE
-------

This software is Copyright (c) 2009 by Albert Graef. The software is licensed
under the GPL (GNU General Public License) V3 or later (see the accompanying
COPYING file for details), with the following additional permissions:

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

- You may distribute code to be linked against the Pure runtime library
  (libpure.so) under version 2 of the GPL. This specifically covers plugins
  which for whatever reason are stuck with GPLv2 (such as the Gnumeric
  plugin), and need to be linked with the Pure runtime.

(Note that if you want to distribute modules to be linked with the Pure
runtime under other license terms, you need to contact the author for an
appropriate license.)

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 of LLVM is required as of Pure 0.5, recent Pure
versions (>=0.14) also support LLVM >=2.4. The batch compiler in Pure >=0.21
requires LLVM 2.5 or later. 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 1.0 (i686-pc-linux-gnu) Copyright (c) 2009 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/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
> 

Or you can compile your script to a native executable:

$ pure -c -s factorial.pure -o factorial
$ ./factorial

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 in the form of a (brief) Unix manual page
and an extensive manual in html format 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, and the online manual
by using the 'help' command inside the interpreter. The former needs the 'man'
program, the latter a html browser, w3m by default. See the INSTALL file or
the manpage for details. Or just point your browser at the following URL to
read the manual on the web: http://pure-lang.googlecode.com/svn/docs/pure.html

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 can also browse the scripts in the
lib directory, in particular prelude.pure and the modules included there,
which contain the "built-in" definitions readily available when you start up
the Pure interpreter.

Further documentation including a wiki is available at:
http://pure-lang.googlecode.com

You're also invited to join the Pure mailing list at:
http://groups.google.com/group/pure-lang

Enjoy! :)


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

<Dr.Graef at t-online.de>
http://pure-lang.googlecode.com
http://groups.google.com/group/pure-lang
