Clean System

From Clean
Revision as of 14:55, 27 August 2018 by Bas Lijnse (talk | contribs) (Removed the most outdated parts of the Clean system description. The whole page should still be rewritten.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

The Clean System is a software development system for developing applications in Clean. The Clean System is available on multiple platforms (Windows, Linux & macOS).


The Clean Integrated Development Environment

The Clean System is a lean and stable system that comes with a dedicated Integrated program Development Environment, the Clean IDE. It consists of a dedicated editor and project manager which enables the programmer to generate and launch an application with just the push of a button. The Clean IDE is written in Clean using Clean's GUI-library, the Object I/O Library.

The Clean IDE is currently only available on Windows. On the other platforms (Linux and macOS) command line tools are available to build and manage your clean projects.

Static-compilation-steps.jpg

The Clean Compiler

The Clean Compiler is the most important component. Clean is a modular language consisting of definition modules (.dcl files) and implementation modules (.icl files). The Clean Compiler translates Clean source code to platform independent ABC-code (.abc files), a byte code for the abstract ABC machine.

CleanToAbc.jpg

The Code Generator

The Clean Code Generator is written in C (for historical reasons) and translates ABC-code into very efficient native object code (.obj or .o files).

AbcToObj.jpg

The Code Generator can generate code for different types of processors.

The Static Linker

Finally, the Static Linker which is written in Clean combines all the object code and special code (the Clean Run Time System including automatic garbage collectors) into an executable application.

StaticLinker.jpg

The Static Linker is an optimizing linker, it will not link in unused functions. It can also link in C code. There are several kinds of Clean libraries available which can help to reduce the amount of code you have to write significantly. Some linkers also (will) have the possibility to combine several object modules into one library module.

Time and Space profiling

The IDE communicates with other tools which can help you to write better programs.

IDE Linkers.jpg

There is a Time Profiler to measure the amount of time functions are consuming. Time consuming functions can be tuned by writing better algorithms or by using one of the many facilities Clean offers to speed up execution (strictness annotations, uniqueness typing).

There is a Heap Profiler to measure the space consumption which can help you to find "space leaks".

The Dynamic Linker

On Windows an alternative for the static linker is available, the Dynamic Linker which is again written in Clean. The Dynamic Linker does the same work as the Static Linker, but the difference is that the Dynamic Linker links object code to a running Clean application.

DynamicLinking.gif

An executing Clean application can communicate with the Dynamic Linker and request to plug-in some Clean function defined in some specific Clean module. If the object code is not available the Dynamic Linker can ask the Code Generator to generate it just-in-time. It would also be possible to ask the Clean Compiler to compile Clean source code just-in-time (this option is not chosen because you might run into compilation errors). The Dynamic Linker can also deal with Dynamics, a new feature of Clean 2.0. Dynamics are dynamically typed Clean expressions that can be stored on disk with just one Clean function call. Dynamics can contain code as well as data and when they are read in their types can be checked dynamically via pattern matching.