0% found this document useful (0 votes)
150 views

Clean (Programming Language)

Clean is a purely functional programming language developed since 1987 at Radboud University. It shares properties with Haskell like lazy evaluation, higher-order functions, and garbage collection. Clean uses uniqueness typing to handle mutable state and I/O more efficiently than Haskell's use of monads. Source code is compiled through several steps to an intermediate ABC machine code then to native machine code to run efficiently. The ABC machine uses a graph rewriting model of computation and an uncommon memory model to more easily target multiple architectures. Clean is available on Windows, Mac, Solaris and Linux.

Uploaded by

Rock Kim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views

Clean (Programming Language)

Clean is a purely functional programming language developed since 1987 at Radboud University. It shares properties with Haskell like lazy evaluation, higher-order functions, and garbage collection. Clean uses uniqueness typing to handle mutable state and I/O more efficiently than Haskell's use of monads. Source code is compiled through several steps to an intermediate ABC machine code then to native machine code to run efficiently. The ABC machine uses a graph rewriting model of computation and an uncommon memory model to more easily target multiple architectures. Clean is available on Windows, Mac, Solaris and Linux.

Uploaded by

Rock Kim
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Name: Tijani Kehinde Hussein

Matric No.: UJ/2016/MS/0520


Course Code: ACC 425
Course Title: Management Information System
Date: 28 June 2021

CLEAN (PROGRAMMING LANGUAGE)

INTRODUCTION
1. Clean is a general-purpose purely functional computer programming language.
For much of the language's active development history it was called Concurrent Clean,
but this was dropped at some point. Clean is being developed by a group of
researchers from the Radboud University in Nijmegen since 1987. A 2008 benchmark
showed that Clean native code performs roughly equally well as Haskell (GHC),
depending on the benchmark.
FEATURES
2. The language Clean first appeared in 1987 and is still being further developed. It
shares many properties with Haskell: referential transparency, list comprehension,
guards, garbage collection, higher order functions, currying and lazy evaluation. An
integrated development environment (IDE) for Microsoft Windows is included in the
Clean distribution. Clean deals with mutable state and I/O through a uniqueness typing
system, in contrast to Haskell's use of monads. The compiler takes advantage of the
uniqueness type system to generate more efficient code, because it knows that
anything with a uniqueness type can only be used once. Therefore, a unique value can
be changed in place.
HOW CLEAN WORKS
3. Computation is based on graph rewriting and reduction. Constants such as
numbers are graphs and functions are graph rewriting formulas. This, combined with
compilation to native code, makes Clean programs which use high abstraction run
relatively fast according to the Computer Language Benchmarks Game.
COMPILING
a. Source files (.icl) and definition files (.dcl) are translated into Core Clean, a
basic variant of Clean, in Clean.
b. Core clean is converted into Clean's platform-independent intermediate
language (.abc), implemented in C and Clean.
c. Intermediate ABC code is converted to object code (.o) using C.
UJ/2016/MS/0520 TIJANI KEHINDE HUSSEIN – ACC 425 (MIS) - 1
d. Object code is linked with other files in the module and the runtime system
and converted into a normal executable using the system linker (when available)
or a dedicated linker written in Clean on Windows.
4. Earlier Clean system versions were written completely in C, thus avoiding
bootstrapping issues. The SAPL system compiles Core Clean to JavaScript and does
not use ABC code.
THE ABC MACHINE
5. To close the gap between Core Clean, a high-level functional language, and
machine code, the ABC machine is used. This is an imperative abstract graph rewriting
machine. Generating concrete machine code from abstract ABC code is a relatively
small step, so by using the ABC machine it is much easier to target multiple
architectures for code generation. The ABC machine has an uncommon memory
model. It has a graph store to hold the Clean graph that is being rewritten. The
A(rgument)-stack holds arguments that refer to nodes in the graph store. This way, a
node's arguments can be rewritten, which is needed for pattern matching. The B(asic
value)-stack holds basic values (integers, characters, reals, etc.). While not strictly
necessary (all these elements could be nodes in the graph store as well), using a
separate stack is much more efficient. The C(ontrol)-stack holds return addresses for
flow control.
6. The runtime system, which is linked into every executable, has a print rule which
prints a node to the output channel. When a program is executed, the Start node is
printed. For this, it has to be rewritten to root normal form, after which its children are
rewritten to root normal form, etc., until the whole node is printed.
PLATFORMS
7. Clean is available for Microsoft Windows, Apple Macintosh, Solaris and Linux.
Some libraries are not available on all platforms, like Object IO which is only available
on Windows and Mac. The feature to write dynamics to files is only available on
Windows.
References
1. "Download Clean" https://clean.cs.ru.nl/Download_Clean#Clean_3.0_License)

2. "FAQ - Clean" (http://wiki.clean.cs.ru.nl/FAQ).

3. ftp://ftp.cs.ru.nl/pub/Clean/papers/2007/achp2007-CleanHaskellQuickGuide.pdf.

UJ/2016/MS/0520 TIJANI KEHINDE HUSSEIN – ACC 425 (MIS) - 2

You might also like