Work

βš™οΈ The Plic Compiler

Java
Compiler
MIPS
Code Analysis
Code Generation
Abstract Syntax Tree

🎌 A Java compiler for the Plic language, a simple language created for educational purposes.

Plic Compiler
πŸ“ 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

SkillsDetails
Compiler DevelopmentI learned how to build a compiler for a simple language.
High to Low-Level Code GenerationI learned how to generate assembly code from a high-level language.
Problem-solvingI faced numerous challenges during the development process and had to find effective solutions for them.
Batch Testing / ApprovalTestsI 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 fileI 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.