Name

clisp — ANSI Common Lisp compiler, interpreter and debugger.

Synopsis

clisp [[-h] | [--help]] [--version] [--license] [-help-image] [-B lisp-lib-dir] [-b] [-K linking-set] [-M mem-file] [-m memory-size] [-L language] [-N locale-dir] [-Edomain encoding] [[-q] | [--quiet] | [--silent] | [-v] | [--verbose]] [-on-error action] [-repl] [-w] [-I] [-disable-readline] [[-ansi] | [-traditional]] [-modern] [-p package] [-C] [-norc] [-lp directory...] [-i init-file...] [-c [-l] lisp-file [-o output-file]...] [-x expressions...] [lisp-file [argument...]]

Description

Invokes the Common Lisp interpreter and compiler.

Interactive Mode

When called without arguments, executes the read-eval-print loop, in which expressions are in turn

  • READ from the standard input,
  • EVALuated by the lisp interpreter,
  • and their results are PRINTed to the standard output.

Non-Interactive (Batch) Mode

Invoked with -c, compiles the specified lisp files to a platform-independent bytecode which can be executed more efficiently.

Invoked with -x, executes the specified lisp expressions.

Invoked with lisp-file, runs the specified lisp file.

Options

-h
--help
Displays a help message on how to invoke CLISP.
--version
Displays the CLISP version number, as given by the function LISP-IMPLEMENTATION-VERSION, the value of the variable *FEATURES*, as well some other information.
--license
Displays a summary of the licensing information, the GNU GPL.
-help-image
Displays information about the memory image being invoked: whether is it suitable for scripting as well as the :DOCUMENTATION supplied to EXT:SAVEINITMEM.
-B lisp-lib-dir
Specifies the installation directory. This is the directory containing the linking sets and other data files. This option is normally not necessary, because the installation directory is already built-in into the clisp executable. Directory lisp-lib-dir can be changed dynamically using the SYMBOL-MACRO CUSTOM:*LIB-DIRECTORY*.
-b
Print the installation directory and exit immediately. The namestring of CUSTOM:*LIB-DIRECTORY* is printed without any quotes. This is mostly useful in module Makefiles, see, e.g., modules/syscalls/Makefile.in.
-K linking-set

Specifies the linking set to be run. This is a directory (relative to the lisp-lib-dir) containing at least a main executable (runtime) and an initial memory image. Possible values are

base

the core CLISP

full

core plus all the modules with which this installation was built, see Section 32.2, “External Modules”.

The default is base.

-M mem-file
Specifies the initial memory image. This must be a memory dump produced by the EXT:SAVEINITMEM function by this clisp runtime. It may have been compressed using GNU gzip.
-m memory-size

Sets the amount of memory CLISP tries to grab on startup. The amount may be given as

n
nB
measured in bytes
n
nW
measured in machine words (4×n on 32-bit platforms, 8×n on 64-bit platforms)
nK
nKB
measured in kilobytes
nKW
measured in kilowords
nM
nMB
measured in megabytes
nMW
measured in megawords

The default is 3 megabytes. The argument is constrained above 100 KB.

This version of CLISP is not likely to actually use the entire memory-size since garbage-collection will periodically reduce the amount of used memory. It is therefore common to specify 10 MB even if only 2 MB are going to be used.

-L language

Specifies the language CLISP uses to communicate with the user. This may be one of english, german, french, spanish, dutch, russian, danish. Other languages may be specified through the environment variable LANG, provided the corresponding message catalog is installed. The language may be changed dynamically using the SYMBOL-MACRO CUSTOM:*CURRENT-LANGUAGE*.

-N locale-dir
Specifies the base directory of locale files. CLISP will search its message catalogs in locale-dir/language/LC_MESSAGES/clisp.mo. This directory may be changed dynamically using the SYMBOL-MACRO CUSTOM:*CURRENT-LANGUAGE*.
-Edomain encoding

Specifies the encoding used for the given domain, overriding the default which depends on the environment variables LC_ALL, LC_CTYPE, LANG. domain can be

file

affecting CUSTOM:*DEFAULT-FILE-ENCODING*

pathname

affecting CUSTOM:*PATHNAME-ENCODING*

terminal

affecting CUSTOM:*TERMINAL-ENCODING*

foreign

affecting CUSTOM:*FOREIGN-ENCODING*

misc

affecting CUSTOM:*MISC-ENCODING*

blank

affecting all of the above.

Warning

Note that the values of these SYMBOL-MACROs that have been saved in a memory image are ignored: these SYMBOL-MACROs are reset based on the OS environment after the memory image is loaded. You have to use the RC file, CUSTOM:*INIT-HOOKS* or init function to set them on startup, but it is best to set the aforementioned environment variables appropriately for consistency with other programs. See Section 31.1, “Customizing CLISP Process Initialization and Termination”.

-q
--quiet
--silent
-v
--verbose
Change verbosity level: by default, CLISP displays a banner at startup and a good-bye message when quitting, and initializes *LOAD-VERBOSE* and *COMPILE-VERBOSE* to T, and *LOAD-PRINT* and *COMPILE-PRINT* to NIL, as per [ANSI CL standard]. The first -q removes the banner and the good-bye message, the second sets variables *LOAD-VERBOSE*, *COMPILE-VERBOSE* and CUSTOM:*SAVEINITMEM-VERBOSE* to NIL. The first -v sets variables CUSTOM:*REPORT-ERROR-PRINT-BACKTRACE*, *LOAD-PRINT* and *COMPILE-PRINT* to T, the second sets CUSTOM:*LOAD-ECHO* to T. These settings affect the output produced by -i and -c options. Note that these settings persist into the read-eval-print loop. Repeated -q and -v cancel each other, e.g., -q -q -v -v -v is equivalent to -v.
-on-error action

Establish global error handlers, depending on action:

appease
continuable ERRORs are turned into WARNINGs (with EXT:APPEASE-CERRORS) other ERRORs are handled in the default way
debug
ERRORs INVOKE-DEBUGGER (the normal read-eval-print loop behavior), disables batch mode imposed by -c, -x, and lisp-file,
abort
continuable ERRORs are appeased, other ERRORs are ABORTed with EXT:ABORT-ON-ERROR
exit
continuable ERRORs are appeased, other ERRORs terminate CLISP with EXT:EXIT-ON-ERROR (the normal batch mode behavior).

See also EXT:SET-GLOBAL-HANDLER.

-repl

Start an interactive read-eval-print loop after processing the -c, -x, and lisp-file options and on any ERROR SIGNALed during that processing.

Disables batch mode.

-w
Wait for a keypress after program termination.
-I

Interact better with Emacs (useful when running CLISP under Emacs using SLIME, ILISP et al). With this option, CLISP interacts in a way that Emacs can deal with:

  • unnecessary prompts are not suppressed.
  • The GNU readline library treats TAB (see TAB key) as a normal self-inserting character (see Q: A.4.6).
-disable-readline
Do not use GNU readline even when it has been linked against. This can be used if one wants to paste non-ASCII characters, or when GNU readline misbehaves due to installation (different versions on the build and install machines) or setup (bad TERM environment variable value) issues.
-ansi
Comply with the [ANSI CL standard] specification even where CLISP has been traditionally different by setting the SYMBOL-MACRO CUSTOM:*ANSI* to T.
-traditional
Traditional: reverses the residual effects of -ansi in the saved memory image.
-modern
Provides a modern view of symbols: at startup the *PACKAGE* variable will be set to the CS-COMMON-LISP-USER package, and the *PRINT-CASE* will be set to :DOWNCASE. This has the effect that symbol lookup is case-sensitive (except for keywords and old-style packages) and that keywords and uninterned symbols are printed with lower-case preferrence. See Section 11.5, “Package Case-Sensitivity”.
-p package
At startup the value of the variable *PACKAGE* will be set to the package named package. The default is the value of *PACKAGE* when the image was saved, normally COMMON-LISP-USER.
-C
Compile when loading: at startup the value of the variable CUSTOM:*LOAD-COMPILING* will be set to T. Code being LOADed will then be COMPILEd on the fly. This results in slower loading, but faster execution.
-norc
Normally CLISP loads the user run control (RC) file on startup (this happens after the -C option is processed). The file loaded is .clisprc.lisp or .clisprc.fas in the home directory USER-HOMEDIR-PATHNAME, whichever is newer. This option, -norc, prevents loading of the RC file.
-lp directory
Specifies directories to be added to CUSTOM:*LOAD-PATHS* at startup. This is done after loading the RC file (so that it does not override the command-line option) but before loading the init-files specified by the -i options (so that the init-files will be searched for in the specified directories). Several -lp options can be given; all the specified directories will be added.
-i init-file
Specifies initialization files to be LOADed at startup. These should be lisp files (source or compiled). Several -i options can be given; all the specified files will be loaded in order.
-c lisp-file

Compiles the specified lisp-files to bytecode (*.fas). The compiled files can then be LOADed instead of the sources to gain efficiency.

Imposes batch mode.

-o outputfile
Specifies the output file or directory for the compilation of the last specified lisp-file.
-l
Produce a bytecode DISASSEMBLE listing (*.lis) of the files being compiled. Useful only for debugging. See Section 24.1, “Function COMPILE-FILE for details.
-x expressions

Executes a series of arbitrary expressions instead of a read-eval-print loop. The values of the expressions will be output to *STANDARD-OUTPUT*. Due to the argument processing done by the shell, the expressions must be enclosed in double quotes, and double quotes and backslashes must be escaped with backslashes.

Imposes batch mode.

lisp-file [ argument ... ]

Loads and executes a lisp-file, as described in Section 32.6.2, “Scripting with CLISP. There will be no read-eval-print loop. Before lisp-file is loaded, the variable EXT:*ARGS* will be bound to a list of strings, representing the arguments. The first line of lisp-file may start with #!, thus permitting CLISP to be used as a script interpreter. If lisp-file is -, the *STANDARD-INPUT* is used instead of a file.

This option is disabled if the memory image was created by EXT:SAVEINITMEM with NIL :SCRIPT argument. In that case the LIST EXT:*ARGS* starts with lisp-file.

This option must be the last one.

No RC file will be executed.

Imposes batch mode.

As usual, -- stops option processing and places all remaining command line arguments into EXT:*ARGS*.

Language Reference

The language implemented is ANSI Common Lisp. The implementation mostly conforms to the ANSI Common Lisp standard, see Section 31.10, “Maximum ANSI CL compliance”.

[ANSI CL] ANSI CL standard1994. ANSI INCITS 226-1994 (R1999) Information Technology - Programming Language - Common Lisp [formerly ANSI X3.226-1994 (R1999)].

Command Line User Environment

help
get context-sensitive on-line help, see Chapter 25, Environment .
(APROPOS name)
list the SYMBOLs matching name.
(DESCRIBE symbol)
describe the symbol.
(exit)
(quit)
(bye)
quit CLISP.
EOF (Control+D on UNIX)
leave the current level of the read-eval-print loop (see also Section 1.1, “Special Symbols ”).
arrow keys
for editing and viewing the input history, using the GNU readline library.
TAB key

Context sensitive:

  • If you are in the function position (in the first symbol after an opening paren or in the first symbol after a #'), the completion is limited to the symbols that name functions.
  • If you are in the "filename position" (inside a string after #P), the completion is done across file names, GNU bash-style.
  • If you have not typed anything yet, you will get a help message, as if by the help command.
  • If you have not started typing the next symbol (i.e., you are at a whitespace), the current function or macro is DESCRIBEd.
  • Otherwise, the symbol you are currently typing is completed.

Using and Extending CLISP

Common Lisp is a programmable programming language.

When CLISP is invoked, the runtime loads the initial memory image and outputs the prompt; at which one can start typing DEFVARs, DEFUNs and DEFMACROs.

To avoid having to re-enter the same definitions by hand in every session, one can create a lisp file with all the variables, functions, macros, etc.; (optionally) compile it with COMPILE-FILE; and LOAD it either by hand or from the RC file; or save a memory image to avoid the LOAD overhead.

However, sometimes one needs to use some functionality implemented in another language, e.g., call a C library function. For that one uses the Foreign Function Interface and/or the External Modules facility. Finally, the truly adventurous ones might delve into Extending the Core.

Files

clisp
clisp.exe
startup driver (an executable or, rarely, a shell script) which remembers the location of the runtime and starts it with the appropriate arguments
lisp.run
lisp.exe
main executable (runtime) - the part of CLISP implemented in C.
lispinit.mem
initial memory image (the part of CLISP implemented in lisp)
config.lisp
site-dependent configuration (should have been customized before CLISP was built); see Section 31.12, “Customizing CLISP behavior”
*.lisp
lisp source
*.fas
lisp code, compiled by CLISP
*.lib
lisp source library information, generated by COMPILE-FILE, see Section 24.3, “Function REQUIRE.
*.c
C code, compiled from lisp source by CLISP (see Section 32.3, “The Foreign Function Call Facility”)

For the CLISP source files, see Chapter 34, The source files of CLISP.

Environment

All environment variables that CLISP uses are read at most once.

CLISP_LANGUAGE
specifies the language CLISP uses to communicate with the user. The legal values are identical to those of the -L option which can be used to override this environment variable.
LC_CTYPE
specifies the locale which determines the character set in use. The value can be of the form language or language_country or language_country.charset, where language is a two-letter ISO 639 language code (lower case), country is a two-letter ISO 3166 country code (upper case). charset is an optional character set specification, and needs normally not be given because the character set can be inferred from the language and country. This environment variable can be overridden with the -Edomain encoding option.
LANG
specifies the language CLISP uses to communicate with the user, unless it is already specified through the environment variable CLISP_LANGUAGE or the -L option. It also specifies the locale determining the character set in use, unless already specified through the environment variable LC_CTYPE. The value may begin with a two-letter ISO 639 language code, for example en, de, fr.
HOME
USER
used for determining the value of the function USER-HOMEDIR-PATHNAME.
SHELL
COMSPEC
is used to find the interactive command interpreter called by EXT:SHELL.
TERM
determines the screen size recognized by the pretty printer.
ORGANIZATION
for SHORT-SITE-NAME and LONG-SITE-NAME in config.lisp.
CLHSROOT
for CUSTOM:CLHS-ROOT in config.lisp.
IMPNOTES
for CUSTOM:IMPNOTES-ROOT in config.lisp.
EDITOR
for editor-name in config.lisp.
LOGICAL_HOST_host_FROM
LOGICAL_HOST_host_TO
LOGICAL_HOST_host
for CUSTOM:*LOAD-LOGICAL-PATHNAME-TRANSLATIONS-DATABASE*

Input and Outut

See Section 21.1.1, “Initialization of Standard Streams”.

See also

CLISP impnotes
clisp-link(1)
CMU CL - cmucl(1)
Emacs - emacs(1)
XEmacs - xemacs(1)

Bugs

When you encounter a bug in CLISP or in its documentation (this manual page or CLISP impnotes), please report it to the CLISP SourceForge bug tracker.

Before submitting a bug report, please take the following basic steps to make the report more useful:

  1. Please do a clean build (remove your build directory and build CLISP with ./configure --cbc build or at least do a make distclean before make).
  2. If you are reporting a hard crash (segmentation fault, bus error, core dump etc), please do ./configure --with-debug --cbc build-g ; cd build-g; gdb lisp.run, then load the appropriate linking set by either base or full gdb command, and report the backtrace (see also Q: A.1.1.10).
  3. If you are using pre-built binaries and experience a hard crash, the problem is likely to be in the incompatibilities between the platform on which the binary was built and yours; please try compiling the sources and report the problem if it persists.

When submitting a bug report, please specify the following information:

  1. What is your platform (uname -a on a UNIX system)? Compiler version? GNU libc version (on GNU/Linux)?
  2. Where did you get the sources or binaries? When? (Absolute dates, e.g., 2006-01-17, are preferred over the relative ones, e.g., 2 days ago).
  3. How did you build CLISP? (What command, options &c.)
  4. What is the output of clisp --version?
  5. Please supply the full output (copy and paste) of all the error messages, as well as detailed instructions on how to reproduce them.

Projects

  • Enhance the compiler so that it can inline local functions.
  • Embed CLISP in VIM.

CLISP version 2.49Platform: i686-pc-linux-gnuLast modified: 2010-07-07