Skip to content
/ ass Public

Adam Soutar's Source compiler - an entirely handwritten C compiler

License

Notifications You must be signed in to change notification settings

adamsoutar/ass

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Adam Soutar's Source compiler

An all-the-way-down handwritten C compiler, just for fun :)

What?

ass compiles programs written in C down to x86-64 assembly code.

It has a tokeniser, parser and codegen module. You can run it like this to generate assembly:

ass input.c > output.s

Note: ass is not an assembler or linker. See compile.sh for assembling binaries

Implemented features

  • Variables Local, stack-based and global variables of all primitive types besides floats/doubles
  • Pointers Pointers, dereferencing, and the addressOf operator
  • Functions Functions + arguments can be defined and called
  • StdLib Call into standard library functions like printf
  • If statements With optional else
  • Loops Including unusual loop declarations like (;;)

Plus Probably more since I wrote this readme :)

Examples

See ./examples for some example code that ass can compile and run right now - including a FizzBuzz program!

Is it even a compiler if it can't do FizzBuzz?

About

Adam Soutar's Source compiler - an entirely handwritten C compiler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published