Datasets:
File size: 4,170 Bytes
2f69cde | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 | ---
language:
- en
license: apache-2.0
tags:
- sovereign
- snapkitty
- programming-language
- deterministic
- ledger
- cryptography
- sha256
- mumps
- ibm-i
- worm-sealed
- zero-dependencies
- pure-python
- formal-verification
task_categories:
- text-generation
size_categories:
- n<1K
pretty_name: MANTRA — Deterministic Auditable Language
---
# MANTRA
**A deterministic, auditable programming language for ledger operations, cryptographic sealing, and verified integer computation.**
Zero external dependencies. Pure Python. Auditable SHA-256. MUMPS gateway.
SnapKitty West / SNAPKITTYWEST — *Evidence or Silence — 2026*
---
## What It Is
MANTRA is a purpose-built language for sovereign ledger operations. Every computation is deterministic and traceable. Every output can be cryptographically sealed. No external dependencies — the SHA-256 implementation is pure Python and auditable line by line.
```
# Constants and variables
const GENESIS = "0000000000000000000000000000000000000000000000000000000000000000"
let amount = 450000
# Annotated deterministic function
@deterministic
define seal(tx)
let h = sha256(tx)
Result::ok(h)
end
# Run
python mantra.py run examples/ledger.m
python mantra.py hash "hello world"
```
---
## Test Status
| Suite | Tests |
|---|---|
| test_sha256 | passing |
| test_integer | passing |
| test_bytes | passing |
| test_evaluator | passing |
| **Total** | **23/23** |
---
## Architecture
```
mantra/
├── mantra.py CLI (run / eval / hash / test)
├── lexer/lexer.py Tokenizer (HEX, BYTES, annotations, keywords)
├── mantra_ast/nodes.py AST dataclasses
├── parser/parser.py Pratt parser + field access + dict literals
├── runtime/
│ ├── types.py Integer, Boolean, Bytes, String, DictValue, Option, Result
│ ├── evaluator.py Tree-walking evaluator with closures + builtins
│ ├── runtime.py run_source / run_file
│ └── stdlib/
│ ├── integer.py add/sub/mul/div/mod/pow with overflow checking
│ ├── bit.py band/bor/bxor/bnot/shl/shr/rotl/rotr
│ ├── bytes.py concat/slice/len/get_byte
│ ├── string.py to_bytes/from_bytes/concat
│ ├── hex.py bytes_to_hex/hex_to_bytes
│ ├── sha256.py sha256/sha256_hex (wraps auditable impl)
│ ├── collections.py list_len/list_get/dict_get
│ ├── result.py ok/err/some/none
│ └── testing.py assert_eq/assert_true/assert_false
├── sha256/
│ ├── sha256_impl.py Pure-Python SHA-256 (no hashlib, fully auditable)
│ └── vectors.py NIST canonical test vectors
├── gateway/
│ └── mumps_gateway.py 300-byte binary record pack/unpack/dispatch (IBM i bridge)
└── examples/
├── ledger.m Transaction seal (end-to-end working)
└── treasury.m Multi-step ledger chain
```
---
## Key Properties
| Property | Detail |
|---|---|
| Deterministic | Same inputs always produce same outputs |
| Auditable SHA-256 | Pure Python, no hashlib, every round visible |
| Zero dependencies | Nothing to install beyond Python 3.10+ |
| MUMPS gateway | 300-byte binary record bridge to IBM i |
| Fail-closed types | Option and Result — no silent nulls |
| Overflow checking | Integer arithmetic bounds-checked |
---
## License
Trilicensed: Apache-2.0 / MIT / Sovereign-Source-1.0 (see `LICENSES/`)
---
## Related Repos
| Repo | Description |
|---|---|
| [SNAPKITTYWEST/sov](https://huggingface.co/datasets/SNAPKITTYWEST/sov) | Sovereign Package Switchboard |
| [SNAPKITTYWEST/devflow-finance-twin](https://huggingface.co/datasets/SNAPKITTYWEST/devflow-finance-twin) | IBM i BaaS ledger stack |
| [SNAPKITTYWEST/sovereign-training-corpus](https://huggingface.co/datasets/SNAPKITTYWEST/sovereign-training-corpus) | Training corpus |
| [GitHub](https://github.com/SNAPKITTYWEST/mantra) | Source repository |
|