The TDS24/BBC Compiler translates .ctds source files into assembly code. This guide will help you set up, build, and run the compiler, as well as execute test cases.
Ensure the following tools are installed on your system:
- Git: For cloning the repository.
- Make: To build and manage the project.
Clone the repository to your local machine with:
git clone https://github.com/eabalestra/bbc-compiler.git
cd bbc-compilerTo build the compiler, use the following command:
make buildThis generates the required files to execute the compiler.
To process a .ctds file and generate assembly code:
make c-tds inputs/input.ctdsThis will produce an assembly file named output.s.
You can compile the generated assembly code using gcc like a typical C file:
gcc output.sIf you need to link it with additional functions, you can do so:
gcc output.s functions.cThis will create an executable named a.out. Run it with:
./a.outThe repository includes multiple .ctds input files under the inputs/ directory. To test a specific scenario, modify the input file path in the Makefile and run:
make testThe project documentation is located in the docs folder as Compiler-Balestra-Buil-Compagnucci.pdf.