About Dryft
Dryft is an experimental programming language featuring:- Stack-based concatenative programming - Programs compose functions that transform a data stack
- Pure and impure function distinction - Explicit separation between functions (pure) and actions (impure)
- Linear types - Stack-based resource management with linear type tracking
- Optional type inference - Full type inference with optional annotations
- Simple extensible syntax - Minimal keywords with clear semantics
Project Structure
The Dryft compiler is written in Rust and organized as follows:Development Setup
Install Rust
Dryft requires Rust 2021 edition or later. Install via rustup:
Ways to Contribute
1. Add Language Features
New language features typically require changes to:src/frontend.rs- Add token handling inhandle_token()src/backends.rs- Add method to theBackendtrait- Each backend - Implement the new method
src/state.rs- Add types or state if needed
- Structs and composite types
- Module system improvements
- Pattern matching
- More control flow constructs
- Compile-time evaluation
2. Create a New Backend
See the Backend System guide for detailed instructions on adding backends. Good candidates:- LLVM IR - Unlock powerful optimizations
- WebAssembly - Run Dryft in browsers
- ARM assembly - Target embedded systems
- JVM bytecode - Integrate with Java ecosystem
- Other languages - Python, JavaScript, Go, etc.
3. Improve Existing Backends
The x86 backend (src/backends/x86/mod.rs) is incomplete - many functions use todo!() placeholders:
- Variables (create, read, write)
- Control flow (loops, conditionals)
- Comparisons and logic operations
- String support
- Better stack management
- Inline small functions
- Optimize away unnecessary push/pop sequences
4. Standard Library
The standard library lives innative/stdc/ and provides FFI to C functions. Contributions needed:
- File I/O operations
- Network sockets
- String manipulation
- Data structures (lists, maps, etc.)
- Math functions
- System calls
5. Tooling
- Syntax highlighting - VSCode, Vim, Emacs, etc.
- LSP server - IDE integration
- Formatter - Code formatting tool
- Debugger - Interactive debugging support
- Package manager - Dependency management
- REPL - Interactive interpreter
6. Documentation
- Tutorial for beginners
- Language reference
- Standard library documentation
- Example programs
- Video tutorials
- Blog posts about Dryft
7. Testing
- Write test programs in
.dry - Add unit tests for compiler components
- Integration tests for build pipeline
- Fuzzing for compiler robustness
- Benchmark suite for performance tracking
Contribution Workflow
Create an issue
Before starting work, create an issue describing:
- What you want to add/fix
- Why it’s useful
- Your proposed approach
Make your changes
- Follow existing code style
- Add tests for new features
- Update documentation as needed
- Keep commits focused and atomic
Open a pull request
- Go to GitHub and create a pull request
- Reference the related issue
- Describe what changed and why
- Add screenshots/examples if applicable
- Request review from maintainers
Code Style Guidelines
Rust Code
- Follow standard Rust style (
cargo fmt) - Use meaningful variable names
- Add comments for complex logic
- Prefer explicit types in public APIs
- Keep functions focused and small
- Use Rust idioms (iterators,
?operator, etc.)
Dryft Code
- Use descriptive function names
- Separate functions and actions clearly
- Add comments explaining stack effects:
# ( in -- out ) - Keep functions small and composable
- Use proper indentation for nested blocks
Documentation
- Write clear, concise explanations
- Include code examples
- Link to related sections
- Keep language simple and accessible
Backend Development Guidelines
When implementing a backend:- Start simple - Get basic arithmetic and functions working first
- Study C99 backend - It’s the reference implementation
- Use
todo!()- For unimplemented features, don’t leave stubs empty - Test incrementally - Test each feature as you implement it
- Document limitations - Be clear about what’s not supported yet
- Add build profile - Create a TOML file in
src/targets/
Compiler Architecture Notes
- Single-pass compilation - Tokens are processed immediately, no AST
- Stack-based - The compiler tracks stack state and types
- Type checking - Each operation validates input types and pushes output types
- Definition stack - Tracks nested contexts (function, loop, conditional, etc.)
- Backend abstraction - Frontend is backend-agnostic
Testing Guidelines
Unit Tests
Add tests in the relevant.rs file:
Integration Tests
Create.dry test programs in tests/ directory and add test runners.
Test Coverage
Aim to test:- Happy path (normal usage)
- Edge cases (empty input, boundary values)
- Error cases (invalid syntax, type errors)
- Interactions (how features work together)
Communication
- GitHub Issues - Bug reports, feature requests, questions
- Pull Requests - Code review and discussion
- Discussions - General questions and ideas
License
Dryft is licensed under the GNU General Public License v3.0. By contributing, you agree that your contributions will be licensed under the same terms. All source files should include the GPL header:Getting Help
If you need help:- Check existing documentation and issues
- Look at similar code in the codebase
- Ask in GitHub Discussions
- Open an issue with your question
Code of Conduct
Be respectful, constructive, and professional. We’re all here to learn and build something cool together.Recognition
Contributors will be recognized in:- Release notes
- Contributors list
- Project documentation