π Check the code on GitHub
Overview
The Plic Compiler is a Java compiler for the Plic language, a simple language created for educational purposes.
Goal
The primary goal behind the building of this compiler was to learn:
- how an assembly language works;
- how a compiler works and how to build one for a simple language;
- how to generate MIPS assembly code from a high-level language;
- how to analyze and optimize code.
Features developed
- Lexical analysis
- Syntax analysis
- Semantic analysis
- Abstract Syntax Tree (AST) generation
- Code generation
Challenges Faced
The main difficulty here was to understand how assembly and compiling works and how to build a compiler, all within a tight timeframe. Each week was really intense, with a new part of the compiler to build and to test.
Skills Acquired
Skills | Details |
---|---|
Compiler Development | I learned how to build a compiler for a simple language. |
High to Low-Level Code Generation | I learned how to generate assembly code from a high-level language. |
Problem-solving | I faced numerous challenges during the development process and had to find effective solutions for them. |
Batch Testing / ApprovalTests | I learned how to test my compiler with a lot of test cases. Plus, I took the opportunity to integrate ApprovalTests to batch test PLIC programs. |
Generate Jar file | I learned how to generate a Jar file to distribute my compiler. |
Conclusion
Building the Plic Compiler was a challenging but rewarding experience. I learned a lot about how programming languages are working and built. Even if itβs not perfect because of shortened delays, Iβm satisfied of the final result and the knowledge I acquired.