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.
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.
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.
- Follow the existing C style found in the codebase. Consistency is key.
- You can use the provided
.clang-formatfile to format your code. - Keep code clean and readable.
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.
The test suite is your best friend when developing. Please ensure all tests pass before submitting a PR.
To run the full test suite using the default compiler (usually GCC):
make testTo run a single test file to save time during development, you can either run it directly:
./zc run tests/language/control_flow/test_match.zcOr you can run the test suite selectively:
make test only="tests/language/control_flow/test_match.zc"Zen C supports multiple C compilers as backends. You can run tests against them specifically:
Clang:
./tests/run_tests.sh --cc clangZig (cc):
./tests/run_tests.sh --cc zigTCC (Tiny C Compiler):
./tests/run_tests.sh --cc tcc- 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!