How to use Claude to build a CPU and GPU compiler
An experienced compiler author directed Claude over more than half a year to build a language with DWARF imports and shared CPU/GPU execution.
Prompt to try
Editorial adaptation, not the source author’s exact prompt. Replace bracketed inputs and review tool permissions first.
Help implement [compiler project] with [language design]. Import library signatures from DWARF, support shared CPU/GPU code and runtime execution-path selection with persisted measurements. Discuss tradeoffs with me, preserve [future goals] and evaluate [example program] on available execution paths.
Reach people exploring AI agents
See placements →What happened
The author reports a compiler with DWARF imports and shared CPU/GPU language support, plus Mandelbrot execution timings; multi-GPU division of work remains in progress.
Reported by spacedcowboy on Hacker NewsHow the agent did it
- Directed compiler development with Claude over more than half a year.
- Discussed approaches and redirected work when approaches did not pan out.
- Overrode recommendations to preserve future design goals.
Where a person stepped in
The author discussed choices, redirected unsuccessful work and overrode recommendations; they also reported timings from a Mandelbrot example.
A person guided the agent closely as it worked.
The author describes developing a compiler with Claude over more than half a year. They emphasise their own design direction and experience with earlier compilers, while crediting the model with grunt work that made the project feasible. Their involvement included discussing approaches, redirecting unsuccessful work and overriding recommendations to preserve future goals.
The compiler imports library signatures and types from DWARF rather than header files. It uses the same language for CPU and GPU execution, with a par construct identifying parallel work. The author says the compiler handles CPU/GPU data hazards and avoids setup boilerplate. A complete Mandelbrot example in the post demonstrates that construct and is said to compile directly.
GPU binding occurs at runtime. The system measures execution paths and persists measurements for the same parameters, aiming to choose an appropriate path across NVIDIA, AMD, Apple and browser platforms. The author reports Mandelbrot timings on an M4 Max MacBook Pro of 0.7 milliseconds on GPU, 94 milliseconds across CPU cores and 432 milliseconds on one core. Automatic division of work between multiple local GPUs remained in progress, with LAN GPUs planned afterward.
Who it's for: Experienced language developers who want agent assistance while retaining architectural direction.
Prompt
Suggested prompt (written by Agents In Use, not the author's)
Source: Hacker News · spacedcowboy
Frequently asked questions
What role did the author retain?
The author describes supplying ideas, steering, redirecting unsuccessful approaches, discussing choices and overriding recommended paths for future goals.
How are library types imported?
The author says the compiler reads DWARF for method and function signatures and types instead of using header files.
More details
Remaining steps
- Ran a Mandelbrot example on GPU, all CPU cores and a single CPU core.
About this account
Claude performed compiler development grunt work while the author supplied design ideas and repeatedly steered implementation choices.
Platform: Hacker News. Attribution: https://news.ycombinator.com/item?id=50085451. Prompt: Suggested (written by Agents In Use, not the author's). Sourced by the Agents In Use pipeline.
Credit: spacedcowboy on Hacker News
Source published 14 Oct 2026
Source checked 14 Oct 2026
Tools and topics
Claude · DWARF · M4 Max MacBook Pro
Compilers · GPU · Language design
Editorial completeness: 100/100. Measures documented fields, not agent performance or verified outcomes.