FAWK: LLMs can write a language interpreter
LLMs Writing Interpreters and DSLs
- Multiple commenters report success getting LLMs to build interpreters, compilers, and DSLs: FAWK (functional AWK), a Ruby compiler, a Perchance interpreter in Rust, a web-app DSL, a typed shell DSL, Prolog experiments, and an LLVM-based language.
- Typical workflow: describe the language and examples, ask the model to implement an interpreter plus tests, then iterate via an agent (e.g., Claude Code, Cursor, Gemini CLI).
- For small, “school‑style” interpreters, results are often surprisingly solid; larger or standards-heavy languages remain difficult.
Why Use AI Instead of Writing It Yourself?
- Pro‑AI side: AI drastically cuts time from weeks to days or hours, enabling ambitious side projects for people with jobs/families; it lets you skip tedious parts (lexers, boilerplate, machine code, plumbing) and focus on design.
- Skeptical side: implementing a toy language is “the fun part of CS” and a core learning experience; offloading it to AI can feel like cheating or hollow, especially if you don’t deeply understand the result.
Code Quality, Testing, and Maintenance
- Strong consensus that good automated tests are essential. With high coverage, models can refactor (e.g., port a parser to tree‑sitter) and maintain behavior; without tests, they generate “happy-path” code and miss edge cases (division by zero, deadlocks, race conditions).
- Several people note that review can be as hard and boring as writing the code yourself, especially for grammars and complex architectures.
- On larger or intricate codebases, models tend to wander into dead ends, misunderstand cross-cutting implications, or invent APIs.
Reasoning, Understanding, and Limits
- One subthread debates whether visible “thinking steps” are real reasoning or just next‑token prediction. Some argue LLMs clearly build usable world models; others insist they lack genuine understanding or judgment.
- Models pattern‑match strongly to known syntaxes; new languages that look like JS/C are easier for them than truly novel designs.
Broader Experiences and Context
- Many anecdotes of successful “vibe coding” beyond FAWK: automation scripts, GUI apps with E2E tests, porting Ruby to Cosmopolitan, home automation setup.
- Advent of Code is framed as a social, seasonal, low‑stakes playground that motivates building toy languages.
- Meta‑discussion touches on AI hype vs “propaganda”, political implications, and a desire for more shared transcripts so others can learn concrete prompting and workflows.