Skip to content

Latest commit

 

History

History
39 lines (29 loc) · 1.61 KB

README.md

File metadata and controls

39 lines (29 loc) · 1.61 KB

fsc

felix's stupid (c) compiler

fsc is an attempt to compile some subset of C. this will probably not work on real world c programs. the main goal is to be able to compile itself

notes

there are a few memory leaks, mostly one time allocations that are never cleaned up. this is somewhat lazyness, and somewhat a design decision as compilers are (hopefully) short lived programs and the memory will be freed up anyway by the operating system

this compiler is not compliant to any c standard, nor will it be. its mostly written with referral to the c99 and c11 specs.

the main goal here is to produce a compiler that can compile itself

there are little to no semantic checks, the compiler mostly assumes that the code given to it is error free. this may change in the future, but first the frontend and the codegen is all i care about.

there are no optimisations, though this is something i want to experiment with

the compiler uses an existing pre-processor via cc -E. this aspect of the compiler is very hacky! perhaps ill try implement my own pre-processor in the future but this isn't my interest right now

building

to build fsc you need:

references

c99 spec c99 spec c99? BNF c11? ANTLR grammar