git404hub

what is wcc fr?

igor84/wcc — explained in plain English

Analysis updated 2026-05-18

35ZigAudience · developerComplexity · 4/5Setup · moderate

tl;dr

A hand-written C compiler in Zig, built while working through the book Writing a C Compiler, targeting Linux only.

vibe map

mindmap
  root((wcc Compiler))
    What it does
      Compiles subset of C
      Follows Writing a C Compiler book
      Linux only output
    Pipeline stages
      Lexer and parser
      Semantic analysis
      Tacky IR
      x86_64 codegen
    Design choices
      Zig data oriented style
      Minimal allocations
    Extras
      Editor configs
      AI usage disclaimer
    Audience
      Compiler learners
      Zig developers

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Study a real, working example of how a C compiler's lexer, parser, and code generator fit together.

VIBE 2

Follow along with the Writing a C Compiler book using a completed Zig implementation as reference.

VIBE 3

See how someone applies Zig's data oriented design principles to a compiler project.

what's the stack?

Zigx86_64 Assembly

how it stacks up fr

igor84/wccelectricalgorithm/protomqkristoff-it/zig-bundler
Stars353127
LanguageZigZigZig
Setup difficultymoderatemoderateeasy
Complexity4/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · moderate time til it works · 1h+

Requires the Zig toolchain, and generated assembly only runs correctly on Linux.

in plain english

This project is a C compiler, built by one person while working through the book Writing a C Compiler by Nora Sandler. It compiles a subset of the C programming language, specifically the parts covered in that book, and it targets Linux systems only. It is not meant to handle the full C standard, so it will not compile every C program you might throw at it, but it does include all the extra features the book describes. The compiler is written in the Zig programming language, and the author chose to lean into Zig's data oriented design style rather than following the book's structure line for line. That means the code tries to keep memory allocations and stored data to a minimum. The project is organized into clear stages: reading the source code and breaking it into tokens, building a tree that represents the program's structure, checking that the program makes sense, generating an intermediate representation called Tacky IR, optimizing that representation, and finally producing x86_64 assembly code for the processor to run. The README goes into real technical detail about how the internal data structures work, showing code snippets of how syntax tree nodes and instructions are represented compactly using small structs and numeric indexes rather than named variables. This is aimed at readers who already understand compiler concepts and want to see how one specific implementation handles them in Zig. The project took about 10 months of part time work, mostly evenings and weekends. The author includes an unusually detailed disclaimer about AI use: no code was written by AI, but AI chat tools were used to help debug incorrect assembly output and to adjust a test suite to parse a different assembly syntax, at a cost of about $35. Configuration files for VS Code and Zed editors are included, along with build and test commands, making it easier for someone following the same book to get the compiler running and test it against the book's official test suite.

prompts (copy fr)

prompt 1
Explain how the Tacky IR stage in this compiler differs from the final assembly generation stage.
prompt 2
Walk me through how this project represents AST nodes compactly using indexes instead of named fields.
prompt 3
Help me set up the build and test commands from this repo's editor configuration files.
prompt 4
Compare this compiler's register allocation approach to a more traditional compiler design.

Frequently asked questions

what is wcc fr?

A hand-written C compiler in Zig, built while working through the book Writing a C Compiler, targeting Linux only.

What language is wcc written in?

Mainly Zig. The stack also includes Zig, x86_64 Assembly.

How hard is wcc to set up?

Setup difficulty is rated moderate, with roughly 1h+ to a first successful run.

Who is wcc for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.