This repository contains the collected labs, resources, and study materials for the Comp407 Compiler course. It is organized to support the weekly progression of the course, with each lab isolated in its own directory.
To build and run a lab instantly:
- Open a grammar file (e.g.,
labs/lab03/grammar/lab03.g). - Press
Ctrl+Shift+Band select "Java: Compile Lab". - To run, use the "Run Current Lab" task (accessible via
F1>Run Task).
The project follows a standardized layout to keep things clean and predictable:
lib/: Contains core dependencies (antlr-3.4-complete.jar).labs/: The core coursework, numbered by week:grammar/: ANTLR grammar files (.g).src/: Your handwritten Java code (e.g.,Main.java).tests/: Sample input files (.txt) to test your parser.output/: Generated and compiled artifacts (Git-ignored).
resources/: General course-wide study guides and exercises.
If you prefer using the terminal, run these commands from the root of the repository.
java -jar ./lib/antlr-3.4-complete.jar -o ./labs/lab01/output/ ./labs/lab01/grammar/lab01.gjavac -cp ".:./lib/antlr-3.4-complete.jar" -d ./labs/lab01/output/ ./labs/lab01/src/*.java ./labs/lab01/output/*.javajava -cp ".:./lib/antlr-3.4-complete.jar:./labs/lab01/output/" Main