ProductPromotion
Logo

C++ Programming

made by https://0x3d.site

GitHub - rui314/8cc: A Small C Compiler
A Small C Compiler. Contribute to rui314/8cc development by creating an account on GitHub.
Visit Site

GitHub - rui314/8cc: A Small C Compiler

GitHub - rui314/8cc: A Small C Compiler

8cc C Compiler

Note: 8cc is no longer an active project. The successor is chibicc.

8cc is a compiler for the C programming language. It's intended to support all C11 language features while keeping the code as small and simple as possible.

The compiler is able to compile itself. You can see its code both as an implementation of the C language and as an example of what this compiler is able to compile.

8cc's source code is carefully written to be as concise and easy-to-read as possible, so that the source code becomes good study material to learn about various techniques used in compilers. You may find the lexer, the preprocessor and the parser are already useful to learn how C source code is processed at each stage.

It's not an optimizing compiler. Generated code is usually 2x or more slower than GCC. I plan to implement a reasonable level of optimization in the future.

8cc supports x86-64 Linux only. I have no plan to make it portable until I fix all known miscompilations and implement an optimization pass. As of 2015, I'm using Ubuntu 14 as my development platform. It should work on other x86-64 Linux distributions though.

Note: Do not have high expectations on this compiler. If you try to compile a program other than the compiler itself, there's a good chance to see compile errors or miscompilations. This is basically a one-man project, and I have spent only a few months of my spare time so far.

Build

Run make to build:

make

8cc comes with unit tests. To run the tests, give "test" as an argument:

make test

The following target builds 8cc three times to verify that stage1 compiler can build stage2, and stage2 can build stage3. It then compares stage2 and stage3 binaries byte-by-byte to verify that we reach a fixed point.

make fulltest

Author

Rui Ueyama [email protected]

Links for C compiler development

Besides popular books about compiler, such as the Dragon Book, I found the following books/documents are very useful to develop a C compiler. Note that the standard draft versions are very close to the ratified versions. You can practically use them as the standard documents.

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory