Contributing to Zen C
May 8, 2026 ยท View on GitHub
First off, thank you for considering contributing to Zen C! It's people like you that make this project great.
We welcome all contributions, whether it's fixing bugs, adding documentation, proposing new features, or just reporting issues.
How to Contribute
The general workflow for contributing is:
- Fork the Repository: Use the standard GitHub workflow to fork the repository to your own account.
- Create a Feature Branch: Create a new branch for your feature or bugfix. This keeps your changes organized and separate from the main branch.
git checkout -b feature/NewThing - Make Changes: Write your code or documentation changes.
- Verify: Ensure your changes work as expected and don't break existing functionality (see Running Tests).
- Submit a Pull Request: Push your branch to your fork and submit a Pull Request (PR) to the main Zen C repository.
Issues and Pull Requests
We use GitHub Issues and Pull Requests to track bugs and features. To help us maintain quality:
- Use Templates: When opening an Issue or PR, please use the provided templates.
- Bug Report: For reporting bugs.
- Feature Request: For suggesting new features.
- Pull Request: For submitting code changes.
- Be Descriptive: Please provide as much detail as possible.
- Automated Checks: We have an automated workflow that checks the description length of new Issues and PRs. If the description is too short (< 50 characters), it will be automatically closed. This is to ensure we have enough information to help you.
Development Guidelines
Code Style
- Follow the existing C style found in the codebase. Consistency is key.
- Use
make formatto auto-format all source files with the provided.clang-format. - Use
make lintto verify formatting and check shell scripts. - An
.editorconfigfile is provided for consistent editor settings (4-space indent, UTF-8, LF endings). - Pre-commit hooks: Install with
pip install pre-commit && pre-commit installto automatically check formatting, trailing whitespace, and shell scripts before each commit. - Keep code clean and readable.
Project Structure
If you are looking to extend the compiler, here is a quick map of the codebase:
- Parser:
src/parser/- Contains the recursive descent parser implementation. - Codegen:
src/codegen/- Contains the transpiler logic that converts Zen C to GNU C/C11. - Standard Library:
std/- The standard library modules, written in Zen C itself.
Running Tests
The test suite is your best friend when developing. Please ensure all tests pass before submitting a PR.
Run All Tests
make test
Run Specific Test
./zc run tests/language/control_flow/test_match.zc
Or via the test runner:
make test only="tests/language/control_flow/test_match.zc"
Test with Different Backends
./tests/scripts/run_tests.sh --cc clang # Clang
./tests/scripts/run_tests.sh --cc zig # Zig cc
./tests/scripts/run_tests.sh --cc tcc # Tiny C Compiler
Specialized Test Suites
make test-lsp # LSP integration tests
make test-tcc # Full suite with TCC backend
make test-misra # MISRA C compliance checks
make test-asan # AddressSanitizer / UBSan tests
Warnings as Errors
To build with -Werror (recommended before submitting a PR):
make clean && make WERROR=1 -j$(nproc)
Pull Request Process
- Ensure you have added tests for any new functionality.
- Ensure all existing tests pass.
- Update the documentation (Markdown files in
docs/orREADME.md) if appropriate. - Describe your changes clearly in the PR description. Link to any related issues.
Thank you for your contribution!