ASDF and .asd files
The standard defines no way to describe a program made of several files. ASDF (Another System Definition Facility, begun by Daniel Barlow around 2001, and rewritten as ASDF 3 by François-René Rideau in 2013) is the build system that every current implementation includes or can load. A system is described in a file named system-name.asd, which is ordinary Common Lisp source read in the package ASDF-USER, normally holding one defsystem form. A file may define several systems; a system named a/b is a secondary system found in a.asd.
(asdf:defsystem "my-app"
:description "A small application."
:version "0.3.1"
:author "A. Person"
:licence "MIT"
:depends-on ("alexandria" "cl-ppcre" (:feature :sbcl "sb-posix"))
:pathname "src/"
:serial t
:components ((:file "package")
(:file "util")
(:module "net"
:components ((:file "http")
(:file "client" :depends-on ("http")))))
:in-order-to ((test-op (test-op "my-app/tests"))))
(asdf:defsystem "my-app/tests"
:depends-on ("my-app" "fiveam")
:components ((:file "tests"))
:perform (test-op (o c) (uiop:symbol-call :fiveam '#:run! :my-app)))
| Option | Meaning |
|---|---|
:name, :version, :description, :long-description, :author, :maintainer, :licence (or :license), :homepage, :bug-tracker, :mailto, :source-control | descriptive strings; :version is dotted numbers |
:depends-on | systems this one needs: names, or (:version name "1.2"), (:feature feature-expression name), (:require name) for an implementation’s own modules |
:defsystem-depends-on | systems needed to read this definition (for extension classes) |
:components | the parts: (:file "name") (name.lisp), (:module "dir" :components …), (:static-file "README"), and other component classes such as :cl-source-file |
:pathname | the directory of the system or module, relative to its parent |
:serial t | each component depends on the one before it |
:depends-on (in a component) | the components that must be loaded first |
:in-order-to, :perform, :around-compile, :if-feature | operation dependencies, a method for an operation, a wrapper for compilation (for example to set optimize), and a condition under which a component exists |
:class | the class of the system: :package-inferred-system reads dependencies from defpackage forms, one package per file |
:build-operation, :build-pathname, :entry-point | to build an executable with asdf:make (program-op) |
The operations are (asdf:load-system "name") (the older (asdf:operate 'asdf:load-op "name")), asdf:compile-system, asdf:test-system, asdf:make, asdf:find-system, asdf:system-source-directory and asdf:clear-system. ASDF finds .asd files through its source registry: the directories in the CL_SOURCE_REGISTRY environment variable, ~/.config/common-lisp/source-registry.conf and files in source-registry.conf.d, or the older asdf:*central-registry*. Compiled files go through output translations into a cache such as ~/.cache/common-lisp/, named per implementation and version, so they do not clutter the source folder. UIOP, the utilities that ship with ASDF, provides portable file, process and pathname functions (uiop:read-file-lines, uiop:run-program, uiop:getenv, uiop:define-package).
Quicklisp and other tools
Quicklisp (Zach Beane, 2010) is the library manager. It is loaded from a bootstrap file quicklisp.lisp that installs itself in ~/quicklisp/ and then (ql:quickload "name") downloads the library and its dependencies from a monthly dist of tested libraries and loads them through ASDF. Projects in ~/quicklisp/local-projects/ (or ~/common-lisp/) are found without installing. Others in use are Ultralisp (a dist built continuously from repositories), Roswell (ros: install and switch implementations, run scripts, .ros), CLPM, OCICL, Qlot (per-project locked dependencies, qlfile) and the Common Lisp Cookbook and the awesome-cl lists for discovery. Editor support comes from SLIME and SLY for Emacs, Lem (an editor written in Common Lisp), the LispWorks and Allegro IDEs, and plugins for VS Code (Alive), Vim (Vlime, Slimv) and JetBrains (SLT).
Implementations
| Implementation | Notes | Files it makes |
|---|---|---|
| SBCL | Steel Bank Common Lisp, forked from CMUCL in 1999. Native compiler; the most used free implementation. sbcl --script file runs a file; save-lisp-and-die with :executable t makes a program. | .fasl; .core images |
| Clozure CL (CCL) | Formerly OpenMCL, from Macintosh Common Lisp. Native compiler; fast compile; good threads. | .lx64fsl, .dx64fsl, .wx64fsl, .fx64fsl (per platform); image files |
| ECL | Embeddable Common Lisp. Compiles to C and so to native code; bytecode interpreter too; embeds in C programs. | .fas, .o, shared libraries |
| CLISP | GNU. Compiles to bytecode for its own virtual machine; strong on portability; has its own foreign-function and regular-expression modules. | .fas and .lib; .mem images |
| ABCL | Armed Bear Common Lisp on the Java virtual machine, with Java interop. | JVM class files; .abcl (zip) packs |
| Allegro CL | Franz Inc., commercial, with a free Express edition; AllegroGraph and the Allegro IDE. | .fasl; .dxl images |
| LispWorks | Commercial, with a free Personal edition and a cross-platform IDE with CAPI (GUI). | per platform: .ufasl, .ofasl, .wfasl and others |
| CMUCL | Carnegie Mellon University CL, the ancestor of SBCL and Scieneer. | .x86f and others; .core |
| Clasp | Common Lisp on LLVM, with C++ interoperation, aimed at scientific software. | its own fasl and bundle files |
| Others | GCL (GNU Common Lisp), MKCL (a branch of ECL), Mezzano (an operating system written in Common Lisp), Corman Lisp, Movitz, Scieneer CL (commercial, SMP), and the Lisp machines below. |
The implementations share the standard, differ on everything it leaves open (external formats, threads, networking, foreign calls, the debugger, compiled files) and are tested for compatibility by the ansi-test suite. The portability layers bordeaux-threads, usocket, cffi, trivial-features, closer-mop and uiop cover the commonest differences.
Lisp machines
Common Lisp was designed as the successor of the dialects on the Lisp machines, special computers whose operating systems were written in Lisp: Symbolics (3600 series and Ivory processors; the Genera system, whose Common Lisp mode used the mode line Syntax: Common-Lisp), LMI, and Texas Instruments (Explorer). Their own dialect, Lisp Machine Lisp or Zetalisp, is described on Other Lisps. Symbolics Genera still runs on emulators (Open Genera on Alpha, and virtual machines), and Medley Interlisp, from Xerox, has been revived as an open-source system.