Back to directory

shecc

A self-hosting, educational optimizing C compiler that targets 32-bit Arm, AArch64, 32-bit RISC-V and x86-64, producing Linux ELF binaries.

shecc

shecc is a self-compiling optimizing compiler for a subset of the C language, built from scratch to target 32-bit Arm, AArch64, 32-bit RISC-V and x86-64. It generates executable Linux ELF binaries directly, with a self-contained front end and an integrated machine code generator, so no external assembler or linker is needed, and it ships a minimal C standard library for basic I/O on GNU/Linux.

Compilation runs in two passes: the first checks syntax and breaks complex statements into basic operations, and the second translates those operations into target machine code through an architecture-independent, static single assignment based middle-end. A register allocator suited to RISC-style architectures and support for dynamic linking against glibc round out the pipeline, and it emits ELF32 for Arm and RISC-V or ELF64 for AArch64 and x86-64 depending on the target's pointer width.

The compiler accepts a substantial subset of C syntax, including the common data types, control-flow statements, arithmetic and bitwise operators, arrays, typedefs, pointer arithmetic and preprocessor directives. It is written in ANSI C and released under the BSD-2-Clause license.

More in Languages

See all 48
  • QBasic Web Editor

    vahidyousefzadeh.com

    A browser-based QBasic 1.1 editor and interpreter that runs classic QBasic programs with DOSBox-accurate behavior, including text-mode graphics commands such as PRINT, COLOR and LOCATE, with sample programs and keyboard shortcuts to run and save.

  • A Brainfuck-inspired esoteric programming language adding absolute memory navigation, multiplier arithmetic, non-destructive inspection and inline conditionals, with its own interpreter.

  • C3 Playground

    play.c3-lang.org

    An in-browser playground that compiles and runs the C3 programming language entirely in WebAssembly, with no backend server, alongside its standard library and documentation.