Skip to content

Commit 7905959

Browse files
add mutation fuzzer and update docs
1 parent bb8c69e commit 7905959

8 files changed

Lines changed: 520 additions & 41 deletions

File tree

.gitignore

Lines changed: 44 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,44 @@
1-
# Rust
2-
**/target/
3-
Cargo.lock
4-
5-
# macOS
6-
.DS_Store
7-
**/.DS_Store
8-
._*
9-
10-
# Windows
11-
Thumbs.db
12-
Desktop.ini
13-
14-
# Editors
15-
.vscode/
16-
.idea/
17-
*.swp
18-
19-
# Node (for the demo)
20-
node_modules/
21-
**/node_modules/
22-
dist/
23-
*.log
24-
25-
# Next.js / Nextra (docs)
26-
.next/
27-
**/.next/
28-
out/
29-
**/out/
30-
31-
# WASM
32-
pkg/
33-
**/pkg/
34-
35-
# Cloudflare
36-
.wrangler/
37-
38-
# Secrets
39-
.env
40-
.env.*
1+
# Rust
2+
**/target/
3+
Cargo.lock
4+
5+
# macOS
6+
.DS_Store
7+
**/.DS_Store
8+
._*
9+
10+
# Windows
11+
Thumbs.db
12+
Desktop.ini
13+
14+
# Editors
15+
.vscode/
16+
.idea/
17+
*.swp
18+
19+
# Node (for the demo)
20+
node_modules/
21+
**/node_modules/
22+
dist/
23+
*.log
24+
25+
# Next.js / Nextra (docs)
26+
.next/
27+
**/.next/
28+
out/
29+
**/out/
30+
31+
# WASM
32+
pkg/
33+
**/pkg/
34+
35+
# Cloudflare
36+
.wrangler/
37+
38+
# Secrets
39+
.env
40+
.env.*
41+
42+
# fuzzer output
43+
crashes/
44+
**/crashes/

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ lto = true
2828
codegen-units = 1
2929
panic = "abort"
3030
strip = true
31+
32+
[profile.fuzz]
33+
inherits = "release"
34+
opt-level = 3
35+
strip = false
36+
debug = true

compiler/Cargo.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ crate-type = ["cdylib", "rlib"]
1616
test = false
1717
doctest = false
1818

19+
[[bin]]
20+
name = "fuzz"
21+
path = "src/bin/fuzz.rs"
22+
1923
[[test]]
2024
name = "tests"
2125
path = "tests/main.rs"

compiler/README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,14 @@ Single-pass pipeline: source -> SSA bytecode chunk; stack interpreter with adapt
1515
* **VM** (`modules/vm/`) flat-match dispatch, scalar + instance-dunder inline caches, pure-function template memoization, NaN-boxed 64-bit `Val` with a mark-and-sweep arena.
1616
* **Resolver** (`modules/packages/`) host-injected; native imports register for `CallExtern` dispatch.
1717

18-
Full rationale, NaN-box patterns, IC thresholds, GC roots, and intentional omissions: [Design](https://edgepython.com/implementation/design). Lexer and parser internals: [Lexical](https://edgepython.com/implementation/lexical), [Syntax](https://edgepython.com/implementation/syntax).
18+
Full rationale, NaN-box patterns, IC thresholds, GC roots, and intentional omissions: [Design](https://edgepython.com/implementation/design). Lexer and parser internals: [Lexical](https://edgepython.com/implementation/lexical), [Syntax](https://edgepython.com/implementation/syntax). Fuzzer internals and mutation strategies: [Fuzzing](https://edgepython.com/implementation/fuzzing).
1919

2020
## Layout
2121

2222
```text
2323
├── src
2424
│ ├── main
25+
│ ├── bin
2526
│ ├── modules
2627
│ │ ├── lexer
2728
│ │ ├── packages
@@ -64,6 +65,16 @@ fn main() {
6465

6566
The download URL is derived from `CARGO_PKG_VERSION`, so a tag bump is the only retarget. Use `branch = "main"` for unreleased work. Requires `curl` on PATH; gated by the default-on `prebuilt` feature.
6667

68+
## Fuzzer
69+
70+
```bash
71+
# build and run
72+
cargo run --bin fuzz --profile fuzz
73+
74+
# reproduce a crash
75+
cargo run --bin compiler crashes/crash_000001.py
76+
```
77+
6778
## References
6879

6980
1. **Aho, Sethi & Ullman**, *Compilers: Principles, Techniques and Tools* (1986). LUT-based lexer.

0 commit comments

Comments
 (0)