Developer Replaces the Compiler with a Language Model: Claude Code Turns C Code into Assembly by Itself
Normally, a compiler such as clang or gcc turns a C program into machine instructions. Drew McCormack handed that job to Claude Code: the model writes the assembly itself (a text form of ARM64 processor instructions on an Apple M2), and then the code is linked and run. The model kept getting stack offsets wrong, but a Python calculator script fixed that, and even a recursive quicksort ran correctly. It is still a toy, but it hints at languages written for LLMs.
AI-processed from Habr AI; edited by Hamidun News
Normally, a program written in C becomes a ready-to-run file through a compiler: clang or gcc reads the source code and outputs machine instructions for the processor. Developer Drew McCormack tested what happens if you remove that program from the chain and give its work to a language model. Claude Code receives a C file and writes the assembly itself, that is, a text record of processor instructions, one instruction at a time. Then a regular assembler and linker build a working binary from that text. For practitioners, this is an interesting stress test: how capable is an LLM of replacing not just the author of the code, but also the tool that translates that code.
Where the idea came from
The author starts from an observation many people will recognize: people have almost stopped reading the code that models write. We describe the task, skim the diff, run the tests, and move on. The source becomes an intermediate representation that a human only occasionally glances at. That raises the question: do programming languages in their familiar form still need to exist if a model can translate intent directly into machine code?
How the experiment works
The rules are simple. The commands clang -S and gcc are prohibited. Only the assembler and linker are allowed as tools, and the program links against the C standard library. The entire translation step that a compiler normally performs is done by the model.
McCormack started small: a program that adds two numbers and prints the result. On ARM64 on an Apple M2, it worked on the first try. Next, he took bubble sort, which involves loops and array indexing. That required several rounds.
The most telling bug involved the stack. This is the region of memory where a function keeps its local variables and the address to return to once it finishes. The model's algorithm was correct, but it got confused about byte offsets of variables and stack alignment. In one version, the array was placed directly over the saved return address. The build succeeded without errors, but when the function exited, the program crashed with a bus error.
The author's conclusion: the model understands the meaning of the program well. It knows which instructions implement a loop, how to swap values, and which data must survive a function call. But precise mechanical arithmetic does not come easily to it, a long-known weakness of LLMs. So they gave it a calculator: a small Python script. It is fed the layout of the stack frame and returns the total size, the offset of each field, and an alignment check. After that, the model handled recursive quicksort, which involves partitioning an array and two recursive calls. The output matched what a real clang build produces.
Right now everything is packaged as a Claude Code skill called llmc. The repository is cloned into ~/.claude/skills/llmc, and then invoked with the command /llmc on one or more .c files. The model compiles them, links them together, runs the result, and shows the output.
Honest limitations
The author himself calls the approach a toy. A real compiler finishes in milliseconds and does not make offset errors, while an LLM takes about a minute to think and, without a helper script, does not guarantee correctness. There are no formal checks here, and rerunning the process may well produce different assembly. Building production programs this way makes no sense today.
Why this matters to practitioners: languages built for the task
The author sees the interest in domain-specific languages (DSLs), that is, mini-languages built for one specific purpose. Usually they are carved out of Ruby or Swift, because an existing compiler has to parse them. That produces awkward constructs with closures and ViewBuilder. If the compiler is a model, a host language is not needed. A screen could be described like this: "screen Profile: avatar, then the name in bold, then a Follow button that becomes Following when tapped." Given a defined grammar, the model could produce SwiftUI, React, or even a finished binary.
For teams, this means that a product description written in near-natural but strictly structured language could become the source code. The risks are clear: the output has to be verified with tests, the model version has to be pinned, and the cost of a build has to be counted in tokens rather than milliseconds.
The broader lesson goes beyond the experiment itself: do not make the model do what is more reliably computed by ordinary code. The model handles decisions, and the script handles exact arithmetic. This division of labor is probably how future LLM compilers will be built.
- Dec 1, 2026A script cut eslint output for Claude Code from 673 KB to 151 bytes, beating the trim-2 model
- Dec 1, 2026Telegram Releases Dictator, an AI Agent for macOS That Reads Your Chats
- Dec 1, 2026Apple Signs Deals with 25 Publishers, Including BBC and CNN, for News in Siri AI
- Dec 1, 2026SquashFS Maintainer Nearly Quit the Linux Kernel Over a Flood of AI Bug Reports
Key Questions Answered
Where the idea came from?
The author starts from an observation many people will recognize: people have almost stopped reading the code that models write. We describe the task, skim the diff, run the tests, and move on. The source becomes an intermediate representation that a human only occasionally glances at. That raises the question: do programming languages in their familiar form still need to exist if a model can translate intent directly into machine code?
How the experiment works?
The rules are simple. The commands clang -S and gcc are prohibited. Only the assembler and linker are allowed as tools, and the program links against the C standard library. The entire translation step that a compiler normally performs is done by the model. McCormack started small: a program that adds two numbers and prints the result. On ARM64 on an Apple M2, it worked on the first try. Next, he took bubble sort, which involves loops and array indexing. That required several rounds.
What are the key details on Honest limitations?
The author himself calls the approach a toy. A real compiler finishes in milliseconds and does not make offset errors, while an LLM takes about a minute to think and, without a helper script, does not guarantee correctness. There are no formal checks here, and rerunning the process may well produce different assembly. Building production programs this way makes no sense today.
Free 2-Day Vibecoding & AI Agents Intensive
Day 1: the autonomous Hermes + DeepSeek AI agent — vibecoding and development on par with Claude Code / Codex / Gemini. Led by Jemal Hamidun, Head of AI at Alpina Digital and academic supervisor at MIPT. Right after you register with our bot Nika: the recording + 11 materials from the previous intensive.
Daily 60-sec AI Voice Brief + Weekly Production AI Agent Playbook
Listen to a 60-second AI news brief every morning and get a weekly hands-on playbook for shipping AI agents to production — tools, MCP servers and patterns that work. Curated by Jemal Hamidun, Head of AI at Alpina Digital.
