-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Welcome to the wiki for the SPL compiler!
In this technical report, we will go over all the steps that were taken to construct the compiler. We will outline all the problems that are generally encountered during developing each specific component of the compiler, and how these issues were solved.
The whole project, from Lexing up until Code Generation was written in Java. There was some debate on which programming language to use. Initially, python was the first choice, as it provides easy and fast prototyping. However, python is an interpreted language and because of this it is quite slow. For these reasons, it felt awkward to construct a compiler in Python.
The next candidate was a functional language, like Haskell. However, neither of us felt very confident with their proficiency of this language. So finally, we decided to go with Java, it provides strong typing and it is easy to implement various design patterns. These are central in our implementation of the compiler, especially the Visitor Pattern. This pattern ensured that every component was able to handle the same types of Nodes, i.e. Expressions, Statements, Declarations, and their subtypes.
We decided to split our compiler in different phases: Lexing, Parsing, Type Checking and finally Code Generation. These will be explained in subsequent sections. Followed by the extensions we have made.
These sections are available in the sidebar.