We welcome contributions to the kitlang-rs project!
To make sure the contribution process goes smoothly, please follow these guidelines. This guide is intended for who have never contributed to this repository before. Its purpose is to familiarize them with the codebase and explain the contribution process.
I'll go over this structure briefly to get you up to speed. This project has two packages:
-
kitlang: This is the core compiler library. It handles:- Lexing: breaking source code into tokens.
- Parsing: Building an AST from tokens using
pest(grammar defined inkitlang/src/grammar/kit.pest). - Code Generation: Translating the AST into an intermediate representation and then into executable code.
- Type Checking, Semantic Analysis, etc. (These are areas that are continually being developed).
-
kitc: This is the main CLI tool that users interact with. It provides thekitcexecutable, which wraps the functionality of thekitlanglibrary to compile.kitfiles. (and maybe initialize Kit projects, likecargo init)
If you're looking for a good place to start, check out:
- the "Good First Issues" section below;
- the README's Roadmap section which points at things this project needs help with.
If you have any questions on where you could start, please file an issue, even if you need to ask a question you think is "stupid". I'm happy to provide any further information you need.
If you're looking for a simple way to get started, we label issues that are suitable for beginners with "good first issue".
To get started, you'll need Rust and Cargo installed. If you don't have them, follow the instructions on the official Rust website.
-
Fork and clone the repository:
# or you can clone upstream and then change remote git clone https://github.com/your-username/kitlang-rs.git cd kitlang-rs
-
Build the project:
cargo build
This will build both the
kitlanglibrary and thekitccommand-line tool.
To build the kitc executable:
cargo build --bin kitcYou can then run it to compile a Kit file:
cargo run -- kitc compile examples/helloworld.kitBefore submitting any changes, please ensure all tests pass:
cargo testThis will also test your changes against actual Kit code samples at examples/.
We maintain a consistent code style and quality throughout the project:
-
Formatting: Always format your code with
cargo fmt.cargo fmt
-
Linting: Check your code for common mistakes and unidiomatic Rust with
cargo clippy.cargo clippy -- -D warnings
Please address any warnings reported by Clippy, unless they make the code read worse. If you don't know how to resolve a warning, please ask in the PR you're working on.
When implementing a new feature for the Kit language, please ensure you:
- Add minimal example code testing the new feature in the
examples/directory. - Verify that your example compiles correctly using the
kitcCLI tool. - Add unit tests where feasible to make sure the feature works as expected and prevents regressions.
- Fork the repository and create a new branch for your feature or bug fix.
- Make your changes, ensuring they adhere to the code style and testing guidelines.
- Write clear, concise commit messages (preferably following Conventional Commits). If you're unfamiliar with Conventional Commits, don't worry--I won't reject your PR over it.
- Push your branch to your fork and open a pull request against the
mainbranch of this repo. - Provide a detailed description of your changes in the pull request, and why they make sense in the context of this repository.
-
When do my changes (or issues) get reviewed?
Since I'm the sole maintainer, I don't have all day to review PRs and issues. This means that I may not respond immediately, but it will be reviewed within a few hours to a day after.
-
What types of contributions are accepted?
I accept mainly:
- bug fixes
- features (i.e. new functionality, grammar implementations, etc.)
- documentation updates
Basically any, as long as they make sense in the context of the project.
-
When is it appropriate to follow up?
I check my GitHub inbox fairly often in my free time. If by the day after you haven't heard from me, feel free to ping me.
-
Do you need to know about compilers to contribute?
Not at all. I also appreciate contributions that aren't just about compiler work: it can be writing error messages, or adding example Kit programs. You name it!