2 stable releases
Uses new Rust 2024
| 1.0.1 | Jul 7, 2025 |
|---|---|
| 1.0.0 | Jun 5, 2025 |
#684 in Math
87 downloads per month
200KB
5.5K
SLoC
Xod 🧮
A tiny REPL for bitwise arithmetic and expression evaluation.
Xod is a minimal scripting language and interactive REPL designed for experimenting with bitwise logic and integer math. Think of it as a scratchpad for systems engineers, embedded developers, and anyone who needs to test bitwise operations in a focused, rule-consistent environment.
✨ Features
- Evaluate bitwise and arithmetic expressions interactively.
- Integer-only logic with no floating point or negative values.
- Support for basic list manipulation and iteration.
- Familiar control flow with if, while, and for blocks.
- Hex, octal, binary, and decimal formatting.
- Simple built-in commands like
help(),clear(), andhistory().
🧠 Language Overview
Xod supports:
- Operators:
&,|,^,~,<<,>>,+,-,*,/,%,** - Booleans:
==,!=,<,<=,>,>= - List Methods:
append,prepend,front,back,index - Builtin Commands:
hex(),bin(),log(base,value),range(start, end), etc. - Control Flow:
for(x in range(1, 5)) { bin(x) }
if(3 & 1) { hex(3) }
while(x < 8) { x = x + 1 }
🛑 Floating point values and negative integers are not supported.
❗️Operator Precedence
To avoid ambiguity in bitwise expressions, parentheses are required to define precedence. For example:
(a & b) | c // ✅ Clear
a & b | c // ❌ Error: ambiguous expression
🧪 Usage
Launch the REPL:
xod
Then type any expression:
>> 3 & 6
2
>> hex(255)
0xff
>> for(x in range(0, 4)) { bin(x) }
0b0
0b1
0b10
0b11
🧰 Basic commands
help()– Show help messagehistory()– Show input historyclear()– Clear the screenquit()– Exit the REPL
📦 Installation
Coming soon! For now, clone the repo and run it directly:
cargo install xod
🛠 Contributing
Contributions, feedback, and bitwise rants are welcome! Feel free to open an issue or PR. If you’re interested in improving the parser, extending list functionality, or adding file I/O support—let’s chat.
Dependencies
~14–26MB
~332K SLoC