xod

Crates.ioxod
lib.rsxod
version1.0.1
created_at2025-06-05 03:16:45.124129+00
updated_at2025-07-07 20:10:51.226639+00
descriptionA tiny REPL for bitwise arithmetic and expression evaluation.
homepage
repositoryhttps://github.com/annie444/xod
max_upload_size
id1701040
size265,776
Analetta "Annie" Ehler (annie444)

documentation

https://github.com/annie444/xod

README

Xod đź§®

Crates.io CI

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(), and history().

đź§  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 message
  • history() – Show input history
  • clear() – Clear the screen
  • quit() – 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.

Commit count: 20

cargo fmt