← 返回命令列表

Linux command

sbcl 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Start REPL

sbcl

Run a Lisp script

sbcl --script [script.lisp]

Load file and start REPL

sbcl --load [file.lisp]

Evaluate expression and exit

sbcl --eval "(print 'hello)" --quit

Compile to executable

sbcl --eval "(load \"app.lisp\")" --eval "(sb-ext:save-lisp-and-die \"app\" :executable t)"

Run with specific core

sbcl --core [custom.core]

Disable debugger

sbcl --disable-debugger --load [script.lisp]

Load ASDF system

sbcl --eval "(asdf:load-system :system-name)"

说明

SBCL (Steel Bank Common Lisp) is a high-performance Common Lisp compiler. It compiles to native code with sophisticated optimizations, making it one of the fastest Lisp implementations. The REPL (Read-Eval-Print Loop) provides interactive development. Code can be loaded, tested, and modified without restarting. The debugger offers restarts, backtraces, and inspection. ASDF (Another System Definition Facility) manages projects and dependencies. Quicklisp provides a package manager for Common Lisp libraries. Together they enable modern project development. Creating executables uses sb-ext:save-lisp-and-die, dumping an image including loaded code. The result is a standalone executable with fast startup. SBCL includes the SB-* extension packages: threading (sb-thread), networking (sb-bsd-sockets), FFI (sb-alien), and more. These extend standard Common Lisp. The type system enables optional type declarations for optimization. The compiler provides detailed notes about optimization opportunities.

参数

--script _FILE_
Run script (no REPL, --disable-debugger implied).
--load _FILE_
Load Lisp file.
--eval _EXPR_
Evaluate expression. Can be specified multiple times.
--quit
Exit after processing all --load and --eval options.
--core _CORE_
Use specified core file.
--disable-debugger
Disable Lisp debugger.
--noinform
Suppress startup banner.
--noprint
Disable REPL printing.
--non-interactive
Non-interactive mode.
--userinit _FILE_
User init file (default: ~/.sbclrc).
--no-userinit
Skip user init file.
--sysinit _FILE_
System init file.
--no-sysinit
Skip system init file.
--dynamic-space-size _MB_
Heap size in megabytes.
--control-stack-size _MB_
Stack size in megabytes.

FAQ

What is the sbcl command used for?

SBCL (Steel Bank Common Lisp) is a high-performance Common Lisp compiler. It compiles to native code with sophisticated optimizations, making it one of the fastest Lisp implementations. The REPL (Read-Eval-Print Loop) provides interactive development. Code can be loaded, tested, and modified without restarting. The debugger offers restarts, backtraces, and inspection. ASDF (Another System Definition Facility) manages projects and dependencies. Quicklisp provides a package manager for Common Lisp libraries. Together they enable modern project development. Creating executables uses sb-ext:save-lisp-and-die, dumping an image including loaded code. The result is a standalone executable with fast startup. SBCL includes the SB-* extension packages: threading (sb-thread), networking (sb-bsd-sockets), FFI (sb-alien), and more. These extend standard Common Lisp. The type system enables optional type declarations for optimization. The compiler provides detailed notes about optimization opportunities.

How do I run a basic sbcl example?

Run `sbcl` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --script _FILE_ do in sbcl?

Run script (no REPL, --disable-debugger implied).