The Clean IDE is the kernel of the Clean System which forms the interface to the programmer and communicates with the other system components. To illustrate what the new IDE looks like and how to work with it we show on this page what you have to do to compile a simple program, the "Game of Life". The program shown here uses the object I/O library. While we explain what to do to generate an application, we also show you some of the options of the Clean IDE. If you work with the IDE, remember that
The IDE is entirely written in Clean. So, the IDE is also an example of a Clean program, and not a small one either! The 2.0 version of the IDE is currently only available on the Wintel platform. On the other platforms a much more restricted and older version of the IDE is available which is not discussed here.
Making a project and generating an application
Start the Clean IDE (CleanIDE.exe). You see an empty project window. First we have to make a new project (or open an existing project). A Clean program consists of definition modules (.dcl files) and implementation modules (.icl files). A definition module indicates which definitions defined in the corresponding implementation module are exported. The topmost root module (the main module) is always an implementation module.
Open the main module of the "Game of Life" , LifeGameExample.icl (in ObjectIO Examples, Life folder). The source text of this Clean implementation module will be displayed in a text window and can be modified with the built-in editor (see below).
We now make a new Clean project, which will have LifeGameExample as main module.
Choose "New Project..." and a new project will be made. The project administration needs to be saved in a file (e.g. LifeGameExample.prj). The name of the main module (LifeGameExample) will appear in the project window.
The LifeGameExample uses other Clean modules, namely modules from the StdEnv library and modules from the Object I/O library. Each project has an environment in which it is specified which libraries are being used in the project.
The IDE has a couple of popular environments predefined. You have to choose which one you would like to use in this particular project. From the "Environment" menu choose "Object IO". Now the IDE knows which libraries to use in this project.
By the way, one can define new environments ("New Environment...") or change existing ones ("Edit Current..."). One can set the libraries to be used, by adding the paths of the folders in which the corresponding Clean source modules can be found. In the environments one can also include "real" libraries containing object code (Static Libraries and Dynamic Libraries). One can even define which IDE components (Tools) to use (which Clean compiler, e.g. version 1.3 or version 2.0 , which linker, and so on). In this way you can easily assign your own preferences to a project or switch from settings just by choosing another environment setting. The environments will be remembered by the IDE, the chosen environment will be remembered in the project administration file.
In addition to the environment you might also want to use more project specific libraries which you might have created to structure your projects, but, which are too specific to put in an environment. For example, the Life Game has a help facility. The corresponding Clean modules are put in a separate folder to be shared by other examples.
Choose "Project Options..." from the "Project" menu, select the "Paths" panel and add the library "ObjectIO Examples\gui utilities" to the Life Game project paths.
Now all libraries used by the "LifeGameExample" are included and we can generate the application. Of course, next time, when you open the Life Game project, everything is remembered and you can start right away with compilation.
From the "Project" menu choose "Update and Run" . All Clean modules used by "LifeGameExample" will appear in the project window. Those modules which are not up to date will be compiled to abc code. If no errors are found, the code generator will translate all abc-files to object code. Finally, the linker will build the application. If everything is fine, the Clean IDE will launch the application automatically.
Make new life cells in the window of the Life Game application by clicking with the mouse in de window and choose "Play" from the "Commands" menu.
Some features of the editor
The text editor uses syntax coloring for keywords, characters, strings, tabs, comments and backgrounds. You can set your own colors. Different kind of colors can be chosen for the different types of windows. Also fonts, font size and tab size can be set. There are several kinds of windows: for displaying implementation modules, definition modules, type information, errors and warnings, search results, project information, text files). Drag and drop of files is supported.
The various editor commands can be completely customized as well.
One can search for a piece of text in a window. The search string can be indicated by a regular expression. One can also do a global search to find all occurrences of a certain identifier (in the project, in the environment). The search facility knows about Clean language constructs (e.g. it will skip comments). It can find the definition or the implementation of an identifier, but it e.g. can also find all instances of a certain class. The editor can check whether brackets are balanced (also for list and record brackets). One can easily jump to the next error or next search result found.
The Clean compiler is a very fast one. It includes a fast and smart strictness analyzer (abstract reduction) leading to more efficient code. The compiler can also reuse space occupied by uniquely typed objects. For each implementation module you can set the appropriate compiler / code generation options.