An Interface to LFPL Prototype Compiler by Nick Brown
This form allows you to try out Nick Brown's prototype
implementation of the programming language described in Martin
Hofmann's paper
A type system for bounded space
and functional in-place update
presented at ESOP'00.
Things to note
-
For the concrete syntax see page 18 of Nick Brown's
project dissertation
and the
examples.
-
The generated code consists of C-functions between integers,
lists, binary trees. To get a C executable these must contain
a function named main of type ()int. In order to get useful
standalone programs the following built-in primitives have
been added:
-
new : ()diamond
. Generates a "diamond"
using malloc()
.
-
disp : (diamond)int
. Frees one diamond,
returns 0.
-
read_int : ()[int,int]
. Reads an integer x
from stdin. Returns [1,x] if successful and [0,?]
otherwise.
-
print_int : (int)int
. Prints an integer to
stdout. Returns 0.
-
print_string(
string)
. Prints a
string constant.
-
The semicolon operator: e1;e2 evaluates e1, then e2,
returns value of e2.
See file io in the examples directory for an application.
-
The generated code represents lists as structures containing a
field kind. The empty list is represented as a structure with
kind field equal to NIL. The generated code thus does not use
the optimisation which represents the empty list as a NULL
pointer.
-
The implementation does not check that all functions declared
are implemented.
-
This is experimental code and likely to be changed.
Type a program
or start with the
examples
(reverse, quick, treesort, flatten, breadth, bad, io)
:
Other compilers available:
Borel
,
by Robert Atkey
Back to the main project page.
Michal Konečnư
Last modified: Fri Feb 21 14:30:18 GMT 2003