Skip to content

Latest commit

 

History

History
30 lines (21 loc) · 1.38 KB

File metadata and controls

30 lines (21 loc) · 1.38 KB

yarcc: A hobby C compiler written in Rust [WIP]

This is a hobby C compiler written from scratch in Rust that emits x86_64 assembly compliant with System V ABI. This ongoing project aims to support the majority of C89/90 features.

Running and testing

Currently, you can either provide the raw C code as the first argument or pass the path to the file you want to compile:

cargo run examples/singlenum.c

The entire test suite can be executed by cargo test.

All of the development and testing have taken place on an Ubuntu 18.04 VM.

Major TODOs

  • Preprocessor
  • Floating point arithmetics
  • Type casting
  • Replace the lexer with a DFA-based implementation

Caveats

The nature of this project being educational, the codebase is quite lax on error checking.

On another note, I decided not to support obsolete features such as the following:

  • Trigraphs
  • K&R style declarations and definitions
  • Function declarations without a prototype

References

In the earliest stage of development, I mainly referred to this book. In addition to the normative reference which is the standard itself, I have also referred to the Dragon Book, from which I gained a lot of design insights.