This is the official Jadavpur University Compiler Compiler repository.
- Supports a subset of the C language for now.
- Custom grammar files to easily extend the language.
- LL(1) parsing with panic mode error recovery.
- Generates .json parse tree outputs for easy visualization with Treant.js.
- 100% Open Source (Apache-2.0 License)
The JuCC project is built and tested on Ubuntu 20.04.
$ git clone https://github.com/TheSYNcoder/JuCC
$ cd JuCC
$ sudo ./script/installation/packages.sh
$ cd server
$ npm i
$ cd ..
$ mkdir build
$ cd build
$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
$ ninja jucc
$ ./bin/jucc -g <grammar_file> -f <input_file> -o <output_json_file>
To run the unit tests provided,
$ mkdir build
$ cd build
$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
$ ninja
$ ./bin/jucc_test
To run the benchmarks,
Note: -DCMAKE_BUILD_TYPE=Release
is needed
$ mkdir build
$ cd build
$ cmake -GNinja -DCMAKE_BUILD_TYPE=Release ..
$ ninja
$ ./bin/jucc_benchmark
Before pushing or making a pull request ( The tests must pass, compulsory !! )
$ ninja
$ ninja check-format
$ ninja check-clang-tidy
$ ninja check-lint
$ ninja test
To add a new unit test, make a folder with the same relative path as in the src folder, and define your test. Please refer to docs for more details about writing tests using the googletest framework.
Additional Notes:
- If you know what you're doing, install the prerequisite packages from
./script/installation/packages.sh
manually.
Please see the docs.
Contributions from everyone are welcome!