Inspiration
I have always wanted to gain a better idea of how computer programming languages actually take code syntax and translate them into true computer language. I figured trying to rebuild a c compiler piece by piece would give me a very fine grained understanding of how the compiler truly works at every level. From lexing, parsing, to ast tree generation, syntax validation and codegen lowering to llvm ir, discovering how each layer of the stack integrates and communicates was always so fascinating to me.
What it does
This compiler allows for complete normal c behavior and expectations and aims to be fully stable and stringently tested. The extensions layers that exist on top of the normal c behavior aim to allow for more exact and correct ai agentic code validation. So that agents can create code with the programming language extensions system to allow for normal code to be compiled with either FisiCs or a normal c compiler like Clang. FisiCs offers the benefit of allowing for output and validation that all physical code computations and correct and valid syntactically, and it also verifies no sneaky basic memory issues exist in the code.
How we built it
I started with the lexer and parser hand writing out the initial layers and building up those 2 layers as much as I could with early ai supported education of how compilers work. As I expanded the compilers parser layer I began to realize just how crazy of an undertaking this was and started to focus heavily on specific areas of parser and lexer behavior one at a time. This allowed me to build up a grammar and syntax that matched c slowly over time. Focusing on equations and basic expressions first and working up from there. As ai agents became more useful I began to have more autonomy in the code creation layers as we got to more syntax and codegen llvm ir output, this is where having ai agents for code synthesis was extremely useful as I was free to focus on the top level planning and routing while the sub agents were able to work on the code specifics. After a solid base was built and a large test suite was validated I began building up the extension layers that sit on top of the c behavior and making sure the agentic use was properly built and installed into the base of the code.
Challenges we ran into
The sheer complexity in just how many expressions can be written and understood in C syntax was very overwhelming at the beginning and there were many times I would make a few steps forward realize a large part of my system had regressed and would have to rebuild certain layers again. The idea of slowly building behaviors over time was useful but it did cause a lot of early infrastructure and code was a bit lacking in what it needed to be able to do. And as such as we expanded aspects of the system it would require large rewrites of certain areas.
Accomplishments that we're proud of
Getting all 15 of my programs that’s I’ve built in C fully compilable and runnable through object files compiled through my compiler was an incredible feeling. Using a program that was created through your own work and is running using a code translation system you built was such a powerful and motivating feeling. Truly unlocked a deep fascination with how computers can be used to their full potential.
What we learned
The main lesson learned was just to keep going, when I started I thought a compiler was a simple system of lexer and parser and that the main complexity was understanding the grammar of the code. Little did I know just how many translations the code has to go through before it reaches a computer understandable state. It really reinforced the idea that consistent forward progress is incredibly powerful if you work continuously on the issues in front of you taking the time to understand where the best next direction is to go
What's next for FisiCs
I plan to make this compiler the main compilation engine for all my programs so that it becomes the connective structure for my system. Building up more tested correct c behavior is the top behavior along with subtle small incremental improvements to the extension system so they remain minimal but extremely effective at what they do.
Log in or sign up for Devpost to join the conversation.