https://github.com/dcepelik/mcc
Minimalist C compiler (work in progress).
https://github.com/dcepelik/mcc
c compiler optimization simple
Last synced: 6 months ago
JSON representation
Minimalist C compiler (work in progress).
- Host: GitHub
- URL: https://github.com/dcepelik/mcc
- Owner: dcepelik
- Created: 2016-12-07T20:56:20.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-26T19:22:17.000Z (over 8 years ago)
- Last Synced: 2024-01-30T01:17:11.733Z (over 2 years ago)
- Topics: c, compiler, optimization, simple
- Language: C
- Homepage:
- Size: 1.57 MB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Minimalist C Compiler (`mcc`)
(Or maybe Modular C Compiler? Or maybe both, I haven't decided yet.)
## Why do I bother?
(An apology for myself.)
* I want to know what goes into writing a compiler from scratch. Reading books about it
just won't do anymore.
* I hate Bison and Flex and I actually *enjoy* writing fast lexers and parsers by hand.
Don't judge me, everyone's got a perversion.
* I want to learn to write complex software and compilers have always attracted me.
* I need a framework to test out new code optimization algorithms without having to fight
over existing code.
* Writing a C compiler in C looks like an opportunity to get to know all the dark corners
of C.
* I'm interested in code optimization.
* I'd love to write something I can be proud of (at least a bit).
## Design Goals
* An experimental compiler rather than a production one.
* Make the code robust and reusable.
* Write it so that a reasonably smart person can read it and see how it works.
* Keep it short and terse.
### Front-end
* KISS
* C11-only
* Favor performance over flexibility
* Fast as hell
* Decent static analysis
* Warnings are errors by default
### Back-end
* KISS
* x86-64 only
* Favor flexibility over performance
* Highly modular
* Highly configurable
* Make it easy to hack
## Good Reading
* [John Regehr's Blog](https://blog.regehr.org/)