|
| 1 | +# Contributing to kvlang |
| 2 | + |
| 3 | +Thanks for your interest! Here's how to get started. |
| 4 | + |
| 5 | +## Setup |
| 6 | + |
| 7 | +```bash |
| 8 | +git clone https://github.com/array2d/kvlang.git |
| 9 | +cd kvlang |
| 10 | +make build |
| 11 | +``` |
| 12 | + |
| 13 | +**Prerequisites**: Go 1.24+, Redis (for integration tests). |
| 14 | + |
| 15 | +## Development workflow |
| 16 | + |
| 17 | +```bash |
| 18 | +# After making changes: |
| 19 | +make vet # static analysis |
| 20 | +make test # unit tests |
| 21 | +python3 example/run.py # integration tests (requires Redis) |
| 22 | +``` |
| 23 | + |
| 24 | +## Project structure |
| 25 | + |
| 26 | +``` |
| 27 | +cmd/kvlang/ CLI entry point |
| 28 | +internal/ |
| 29 | + parser/ .kv source → AST |
| 30 | + lower/ control flow lowering (if/while → block + branch) |
| 31 | + layoutcode/ AST → KV path tree (opcodes at /vthread/*) |
| 32 | + vthread/ virtual thread lifecycle |
| 33 | + kvcpu/ 128-worker goroutine scheduler |
| 34 | + kvspace/ KV storage abstraction (Redis backend) |
| 35 | + vtype/ typed value system (int, float, bool, str, tensor) |
| 36 | + op/ |
| 37 | + builtin/ native operators (arith, compare, logic, cast, call, io) |
| 38 | + dispatch/ opcode → executor routing |
| 39 | + device/ I/O device drivers (terminal, websocket) |
| 40 | +example/ .kv example programs + integration test runner |
| 41 | +doc/ design documents, specs, drafts |
| 42 | +``` |
| 43 | + |
| 44 | +## Key concepts |
| 45 | + |
| 46 | +- **KV path addressing**: code and data share one tree. Instructions are paths. Call = subtree copy. |
| 47 | +- **vthread**: lightweight execution context. State stored as KV paths under `/vthread/<vtid>/`. |
| 48 | +- **typed values**: `kvspace.Value{kind, raw}` — kind maps directly to `vtype.VType.Name()`. |
| 49 | + |
| 50 | +## Commit conventions |
| 51 | + |
| 52 | +- `feat:` new feature |
| 53 | +- `fix:` bug fix |
| 54 | +- `refactor:` code restructuring |
| 55 | +- `docs:` documentation |
| 56 | +- `test:` test additions |
| 57 | + |
| 58 | +## Questions? |
| 59 | + |
| 60 | +Open an issue or start a discussion. |
0 commit comments