Thank you for your interest in contributing to the Ora programming language and compiler! This guide will help you get started.
Run our setup script to install all dependencies automatically:
./setup.shThis script will:
- ✅ Check for Zig 0.15.x
- ✅ Install system dependencies (CMake, Boost, OpenSSL, Clang)
- ✅ Initialize Git submodules (vendor/solidity)
- ✅ Build the compiler
- ✅ Run tests
If you prefer to set up manually or the script doesn't work for your platform:
Download and install Zig 0.15.x from ziglang.org/download.
macOS:
brew install zigLinux (Ubuntu/Debian):
snap install zig --classic --betaVerify installation:
zig version # Should be 0.14.1 or highermacOS:
brew update
brew install cmake boost opensslLinux (Ubuntu/Debian):
sudo apt-get update
sudo apt-get install -y \
build-essential \
cmake \
clang \
libc++-dev \
libc++abi-dev \
libboost-all-dev \
libssl-dev \
pkg-config \
gitWindows:
# Using Chocolatey
choco install cmake openssl boost-msvc-14.3
# Or using vcpkg
vcpkg install boost:x64-windows openssl:x64-windows# Clone the repository
git clone https://github.com/oralang/ora.git
cd ora
# Initialize submodules
git submodule update --init --depth=1 vendor/solidity
# Build the compiler
zig build
# Run tests
zig build testThe first build may take 10-30 minutes as it compiles the MLIR and Solidity libraries.
# Standard build
zig build
# Release build (optimized)
zig build -Doptimize=ReleaseFast
# Clean build
rm -rf .zig-cache zig-out
zig build# Run all tests
zig build test
# Run compiler on an example
./zig-out/bin/ora compile ora-example/smoke.ora
# Test end-to-end compilation
./zig-out/bin/ora compile ora-example/basic_storage.ora
./zig-out/bin/ora --emit-yul ora-example/basic_storage.ora# Format code
zig fmt src/
# Check formatting
zig fmt --check src/
# Check for compile errors
zig buildOra/
├── src/ # Compiler source code
│ ├── ast/ # Abstract Syntax Tree definitions
│ ├── parser/ # Lexer and parser
│ ├── semantics/ # Semantic analysis
│ ├── mlir/ # MLIR lowering
│ ├── lexer.zig # Lexer implementation
│ ├── main.zig # CLI entry point
│ └── root.zig # Library root
├── tests/ # Unit and integration tests
│ └── compiler_e2e_test.zig # End-to-end tests
├── ora-example/ # Example Ora programs
├── vendor/ # External dependencies
│ ├── solidity/ # Solidity Yul compiler (submodule)
│ ├── mlir/ # Pre-built MLIR libraries
│ └── llvm-project/ # LLVM/MLIR source (build artifact)
├── docs/ # Technical documentation
├── build.zig # Build configuration
└── README.md # Project overview
Perfect for newcomers to the project:
🐛 Bug Fixes
- Fix parser error messages (see issues tagged
good-first-issue) - Handle edge cases in lexer
- Improve error recovery
📝 Documentation
- Add more examples to
ora-example/ - Improve code comments
- Write tutorial guides
- Fix typos and clarify explanations
✅ Testing
- Add test cases to
tests/fixtures/ - Test edge cases in type checker
- Validate example programs
- Write integration tests
🔍 Error Messages
- Make parser errors more descriptive
- Add source location context
- Suggest fixes in error messages
- Improve warning messages
For contributors familiar with compilers:
🔧 Parser Improvements
- Implement missing language features
- Improve error recovery
- Add syntax sugar
- Optimize parsing performance
🧮 Type Checker Enhancements
- Improve type inference
- Add type narrowing
- Better error union handling
- Region transition validation
🎯 Optimization Passes
- Dead code elimination
- Constant folding
- Loop optimizations
- MLIR pass improvements
For experienced compiler developers:
💾 Code Generation
- Complete Yul backend
- EVM bytecode generation
- Optimization passes
- Target-specific improvements
🔬 Formal Verification
- Implement
requires/ensureschecking - SMT solver integration
- Proof generation
- Verification examples
🛠️ Tooling
- LSP (Language Server Protocol)
- Debugger
- Formatter
- IDE integration
- Follow standard Zig formatting (use
zig fmt) - Use descriptive variable names
- Add comments for non-obvious logic
- Keep functions focused and small
- Always free allocated memory
- Use
deferfor cleanup - Prefer arena allocators for AST construction
- Use the testing allocator in tests to catch leaks
- Return errors, don't panic
- Provide helpful error messages with source locations
- Use the
ErrorHandlerfor compiler diagnostics
- Add tests for new features
- Write both positive and negative test cases
- Keep tests simple and focused
- Use descriptive test names
Example test:
test "lexer scans keywords" {
const allocator = testing.allocator;
const source = "contract fn pub storage";
const Lexer = @import("ora").Lexer;
var lexer = Lexer.init(allocator, source);
defer lexer.deinit();
const tokens = try lexer.scanTokens();
defer allocator.free(tokens);
try testing.expect(tokens.len >= 5);
}- ✅ Code compiles:
zig build - ✅ Tests pass:
zig build test - ✅ Code is formatted:
zig fmt src/ - ✅ No compiler warnings
- Fork the repository
- Create a branch for your feature:
git checkout -b feature/my-feature - Make your changes with clear, focused commits
- Test thoroughly
- Push to your fork:
git push origin feature/my-feature - Open a Pull Request with:
- Clear description of what changed
- Why the change is needed
- Any related issues
Use clear, descriptive commit messages:
✅ Good:
- "Add support for nested struct literals"
- "Fix: Prevent panic in parser for empty input"
- "Optimize: Cache type resolution results"
❌ Bad:
- "fix stuff"
- "wip"
- "update code"
-
Browse Issues: Check GitHub Issues
- Filter by
good-first-issuelabel - Filter by
help-wantedlabel - Look for
documentationtasks
- Filter by
-
Comment on Issue: Express interest and ask questions
- "I'd like to work on this. Any pointers?"
- Maintainers will guide you
-
Start Small: Don't try to fix everything at once
- One feature or bug fix per PR
- Get feedback early and often
Start Here:
- Read
README.md- project overview - Try
./zig-out/bin/ora parse ora-example/smoke.ora - Read
GRAMMAR.bnf- language syntax - Explore
src/structure - Run tests:
zig build test
Key Files:
src/lexer.zig- Tokenizationsrc/parser/- Syntax parsingsrc/ast/- Abstract syntax treesrc/semantics/- Type checking and validationsrc/mlir/- MLIR lowering
Common Tasks:
Adding a test case:
# 1. Create test file
echo 'contract Test { storage var x: u256; }' > tests/fixtures/semantics/valid/my_test.ora
# 2. Run tests
zig build test
# 3. Verify parsing
./zig-out/bin/ora parse tests/fixtures/semantics/valid/my_test.oraAdding an example:
# 1. Create example
cat > ora-example/my_feature.ora << 'EOF'
contract Example {
// Your example code
}
EOF
# 2. Validate
./zig-out/bin/ora parse ora-example/my_feature.ora
# 3. Run validation suite
./scripts/validate-examples.shImproving error messages:
# 1. Find error site (grep for error text)
grep -r "Expected token" src/
# 2. Improve message
# 3. Test with invalid input
./zig-out/bin/ora parse tests/fixtures/parser/invalid/bad_syntax.ora
# 4. Run test suite
zig build test- 💬 Questions: GitHub Discussions
- 🐛 Bug Reports: GitHub Issues
- 📖 Documentation: See
docs/folder - 📚 Guides: Check
docs/DOCUMENTATION_GUIDE.mdfor maintaining docs
For rapid development, build just the part you're working on:
# Build only the lexer
zig build-lib src/lexer.zig
# Build only the parser
zig build-lib src/parser.zigUse Zig's built-in debugging:
const std = @import("std");
// Print debug info
std.debug.print("Value: {}\n", .{value});
// Assert conditions
std.debug.assert(value > 0);To work on MLIR lowering:
# Generate MLIR output
./zig-out/bin/ora --emit-mlir contract.ora
# Validate MLIR
./validate_mlir.sh contract.ora# Build with release optimizations
zig build -Doptimize=ReleaseFast
# Profile compilation time
time ./zig-out/bin/ora compile large_contract.ora- Be respectful and constructive
- Welcome newcomers
- Focus on the code, not the person
- Assume good intentions
By contributing to Ora, you agree that your contributions will be licensed under the same license as the project (see LICENSE file).
Thank you for contributing to Ora! 🎉