Description
shecc is a self-hosting, educational C optimizing compiler, built from scratch in ANSI C. It targets 32-bit Arm, AArch64, 32-bit RISC-V and x86-64, and it can compile itself. The compiler produces Linux ELF binaries for each target and includes its own front end and machine code generator, so no external assembler or linker is needed. It uses VIR, a value-centric SSA representation, for target-independent optimization, and it shares ABI lowering, register allocation and spill handling across the four targets. The compiler supports dynamic linking so generated programs can run with glibc, and it provides a minimal C library for basic I/O on GNU/Linux. The supported C subset includes common types such as char, short, int, structs, unions, enums and typedefs, control flow including switch and goto, arrays with initializers, and most operators and compound assignments.…
Highlights
- Self-hosting C compiler built from scratch
- Targets Arm, AArch64, RISC-V and x86-64
- Own front end and machine code generator
- SSA-based optimization with VIR
- Dynamic linking with glibc
Ratings & Reviews
No ratings yet
Be the first to rate Shecc.
People also visit
XCC
Standalone C compiler/assembler/linker/libc for x86-64/aarch64/riscv64/wasm
Shecc FAQ
What is shecc?
A self-hosting educational C compiler that targets four architectures and can compile itself.
Does it need an assembler or linker?
No. The README says it has its own front end and machine code generator, with no external assembler or linker.
Which C features are supported?
A subset that includes common types, control flow, arrays with initializers and most operators, according to the compatibility notes.
How do I start?
Follow the bootstrapping section of the README.
What are the best Shecc alternatives?
Popular alternatives to Shecc include XCC, Amacc and selfie. See all Shecc alternatives


