Contributing to Keel
Thank you for your interest in contributing to Keel! This guide will help you get started.
Ways to Contribute
Report Bugs
Found a bug? Please report it:
- Search existing issues first
- Create a new issue with:
- Keel version (
keel --version) - Operating system
- Minimal reproduction case
- Expected vs actual behavior
- Keel version (
Suggest Features
Have an idea? We'd love to hear it:
- Check the roadmap for planned features
- Search existing feature requests
- Open a discussion or issue describing:
- The problem you're solving
- Your proposed solution
- Alternatives considered
Improve Documentation
Documentation improvements are always welcome:
- Fix typos and unclear wording
- Add examples
- Improve tutorials
- Translate documentation
Contribute Code
Ready to code? Here's how:
- Find or create an issue to work on
- Comment that you're working on it
- Fork the repository
- Make your changes
- Submit a pull request
Development Setup
Prerequisites
- Git
- Rust (latest stable)
- LLVM 15+
Clone and Build
# Clone the repository
git clone https://codeberg.org/keel/keel.git
cd keel
# Build
cargo build
# Run tests
cargo test
# Run the compiler
cargo run -- repl
Project Structure
keel/
├── crates/
│ ├── keel-parser/ # Lexer and parser
│ ├── keel-ast/ # Abstract syntax tree
│ ├── keel-types/ # Type system
│ ├── keel-compiler/ # Code generation
│ └── keel-runtime/ # Runtime library
├── stdlib/ # Standard library
├── tests/ # Integration tests
└── docs/ # Documentation
Code Style
Rust Code
- Follow standard Rust conventions
- Run
cargo fmtbefore committing - Run
cargo clippyand address warnings - Add tests for new functionality
Keel Code
- Use
keel fmtfor consistent formatting - Follow the style of existing stdlib code
- Document public functions
Commits
Write clear commit messages:
component: Short description (50 chars max)
Longer explanation if needed. Wrap at 72 characters.
Explain what and why, not how.
Fixes #123
Components: parser, types, codegen, runtime, stdlib, docs, cli
Pull Request Process
-
Create a branch from
main:git checkout -b feature/my-feature -
Make changes with clear commits
-
Add tests for new functionality
-
Update documentation if needed
-
Run the test suite:
cargo test -
Push and create PR:
git push origin feature/my-feature -
Respond to review feedback
PR Checklist
- Tests pass locally
- Code follows style guidelines
- Documentation updated
- Commit messages are clear
- PR description explains changes
Testing
Unit Tests
cargo test -p keel-parser # Test specific crate
cargo test # Test everything
Integration Tests
cargo test --test integration
Test Files
Place test cases in tests/cases/:
tests/cases/
├── pass/ # Should compile successfully
│ └── basic.kl
├── fail/ # Should produce errors
│ └── type_error.kl
└── run/ # Should compile and run
└── hello.kl
Debugging
Compiler Flags
# Show parsed AST
keel build --dump-ast
# Show typed AST
keel build --dump-typed
# Show generated IR
keel build --dump-ir
Logging
RUST_LOG=debug cargo run -- build
RUST_LOG=keel_parser=trace cargo run -- build
Getting Help
- Questions: Open a discussion
- Stuck on an issue: Comment asking for guidance
- Design decisions: Discuss before implementing
Code of Conduct
Be respectful and inclusive. We follow the Contributor Covenant.
License
By contributing, you agree that your contributions will be licensed under the MIT License.
Recognition
Contributors are recognized in:
- CONTRIBUTORS file
- Release notes
- Website credits
Thank you for contributing to Keel!