This project is an implementation of a garbage collector for a simple, JavaScript-like language called ToyLang. It features a mark-and-sweep garbage collector and includes a suite of benchmarks and analysis scripts to evaluate its performance.
Before you begin, ensure you have the following tools installed on your system (Linux or macOS):
- Java Development Kit (JDK): Required to compile and run the interpreter. You can check if you have it with
javac --version. - Python 3: Required for running the analysis scripts. You can check with
python3 --version. - pip3: The package installer for Python, used to install dependencies.
- ANTLR v4.13.2 JAR: The ANTLR parser generator library. The project expects the file
antlr-4.13.2-complete.jarto be in the root directory.
A setup script is provided to compile the project and install all necessary dependencies.
-
Make the script executable:
chmod +x installs.sh
-
Run the installation script:
./installs.sh
This script will:
- Verify that all prerequisite tools are available.
- Generate the Java parser and lexer from
ToyLang.g4using ANTLR. - Compile all Java source files (
.java->.class). - Install the required Python packages (
pandas,matplotlib,numpy) using therequirements.txtfile.
-
Make the compile executable:
chmod +x compile.sh
-
Run the compile script:
./compile.sh
This script will:
- Compile all Java source files (
.java->.class).
The project includes a simple script to execute a default benchmark and generate an analysis.
-
Make the run script executable:
chmod +x run.sh
-
Execute the script:
./run.sh
This specific script will:
- Run the interpreter on the
test.toyfile. - Save the benchmark output to
plots/results_short_lived.log. - Automatically run
analyze_results.pyon the log file to generate plots in theplots/directory.
- Run the interpreter on the
A Makefile is included with a clean command to remove all generated files, including compiled classes, logs, and plots.
make clean