Examples Index
This index maps tutorial chapters to runnable examples.
Chapter mapping
| Chapter | Focus | Tests |
|---|---|---|
| Chapter 1 | Parser | ast::tests::test_ast_fibonacciast::tests::test_ast_factorial |
| Chapter 2 | Dialect definitions and manual IR construction | dialect::tests::build_fib_example |
| Chapter 3 | AST to Kaleidoscope dialect lowering | from_ast::tests::fibonacci_from_astfrom_ast::tests::factorial_from_astfrom_ast::tests::inline_fibonacci_from_ast |
| Chapter 4 | Kaleidoscope dialect to LLVM dialect lowering | to_llvm::tests::fibonacci_to_llvmto_llvm::tests::factorial_to_llvmto_llvm::tests::if_else_to_llvm |
| Chapter 5 | JIT execution | jit::tests::fibonacci_jitjit::tests::factorial_jitjit::tests::if_else_jit |
Running chapter tests
cargo test --example kaleidoscope -- --list
cargo test --example kaleidoscope -- --show-output
Run a single test by name:
cargo test --example kaleidoscope -- fibonacci_to_llvm --show-output
Run the end-to-end CLI example:
cargo run --example kaleidoscope -- --input examples/kaleidoscope/fibonacci.kal --fn main --arg 5
Testing strategy
As examples become implementation-heavy, mirror key behaviors in integration tests under tests/ so chapter claims remain verifiable in CI.
Suggested learning paths
- Parser-focused: Start at Chapter 1.
- IR design-focused: Start at Chapter 2, then Chapter 3 and Chapter 4.
- End-to-end pipeline: All chapters, in order.