A compiler for the Tony language... This is part of the Compilers course, at NTUA-ECE. To get a basic idea of how a Tony program looks, navigate through the Tony-Compiler/programs/correct directory.
The Tony Compiler was developed and tested in a Linux-Ubuntu environment.
- flex=
2.6.4-6 - bison=
2:3.0.4.dfsg-1build1 - libgc-dev=
1:7.4.2-8ubuntu1 - clang-10
- llvm-10
- python>=
3.7.5(for running tests and thetonybash script)
-
Change directories to the folder of the project:
cd <your-base-dir>/Tony-Compiler -
Run:
make tonycto create the./tonycexecutable. -
Run:
chmod +x tonyso you can run thetonyscript. -
Run:
./tony <tony-program>.tony. A<tony-program>.outfile is produced in the directory of your Tony program. In the same directory, you'll also find<tony-program>.asmand<tony-program>.immfiles with the produced assembly code and intermediate code of your program. Also the script accepts the flags-O,-fand-i:-Ois for optimizations.-fis for reading the Tony program fromstdinand printing the final machine code instdout.-iis for reading the Tony program fromstdinand printing the LLVM IR tostdout.-his for help / usage instructions.
So, in this case you can run:
./tony -O -f -i <tony-program>.tony. -
Run your program executable:
./<tony-program>.out.
- Change directories to the folder of the project:
cd <your-base-dir>/Tony-Compiler - Run:
make tonycto create the./tonycexecutable. - Run:
./tonyc <tony-program>.tonyto produce the LLVM code of your program. A file calledout.llis created, and it contains the LLVM code. - Run:
clang-10 out.ll lib.a -o <desired-name>.out -lgcto produce the binary executable of your program. - Run your program executable:
./<desired-name>.out.
- Change directories to the folder of the compiler:
cd <tony-compiler-dir> - Run:
make tonycto create the./tonycexecutable. - Run the tests:
python3 programs/run_tests.py