The problem
Most developers use compilers every day without thinking about what happens between source code and executable. I was fascinated by how there exists a program that converts code into machine language. The goal was to design a language, implement the pipeline from scratch, and transform the type-checked syntax tree into something a machine can run. The compiler transformed the code into LLVM IR which is further than many developers go.
Technical highlights
- I built a handwritten recursive descent parser.
- I implemented a simple type system and a type checker.
- The pipeline: Lexer > Parser > Checker (semantic analysis) > Lowering (to simplify conversion into LLVM IR) > LLVM IR Generation.
- The project stalled when I was unable to convert some more complex language features into LLVM IR.