SectorC: A C Compiler in 512 bytes

xorvoid.com
February 7, 2026
10 min read
🔥🔥🔥🔥🔥
64/100
Summary
SectorC is a C compiler written in x86-16 assembly that occupies 512 bytes in the boot sector of an x86 machine. It supports a subset of C sufficient for writing functional programs, making it potentially the smallest C compiler ever created.
Key Takeaways
- SectorC is a C compiler written in x86-16 assembly that fits within a 512-byte boot sector of an x86 machine.
- It supports a significant subset of C, including global variables, functions, and control statements, allowing for the creation of functional programs.
- The compiler's design was inspired by minimalist programming concepts and aims to demonstrate the feasibility of fitting a C compiler into a very small memory space.
- The tokenizer for SectorC was developed to efficiently convert a stream of bytes into tokens, significantly reducing the complexity compared to traditional C compilers.
Coverage & discussions
Hacker News · xorvoid.com
Community discussions
Community Sentiment
Positives
- The elegant use of hashing for tokens and a pseudo symbol table showcases innovative thinking in compiler design, which could inspire future developments.
Concerns
- The lack of support for structs raises concerns about the practicality of this compiler, limiting its usability for real-world applications.




