Compiler implementation for PCL language in OCaml using LLVM. See implementation report in PCL.pdf in greek.
- OCaml 4.02.3
- ocamlbuild
- ocamlfind
- menhir
- llvm (LLVM 9.0.1 , OCaml llvm 9.0.0 )
- cmdliner
The versions mentioned in the links above are the ones used in project development and the ones tested. Once all packages needed in Makefile are installed (installation via opam recommended), produce the compiler executable simply by cloning the project and running make.
The PCL library functions are implemented in this repo. For convenience the contents of the repo are copied in folder edsger_lib. To build library functions :
cd edsger_lib
./libs.sh
A lib.a
file is created and will be required later.
The compiler executable is named pclc
. Run with file input :
./pclc path/to/program.pcl
This will produce path/to/program.asm
and path/to/program.imm
. To see further options
run :
./pclc --help
Explicit program behaviour specified in greek in language specification in chapter 4.
To produce final executable edit link.sh
CLANG variable if needed (versions 8.0.1, 9.0.1 tested) and run :
./link.sh path/to/program
If path/to/program.asm
exists the executable path/to/program will be created. Alternatively run :
clang-9 path/to/program.asm path/to/edsger_lib/lib.a -o executable_name
to create the executable and run it :
./executable_name