Skip to content

dkumazaw/yarcc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Yet another toy C compiler written in Rust

Topics

Resources

License

Stars

Watchers

Forks