|
| 1 | +# Contributing to Brainrot |
| 2 | + |
| 3 | +Welcome to Brainrot! We're excited that you want to contribute. This document provides guidelines and information for contributing to the project. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +By participating in this project, you are expected to uphold our Code of Conduct (follows standard open source practices). |
| 8 | + |
| 9 | +## Getting Started |
| 10 | + |
| 11 | +1. Fork the repository |
| 12 | +2. Clone your fork: `git clone https://github.com/yourusername/Brainrot.git` |
| 13 | +3. Create a branch for your changes: `git checkout -b feature/your-feature-name` |
| 14 | + |
| 15 | +## Development Environment |
| 16 | + |
| 17 | +### Prerequisites |
| 18 | + |
| 19 | +- C compiler (gcc recommended) |
| 20 | +- Flex and Bison |
| 21 | +- Make |
| 22 | + |
| 23 | +### Building the Project |
| 24 | + |
| 25 | +```bash |
| 26 | +make clean |
| 27 | +make |
| 28 | +``` |
| 29 | + |
| 30 | +### Running Tests |
| 31 | + |
| 32 | +The test suite can be run using: |
| 33 | + |
| 34 | +```bash |
| 35 | +make test |
| 36 | +``` |
| 37 | + |
| 38 | +## Project Structure |
| 39 | + |
| 40 | +- `ast.h` / `ast.c`: Abstract Syntax Tree implementation |
| 41 | +- `lang.y`: Bison grammar file |
| 42 | +- `lang.l`: Flex lexer file |
| 43 | +- `examples/`: Example Brainrot programs |
| 44 | +- `tests/`: Test suite |
| 45 | + |
| 46 | +## Adding New Features |
| 47 | + |
| 48 | +1. First, check existing issues and PRs to avoid duplicate work |
| 49 | +2. Create an issue discussing the feature before implementing |
| 50 | +3. Follow the existing code style |
| 51 | +4. Add appropriate tests in `tests/` |
| 52 | +5. Add example usage in `examples/` |
| 53 | + |
| 54 | +## Testing Guidelines |
| 55 | + |
| 56 | +1. All new features must include tests |
| 57 | +2. Test files go in `tests/` |
| 58 | +3. Expected outputs should be added to `expected_results.json` |
| 59 | +4. Tests should cover: |
| 60 | + - Happy path |
| 61 | + - Error conditions |
| 62 | + - Edge cases |
| 63 | + |
| 64 | +## Pull Request Process |
| 65 | + |
| 66 | +1. Update documentation as needed |
| 67 | +2. Add or update tests |
| 68 | +3. Ensure all tests pass |
| 69 | +4. Update CHANGELOG.md if applicable |
| 70 | +5. Reference any related issues |
| 71 | + |
| 72 | +Example PR format: |
| 73 | + |
| 74 | +```markdown |
| 75 | +## Description |
| 76 | + |
| 77 | +Brief description of changes |
| 78 | + |
| 79 | +## Related Issue |
| 80 | + |
| 81 | +Fixes #<issue_number> |
| 82 | + |
| 83 | +## Type of Change |
| 84 | + |
| 85 | +- [ ] Bug fix |
| 86 | +- [ ] New feature |
| 87 | +- [ ] Documentation update |
| 88 | +- [ ] Performance improvement |
| 89 | +``` |
| 90 | + |
| 91 | +## Style Guide |
| 92 | + |
| 93 | +### C Code Style |
| 94 | + |
| 95 | +- Use 4 spaces for indentation |
| 96 | +- Maximum line length of 80 characters |
| 97 | +- Function names use snake_case |
| 98 | +- Constants use UPPER_SNAKE_CASE |
| 99 | +- Add comments for complex logic |
| 100 | +- Include parameter documentation for functions |
| 101 | + |
| 102 | +### Grammar Style |
| 103 | + |
| 104 | +- Token names should be descriptive |
| 105 | +- Use consistent naming patterns for similar concepts |
| 106 | +- Document grammar rules with examples |
| 107 | + |
| 108 | +## Documentation |
| 109 | + |
| 110 | +- Keep README.md updated with new features |
| 111 | +- Document all public functions |
| 112 | +- Include examples for new features |
| 113 | +- Use clear, concise language |
| 114 | + |
| 115 | +## Bug Reports |
| 116 | + |
| 117 | +When filing a bug report, include: |
| 118 | + |
| 119 | +1. Brainrot version |
| 120 | +2. Operating system |
| 121 | +3. Complete error message |
| 122 | +4. Minimal reproduction code |
| 123 | +5. Expected vs actual behavior |
| 124 | + |
| 125 | +## Getting Help |
| 126 | + |
| 127 | +If you need help, you can: |
| 128 | + |
| 129 | +1. Check existing issues |
| 130 | +2. Create a new issue with your question |
| 131 | +3. Add [HELP WANTED] tag for implementation assistance |
| 132 | + |
| 133 | +## License |
| 134 | + |
| 135 | +By contributing, you agree that your contributions will be licensed under the same terms as the main project. |
| 136 | + |
| 137 | +## Acknowledgments |
| 138 | + |
| 139 | +Thank you to all contributors who help make Brainrot better! |
0 commit comments