GitHub

lispc

An ahead-of-time compiler for ANSI Common Lisp that produces native Linux x86-64 binaries — no assembler, linker, or C runtime required.

Native x86-64 Zero Dependencies ANSI Common Lisp Static Binaries

This compiler — and this page — were built through vibe coding.

What is lispc?

lispc is an ahead-of-time (AOT) compiler for a substantial subset of ANSI Common Lisp. Written in Go, it reads .lisp source files and emits statically linked ELF binaries that run on Linux x86-64 with absolutely no runtime dependencies — no libc, no shared libraries, no interpreter.

The compiler is a single static binary with the standard library embedded. Just put it on your PATH and compile Lisp programs anywhere. No environment variables, config files, or installation steps required.

How It Works

Source code flows through a single-pass pipeline. The code generator emits raw x86-64 machine code using a stack-based evaluation model, and the ELF writer wraps it in a minimal valid ELF64 header to produce a directly executable binary.

.lisp Lexer Parser Macro Expander x86-64 CodeGen ELF Writer Binary

By the Numbers

26k+
Lines of compiler
Go source across codegen, parser, macros, ELF writer
7.6k
Lines of stdlib
Pure Lisp standard library embedded in the compiler
20
ANSI CL topic areas
Spec areas covered: types, CLOS, conditions, I/O, threads, etc.
0
Runtime dependencies
Static binaries use Linux syscalls directly

Features

🧬

ANSI Common Lisp

Implements a broad subset: defun, defmacro, CLOS, conditions & restarts, loop, format, hash tables, structures, sequences, and more.

Native Machine Code

Generates raw x86-64 instructions directly — no intermediate assembly, no C compilation, no interpreter overhead.

📦

Static Binaries

Output is a self-contained ELF executable. No libc, no dynamic linking. Copy the binary anywhere and it just runs.

🧵

Virtual Threads

Cooperative green threads with thread-spawn, thread-yield, and vt-sleep-ms. Backed by an epoll-based scheduler for efficient I/O multiplexing.

🌐

Networking

Built-in TCP sockets, DNS resolution, and HTTP support via direct Linux syscalls. Build web servers and clients in pure Lisp.

💻

Terminal UI

Raw terminal mode, ANSI escape sequences, UTF-8 output, and signal handling for building rich console applications.

Quick Start

Build the compiler

# Requires Go 1.21+ and Linux x86-64
git clone https://github.com/yourusername/lispc.git
cd lispc
go build -o bin/lispc ./cmd/lispc

Compile and run

# Write a program
cat > hello.lisp <<'EOF'
(defun greet (name)
  (format t "Hello, ~a!~%" name))

(greet "World")
EOF

# Compile to native binary
./bin/lispc hello.lisp -o hello

# Run it
./hello
# => Hello, World!

What Lisp Looks Like

A TCP echo server with virtual threads — compiled to a single static binary:

(defun handle-client (fd)
  (let ((buf (make-string 1024)))
    (loop
      (let ((n (vt-recv fd buf 1024 0)))
        (when (<= n 0) (return))
        (vt-send fd buf n 0))))
  (syscall-close fd))

(defun main ()
  (let ((sock (tcp-listen "0.0.0.0" 8080)))
    (format t "Listening on :8080~%")
    (loop
      (let ((client (vt-accept sock)))
        (thread-spawn
          (lambda () (handle-client client)))))))

Example Applications

Full applications built with lispc, demonstrating real-world use cases:

Chess

Console chess with Unicode board, negamax AI, and ANSI colors

🎲

Yunnori

Korean board game with animated Yut sticks and rich terminal UI

🌐

Web Server

HTTP server handling requests with virtual threads

📄

Browser

Terminal web browser with TLS, HTML parsing, and page navigation

Built with AI

This project was built collaboratively with AI. The compiler, standard library, example applications, and this page were all written through conversation with an LLM, iterating on code until things worked.