convez.ai
SkillDesenvolvimento WebAvançado
drewmccormack

llmc — O LLM é o Compilador C

drewmccormack/llmc

Claude compila C para ARM64 por raciocínio, sem codegen tradicional

Ver no GitHub
InicialPluginScore · de 0 a 100

Skill do Claude Code que transforma o modelo em compilador C, traduzindo código C para assembly ARM64 por raciocínio puro, sem gcc/clang. O sistema apenas monta e linka o assembly gerado, executa o binário nativo e valida o resultado.

Instalação

$npx convez-ai drewmccormack/llmc

1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.

Métricas

Estrelas
2
Forks
0
Acompanhando
0
Saúde
28%
Último commit
há 5 meses
Versão
—
Issues abertas
0
Contribuidores
1

Casos de uso

  • Educar sobre geração de código assembly ARM64
  • Prototipagem rápida de pequenos programas C nativos
  • Explorar capacidades de raciocínio matemático e lógico do LLM

Veredito

Projeto ambicioso que demonstra capacidades reais de raciocínio semântico em codegen, mas com escopo limitado (Apple Silicon, programas pequenos). Mais valor educacional que prático — interessante para entender limites e forças de LLMs em compilação.

README

A tradução para o português deste README ainda está na fila.

llmc — the LLM is the C compiler

A Claude Code skill where the language model itself compiles C. Given one or more .c files, Claude hand-translates them to ARM64 assembly by reasoning — no gcc/clang ever generates the assembly — then uses the system toolchain only as an assembler and linker to produce a running native binary, links against libc, runs it, and reports the output.

/llmc helloworld.c

A normal compiler is a deterministic black box translating C to machine code. llmc replaces that front-end with an LLM. The system clang is used only to assemble and link the model's hand-written .s (it drives as/ld and supplies the Mach-O entry stub) — never to compile the C.

This is real, not a gimmick. It has compiled and correctly run, on Apple Silicon:

ProgramWhat it exercisesResult
add.cinteger arithmeticexit code 42
printf.cfirst libc call (Apple variadic-on-stack ABI)prints 42
bubble.cnested loops, array indexingsorts in place
fact.crecursion (N live frames, per-call lr)prints 120
qsort.crecursive quicksort + partition + libcprints the sorted array
multi/two translation units linked togetherprints 25

Why it works

The interesting finding behind this skill: when an LLM hand-compiles C, the semantic translation is reliably correct — loops, indexing, recursion, deciding which registers must survive a call, even the awkward Apple variadic convention. What drifts is the mechanical stack-frame bookkeeping: exact frame size, field offsets, 16-byte alignment, not stomping the saved frame-pointer/link-register pair. That kind of error is invisible to reasoning ("looks right") but a CPU rejects it instantly with a bus error.

So the skill externalizes that one weak spot to a small deterministic tool (scripts/frame.py) that lays out frames and checks alignment, and it relies on actually running the binary as ground truth. LLM does the part it's good at, a tiny tool owns the part it's bad at, execution is the backstop.

Install

This is a Claude Code skill. Clone it into your skills directory:

git clone https://github.com/drewmccormack/llmc.git ~/.claude/skills/llmc

Then in Claude Code:

/llmc path/to/program.c
/llmc main.c math.c          # multiple files link together

Claude will hand-compile, build, run, and show you the output.

Requirements

  • Apple Silicon Mac (arm64, macOS) — the assembly targets the Apple ARM64 / Mach-O ABI.
  • The Xcode command-line tools (clang, used as assembler/linker only).
  • Python 3 (for frame.py).

Porting to x86-64 or Linux/ELF is a matter of swapping the ABI reference; the approach is the same.

How it's structured

SKILL.md                  the skill: workflow + ABI quick reference
references/arm64-abi.md    worked assembly patterns (prologue, printf, recursion, linking)
scripts/frame.py           deterministic stack-frame layout + alignment tool
examples/                  C programs proven to compile and run via the skill

Caveats, honestly

Small programs in territory the model is fluent in. This is not a general-purpose C compiler — there is no optimizer, no standard-library headers beyond what you declare, and exotic language features will need new patterns. The trust comes from running the binary and checking its output, not from the model's confidence in its own assembly. It's a demonstration that the idea is real, and a genuinely useful toy.

Originally built as an experiment in "what if LLMs just compiled code themselves?"

Ver o original no GitHub

Bom para

Relacionados