This directory and its subdirectories contain source code for coolc, the compiler for Classroom Object Oriented Language created for educational purposes by Alexander Aiken.
Please see the documentation provided in docs/ for further assistance with coolc.
-
Checkout COOLC:
git clone https://github.com/a-gafiyatullin/coolc.git
-
Configure and build COOLC:
- Prerequirements:
- clang-14;
- gtest;
- boost-1.61;
- llvm-14;
- You can use
VS Code
andDev Containers
extension to getUbuntu 22.04
which contains these packages.
build.sh [-release/-debug] [options]
Some useful options:-clean
--- clean build directory before compilation.-asan
--- build with AddressSanitizer (debug only).-ubsan
--- build with UndefinedBehaviorSanitizer (debug only).-test
--- run tests after building.-mips
--- build for SPIM emulator.-llvm
--- build with LLVM for host architecture.-shadow-stack-gc
--- (llvm build) build with LLVM Shadow Stack.-statepoint-example-gc
--- (llvm build) build with LLVM Stack Maps. (default)-no-gc
--- (llvm build) build without GC (ZeroGC only).
- Prerequirements:
-
Some useful runtime options for LLVM-based build with GC (pass them as argument to executable):
MaxHeapSize
--- maximal heap size (e.g.MaxHeapSize=1024[Gb/Mb/Kb/no specifier for bytes]
).GCAlgo
--- GC algorithm (e.g.GCAlgo=1
):ZeroGC
(code 0) --- just allocate memory without collecting.MarkSweepGC
(code 1) --- use Mark-and-Sweep GC.ThreadedCompactionGC
(code 2) --- use Jonkers's threaded compaction (Mark-and-Compact) GC (default).CompressorGC
(code 3) --- use Kermany and Petrank's compressor (Mark-and-Compact) GC.SemispaceCopyingGC
(code 4) --- use Semispace Copying GC (Copying) GC.
PrintGCStatistics
--- print some statistics about GC (e.g.+PrintGCStatistics
);DoOpts
--- do custom optimizations:- NCE --- Null Check Elimination;
- DAE --- Dead Allocation Elimination (in pair with GVN).
-
Note, that executables, that were generated by coolc, require runtime library (libcool-rt.so):
- This library is located in bin folder with coolc;
- You have to add it to your LD_LIBRARY_PATH;
- The easiest way to do it is to build compiler with command
source ./build.sh