|• Building ECL:||Building Embeddable Common Lisp from sources.|
|• Invoking ECL:||Basic skills.|
|• The break loop:|
|• Embedding ECL:|
Due to its portable nature ECL works on every (at least) 32-bit architecture which provides a proper C99 compliant compiler.
Operating systems on which ECL is reported to work: Linux, Darwin (Mac OS X), Solaris, FreeBSD, NetBSD, OpenBSD, DragonFly BSD, Windows and Android. On each of them ECL supports native threads.
In the past Juanjo José García-Ripoll maintained test farm which performed ECL tests for each release on number of platforms and architectures. Due to lack of the resources we can’t afford such doing, however each release is tested by volunteers with an excellent package cl-test-grid created and maintained by Anton Vodonosov.
ECL, like many other FOSS programs, can be built and installed with a GNU tool called Autoconf. This is a set of automatically generated scripts that detect the features of your machine, such as the compiler type, existing libraries, desired installation path, and configures ECL accordingly. The following procedure describes how to build ECL using this procedure and it applies to all platforms except for the Windows ports using Microsoft Visual Studio compilers (however you may build ECL with cygwin or mingw using the autoconf as described here).
To build Embeddable Common Lisp you need to
$ tar -xf ecl-xx.x.x.tgz $ cd ecl-xx.x.x
$ ./configure --prefix=/usr/local $ make # -jX if you have X cores $ make install
$ /usr/local/bin/ecl ECL (Embeddable Common-Lisp) 16.0.0 Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya Copyright (C) 1993 Giuseppe Attardi Copyright (C) 2000 Juan J. Garcia-Ripoll Copyright (C) 2015 Daniel Kochmanski ECL is free software, and you are welcome to redistribute it under certain conditions; see file 'Copyright' for details. Type :h for Help. Top level in: #<process TOP-LEVEL>. >
If you have a commercial version of Microsoft Visual Studio, the steps are simple:
If you want to build ECL using the free Microsoft Visual Studio Express 2013 or better, you should follow these before building ECL as sketched before:
Embeddable Common Lisp is invoked by the command
% ecl ECL (Embeddable Common-Lisp) 0.0e Copyright (C) 1984 Taiichi Yuasa and Masami Hagiya Copyright (C) 1993 Giuseppe Attardi Copyright (C) 2000 Juan J. Garcia-Ripoll Copyright (C) 2015 Daniel Kochmanski ECL is free software, and you are welcome to redistribute it under certain conditions; see file 'Copyright' for details. Type :h for Help. Top level. Top level in: #<process TOP-LEVEL>. >
When invoked, Embeddable Common Lisp will print the banner and initialize the system.
The number in the Embeddable Common Lisp banner identifies the revision of
Embeddable Common Lisp.
0.0e is the value of the function
Unless user specifies
-norc flag when invoking the Embeddable Common Lisp, it
will look for the initialization files ~/.ecl and
~/.eclrc. If he wants to load his own file from the current
directory, then he should pass the file path to the
% ecl -norc -load init.lisp
After the initialization, Embeddable Common Lisp enters the top-level loop and
prints the prompt ‘
Type :h for Help. Top level. >
The prompt indicates that Embeddable Common Lisp is now ready to receive a form from the terminal and to evaluate it.
Usually, the current package (i.e., the value of *package*) is the user package, and the prompt appears as above. If, however, the current package is other than the user package, then the prompt will be prefixed with the package name.
> (in-package "CL") #<"COMMON-LISP" package> COMMON-LISP> (in-package "SYSTEM") #<"SI" package> SI>
To exit from Embeddable Common Lisp, call the function
> (quit) %
Alternatively, you may type ^Dwhile pressing down the control key (Ctrl).
> ^D %
The top-level loop of Embeddable Common Lisp is almost the same as that defined in Section 20.2 of [see Steele:84]. Since the input from the terminal is in line mode, each top-level form should be followed by a newline. If more than one value is returned by the evaluation of the top-level form, the values will be printed successively. If no value is returned, then nothing will be printed.
> (values 1 2) 1 2 > (values) >
When an error is signalled, control will enter the break loop.
> (defun foo (x) (bar x)) foo > (defun bar (y) (bee y y)) bar > (foo 'lish) Condition of type: UNDEFINED-FUNCTION The function BAR is undefined. Available restarts: 1. (RESTART-TOPLEVEL) Go back to Top-Level REPL. Broken at FOO. In: #<process TOP-LEVEL>. >>
>>’ in the last line is the prompt of the break loop. Like in
the top-level loop, the prompt will be prefixed by the current package
name, if the current package is other than the
To go back to the top-level loop, type
>>:q Top level in: #<process TOP-LEVEL>. >
If more restarts are present, user may invoke them with by typing
:rN, where N is the restart number. For instance to pick
the restart number two, type
See [The break loop] for the details of the break loop.
The terminal interrupt (usually caused by typing ^C(Control-
C)) is a kind of error. It breaks the running program
and calls the break level loop.
> (defun foo () (do () (nil))) foo > (foo) ^C Condition of type: INTERACTIVE-INTERRUPT Console interrupt. Available restarts: 1. (CONTINUE) CONTINUE 2. (RESTART-TOPLEVEL) Go back to Top-Level REPL. Broken at FOO. In: #<process TOP-LEVEL>. >>