https://github.com/i3abghany/kyoto
The Kyoto Programming Language and its compiler, Cyoto
https://github.com/i3abghany/kyoto
antlr4 boost compiler llvm programming-language
Last synced: 15 days ago
JSON representation
The Kyoto Programming Language and its compiler, Cyoto
- Host: GitHub
- URL: https://github.com/i3abghany/kyoto
- Owner: i3abghany
- License: mit
- Created: 2024-12-29T00:01:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-06T22:23:19.000Z (about 1 year ago)
- Last Synced: 2025-03-06T23:24:31.553Z (about 1 year ago)
- Topics: antlr4, boost, compiler, llvm, programming-language
- Language: C++
- Homepage:
- Size: 906 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Kyoto
This is the repository for the Kyoto Programming Language and its compiler, Cyoto. Kyoto is a statically typed, compiled language that is still in early design stages. The compiler is written in C++ and utilizes LLVM for analysis and code generation.
## Building
Cyoto requires the following dependencies:
- LLVM >= 20
- CMake >= 3.20
- Java >= 8
- antlr == 4.13.2
- Boost >= 1.74.0
- GCC >= 13 (for C++23 and std::fmt support)
To install the dependencies on Ubuntu, run the following commands:
```bash
$ sudo apt-get install llvm-20-dev cmake default-jre libboost-all-dev gcc-13 g++-13 libfmt-dev libzstd-dev
```
Antlr 4.13.2 can be installed from the official website's mirror as follows:
```bash
$ export REPO_TOP_LEVEL=`git rev-parse --show-toplevel`
$ mkdir -p $REPO_TOP_LEVEL/thirdparty
$ wget https://www.antlr.org/download/antlr-4.13.2-complete.jar -O $REPO_TOP_LEVEL/thirdparty/antlr-4.13.2-complete.jar
$ chmod +x $REPO_TOP_LEVEL/thirdparty/antlr-4.13.2-complete.jar
$ export PATH="$REPO_TOP_LEVEL/thirdparty:$PATH"
```
If llvm-20 is not available in the package manager, it can be installed using the script provided on the official website as follows:
```bash
$ wget https://apt.llvm.org/llvm.sh
$ chmod +x llvm.sh
$ sudo ./llvm.sh 20 all
```
To build the compiler, run the following commands:
```bash
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_CXX_COMPILER=g++-13 -DCMAKE_C_COMPILER=gcc-13
$ make cyoto -j$(nproc)
```
### Running Tests
To run the tests, you can use the following command:
```bash
$ make ktest -j$(nproc) && ./ktest
```
## Usage
To compile a Kyoto source file, run the following command:
```bash
$ ./cyoto --help
Usage: ./cyoto [OPTIONS] INPUT_FILE
The Kyoto Programming Language Compiler:
-h [ --help ] Print this help message
-r [ --run ] Run the program in `lli` after compilation
-o [ --output ] arg (=a.out) Output file for the executable binary
```
## Fuzzing the Compiler
This repository includes a grammar-based fuzzer for the Cyoto compiler, which is based on the ANTLR4 grammar for Kyoto defined in `kyoto/grammar/`.
The fuzzer is written in Rust. For more information on how to use it, refer to the [README](fuzzer/README.md) in the `fuzzer` directory.
# License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.