vyPal's C Compiler
  • C 99.5%
  • Makefile 0.5%
Find a file
2026-04-13 13:42:43 +02:00
examples Add comparison ops to parser 2026-04-13 13:42:43 +02:00
src Add comparison ops to parser 2026-04-13 13:42:43 +02:00
.gitignore Add makefile 2026-03-12 15:41:52 +01:00
Makefile Add makefile 2026-03-12 15:41:52 +01:00
README.md Update repo URL 2026-03-12 15:50:39 +01:00

vyPal's C Compiler (VCC)

This is my attempt at writing a quite basic compiler in C, for a small subset of the C language.

wakatime

Mirrors

Host Details
My personal git server Primary server, part of future collection of projects written from scratch
GitHub GitHub mirror - primarily for exposure and to accept Issues/PRs

Plans

My primary goal is to get this compiler to a state, in which it will be able to compile itself. Will this happen? Who knows. However that is why am keeping the use of external libraries and functions from them minimal.

Current TODO list:

  • haven't had a chance to think this far into the future

How to use

To use the compiler, you first need to compile it. I've finally setup a Makefile so building is now much easier:

make

And that's about it, you can now run the command and provide a input file and optionally the name for the output file that the compiler will generate:

./build/vcc examples/test.c -o out.s

Or it is also possible to combine the building and running into one command:

make run examples/test.c -o out.s

Once you have the generated assembly file, you must assemble and link it. The assembly is intended for use with nasm and ld. You can link it like this:

nasm -f elf64 out.s -o test.o && ld test.o -o test

After this, you will finally have an executable file for x86_64 Linux!

./test

What works

  • Function definitions
  • Defining function arguments
  • Variable definition
  • Assignment to variables
  • Basic arithmetic (+ - * / %)
  • Return void
  • Return value
  • Basic dead code elimination