This repository (will) contain the code for cgull, a c++-inspired language, well before I pivoted to target JVM bytecode for time (class assignment).
See the informal spec for more details on the language (Language Definition - Examples and Semantics assignment).
See the formal grammar for the formal definition of the language. (Language Definition - Formal Grammar assignment)
See Manual Building/Assembling/Running for more details about specific commands.
Java is required for the ANTLR generation and JASM for generating bytecode. Both jars are included for convenience. If you must source them yourself, 4.13.2 is the expected ANTLR version and this specific PR of JASM is the one that works with it (needed for empty package names on classes).
The cmake project requires that the antlr4 cpp runtime be locatable. This has only been tested on macOS through homebrew (as seen by the hints) and should be similar for most Linux package managers, but I will see about making this work on Windows as well (for my own sanity too).
Assuming all dependencies are installed, the src/run.sh script will build and run the project. The argument for the file to parse is required. Please cd into the src directory before running the script.
TODO: windows script equivalent
Known working with Java 23.0.2
cd src
./run.sh <file> [--lexer | --parser | --semantic ]If you have issues with the bootstrap makefile or run.sh script in general, you can use the following commands to build and run the project manually.
# --- compiling cgull ---
# generate makefile w/ cmake
cd src
mkdir build
cd build
cmake ..
# build the project
make
# --- running the cgull compiler ---
cd ..
./build/cgull <source_file> [--lexer | --parser | --semantic]
# --- running the jasm assembler ---
# if on windows, use `jasm.bat` instead of `jasm`
# run the assembler for EVERY .jasm file in the out directory (could do with a loop or something)
# !!! note that the input files are relative to the input directory specified with the i argument
./thirdparty/jasm/bin/jasm -i out -o out Main.jasm
./thirdparty/jasm/bin/jasm -i out -o out IntReference.jasm
./thirdparty/jasm/bin/jasm -i out -o out StringReference.jasm
# --- running the assembled class files ---
# run the class files, with the classpath being the out folder we just assembled the files in
java -cp out Main