You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
vibed/edu/.beans/edu-b73b--course-writing-a-...

76 lines
2.4 KiB
Markdown

---
# edu-b73b
title: 'Course: Writing a Lisp-to-C Compiler in Rust'
status: completed
type: epic
priority: normal
created_at: 2026-03-10T23:30:01Z
updated_at: 2026-03-10T23:30:03Z
blocked_by:
- edu-ylb8
- edu-azf5
- edu-n9ap
- edu-jzvr
- edu-g1r5
- edu-16fy
- edu-n7zb
- edu-mmbr
- edu-tzzh
- edu-h3yx
- edu-3sww
- edu-4kkb
- edu-63ze
- edu-pyue
- edu-unus
- edu-nc61
- edu-v0ud
- edu-y4e6
---
## Course: Writing a Lisp-to-C Compiler in Rust
A complete self-guided interactive course teaching how to build a compiler from scratch in Rust using the nom parser-combinator library. The source language is MiniLisp — a minimal Lisp dialect. The compilation target is human-readable C.
## Course file
`edu/src/lisp-compiler.md`
## Section inventory
| § | Title | Ticket |
|---|---|---|
| 1 | Introduction: What We're Building | e8da8b |
| 2 | MiniLisp Language Specification | a93829 |
| 3 | Compiler Architecture: The Pipeline | 3aeb62 |
| 4 | Introduction to nom: Parser Combinators | 5835e9 |
| 5 | Setting Up the Project | 3dc36b |
| 6 | Recognizing Atoms: Integers, Booleans, Strings, Symbols | 685f5e |
| 7 | The Abstract Syntax Tree | a1a827 |
| 8 | Parsing Atoms with nom | b6c9ad |
| 9 | Parsing S-Expressions and Special Forms | a4c9f8 |
| 10 | Symbol Tables and Scope | d0b9f8 |
| 11 | Checking Special Forms | 6d40a7 |
| 12 | The C Runtime Preamble | 3e1250 |
| 13 | Generating C: Atoms and Expressions | 1eb794 |
| 14 | Generating C: Definitions and Functions | cbc6e3 |
| 15 | Generating C: Control Flow and Sequencing | de82f1 |
| 16 | The Compilation Pipeline | 58b37a |
| 17 | Testing the Compiler | 8fa47a |
| 18 | What's Next: Extensions and Further Reading | 1d16da |
## MiniLisp feature set
- **Types:** integers (`int64_t`), booleans (`#t`/`#f`), strings (`const char*`)
- **Special forms:** `define`, `lambda`, `if`, `let`, `begin`
- **Built-in operators:** `+`, `-`, `*`, `/`, `=`, `<`, `>`, `<=`, `>=`, `not`
- **Built-in functions:** `display`, `newline`, `error`
- **Comments:** `;` to end of line
## Explicitly out of scope
Closures, tail-call optimisation, pairs/lists, garbage collection, macros, variadic functions, floating-point. Each is discussed as a potential extension in §18.
## Definition of done
All 18 section tickets are `done` and `mdbook build` succeeds with no 🚧 stubs remaining in the output.