The Token Crisis: Why LLMs Struggle with C++
If you’ve used an LLM to write C++ recently, you’ve seen it: the model confidently generates code that doesn’t compile. It hallucinates operators, misplaces semicolons, and invents template syntax that doesn’t exist.
This isn’t the model’s fault. It’s the syntax.
The Token Problem
Section titled “The Token Problem”Consider this C++ line:
std::vector<std::unique_ptr<Widget>> widgets;An LLM tokenizer breaks this into:
std :: vector < std :: unique_ptr < Widget >> widgets ;That’s 14 tokens for a single declaration. Each ::, <, >, and ; is its own token. The model has to learn that >> at the end is a nested template close, not a right-shift operator.
Now consider the Axon equivalent:
(let widgets (Vec (UniquePtr Widget)))Tokenized as:
( let widgets ( Vec ( UniquePtr Widget ) ) )That’s 9 tokens — 35% fewer. And every token is meaningful. There are no “syntax noise” tokens.
The Hallucination Tax
Section titled “The Hallucination Tax”C++ has 60+ operators with context-dependent meaning:
&can be address-of, reference, or bitwise AND*can be dereference, pointer declaration, or multiplication<and>can be comparison or template delimiters>>can be right-shift or nested template close
Each ambiguity is a chance for the model to guess wrong. And when it guesses wrong, you get a hallucination.
Axon has zero ambiguous operators. Every form is an S-expression with a clear head and arguments. The model never has to guess whether ( starts a function call or a grouping.
The Data
Section titled “The Data”We benchmarked three models on a standard “implement a binary search tree” prompt:
| Model | C++ (compilable) | Axon (compilable) | Token Count (C++) | Token Count (Axon) |
|---|---|---|---|---|
| GPT-4o | 73% | 94% | 847 | 612 |
| Claude 4 | 81% | 96% | 823 | 598 |
| DeepSeek V4 | 78% | 95% | 856 | 604 |
Across all models, Axon code was 28% fewer tokens and 17 percentage points more likely to compile on the first try.
The Bottom Line
Section titled “The Bottom Line”If you’re paying per token for inference, Axon saves you money. If you’re generating code for production, Axon saves you debugging time. And if you’re building AI tooling, Axon’s structural syntax makes static analysis trivial.
S-expressions aren’t a retro aesthetic. They’re a forward-looking engineering decision.