15 lines
1.0 KiB
Markdown
15 lines
1.0 KiB
Markdown
# Wacc Compiler
|
|
|
|
A compiler for the Wacc language built in Scala, supporting lexical analysis, parsing, semantic analysis, and AArch64 assembly code generation.
|
|
|
|
## Pipeline
|
|
|
|
The Wacc compiler uses the Parsley library to parse the source file into an abstract syntax tree (AST). It then performs semantic analysis in two stages: variable renaming for scope resolution, followed by type checking. In the backend, the AST is translated into an intermediate representation (IR) designed for control-flow and optimisation. Finally, the optimised IR is converted into AArch64 assembly instructions, which are written to an output file ready for compilation and execution.
|
|
|
|
## Additional Features
|
|
|
|
- **If Expressions**: Supports embedding conditional expressions within larger expressions.
|
|
- **Parallel Imports**: Optimises compilation by handling multiple imports in parallel.
|
|
- **Function Overloading**: Allows functions with different parameter types to share names.
|
|
- **Peephole Optimiser**: Removes redundant instruction pairs and simplifies moves.
|