Updated README.md

This commit is contained in:
Sawalha 2025-05-24 21:20:50 +00:00
parent 4d6426c899
commit 313445a35e

View File

@ -1,35 +1,14 @@
This is the provided git repository for the WACC compilers lab. You should work # Wacc Compiler
in this repository regularly committing and pushing your work back to GitLab.
# Provided files/directories A compiler for the Wacc language built in Scala, supporting lexical analysis, parsing, semantic analysis, and AArch64 assembly code generation.
## src/main ## Pipeline
The src/main directory is where you code for your compiler should go, and just 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.
contains a stub hello world file with a simple calculator inside.
## src/test ## Additional Features
The src/test directory is where you should put the code for your tests, which
can be ran via `scala-cli test .`. The suggested framework is `scalatest`, the dependency
for which has already been included.
## project.scala - **If Expressions**: Supports embedding conditional expressions within larger expressions.
The `project.scala` is the definition of your project's build requirements. By default, - **Parallel Imports**: Optimises compilation by handling multiple imports in parallel.
this skeleton has added the latest stable versions of both `scalatest` and `parsley` - **Function Overloading**: Allows functions with different parameter types to share names.
to the build: you should check **regularly** to see if your `parsley` needs updating - **Peephole Optimiser**: Removes redundant instruction pairs and simplifies moves.
during the course of WACC!
## compile
The compile script can be edited to change the frontend interface to your WACC
compiler. You are free to change the language used in this script, but do not
change its name.
## Makefile
Your Makefile should be edited so that running 'make' in the root directory
builds your WACC compiler. Currently running 'make' will call
`scala --power package . --server=false --jvm system --graalvm-jvm-id graalvm-java21 --native-image --force -o wacc-compiler`, producing a file called
`wacc-compiler`
in the root directory of the project. If this doesn't work for whatever reason, there are a few
different alternatives you can try in the makefile. **Do not use the makefile as you're working, it's for labts/CI!**