The importance of compilers within software development cannot be overstated. A compiler is a tool which takes source code and translates it into an executable program. As a software developer, I've always been fascinated by compilers and how they work. That's why I decided to build my own compiler, which can translate a high level language into assembly code. My compiler is still a work in progress, but I wanted to share my journey with others who might be interested in compilers and programming language implementation.
In this series of blog posts, I will walk you through on how I built a compiler from scratch. I'm taking an incremental approach to building my compiler, which means I'm implementing each stage in smaller steps rather than trying to build the entire compiler at once. This approach allows me to focus on each stage in more detail and make sure that each stage is working correctly before moving on to the next one.
After initial research on what is required for successfully creating a compiler, I had determined that I will create a basic high-level language and use C for implementing the project. The compiler will be able to read/parse my language into assembly code and the assembly I chose is arm64 (as I have an M1 mac).
The building process I had in mind was to build a miniscule compiler and then expand it functionalities step by step.
So, I will write about it all in this series of blog posts as I continue building my compiler.
Before getting started on the compiler you have to design the grammar. I will discuss on how I designed my grammar and how will it be helpfull in building the compiler.
I hope you find this series of blog posts interesting and informative. Whether you're a beginner or an experienced developer, I believe that understanding how compilers work is an essential part of becoming a better programmer. Through this experience, I learned the importance of thorough planning and research, as well as the value of persistence and problem-solving skills. I also gained a deeper understanding of programming concepts and the intricate workings of programming languages. So, let's get started!