A high-performance, dynamically-typed programming language
Quick Start • Features • Examples • Modules • Building • Language Reference • Module Reference • Architecture
git clone https://github.com/shayanheidari01/DariX.git
cd DariX/cpp-src
cmake -S . -B build
cmake --build build# Run a script
./build/darix run script.dax
# Interactive REPL
./build/darix repl
# Evaluate expression
./build/darix eval "print(1 + 2)"Create hello.dax:
print("Hello, World!")
darix run hello.dax
# Output: Hello, World!| Feature | Status |
|---|---|
| Dynamic typing | ✅ |
| Variables & assignment | ✅ |
| Arithmetic operators | ✅ |
| String operations | ✅ |
| Conditionals (if/elif/else) | ✅ |
| While loops | ✅ |
| For loops | ✅ |
| Functions & recursion | ✅ |
| Lambda expressions | ✅ |
| Closures | ✅ |
| Classes & OOP | ✅ |
| Decorators | ✅ |
| Exception handling | ✅ |
| Import system | ✅ |
| Comments (// and /* */) | ✅ |
| Short-circuit evaluation | ✅ |
| Module | Functions | Description |
|---|---|---|
math |
27 | Mathematical functions |
string |
37 | String manipulation |
array |
28 | Array operations |
map |
22 | Map operations |
set |
27 | Set operations |
queue |
25 | FIFO queue |
stack |
28 | LIFO stack |
linkedlist |
38 | Linked list operations |
tree |
22 | Tree operations |
graph |
22 | Graph operations |
json |
3 | JSON parsing/serialization |
fs |
32 | File system operations |
net |
33 | Networking (TCP/UDP/HTTP/WebSocket/DNS) |
crypto |
14 | Cryptographic functions |
datetime |
30 | Date and time operations |
random |
16 | Random number generation |
regex |
13 | Regular expressions |
io |
20 | Input/output operations |
os |
37 | Operating system interface |
encoding |
17 | Encoding/decoding |
xml |
21 | XML parsing and generation |
yaml |
12 | YAML parsing and generation |
toml |
11 | TOML configuration parsing |
csv |
15 | CSV parsing and processing |
sqlite |
17 | SQLite database operations |
log |
19 | Structured logging |
thread |
20 | Threading and concurrency |
compress |
12 | Compression and checksums |
requests |
12 | HTTP client (requests-style API) |
httpserver |
13 | HTTP server framework |
package |
12 | Package manager (GitHub) |
| Total | 627 |
- Lexer: Single-pass scanner with position tracking
- Parser: Pratt (top-down operator precedence) parser
- Compiler: AST-to-bytecode with constant folding and peephole optimization
- VM: Stack-based virtual machine with 30 opcodes
- Interpreter: Tree-walking fallback for full feature support
- JIT: Hot-path optimization (threshold: 100 executions)
var x = 42
var y = 3.14
var name = "DariX"
print(x + y) // 45.14
print(x * 2) // 84
var score = 85
if (score >= 90) {
print("A")
} elif (score >= 80) {
print("B")
} else {
print("C")
}
for (var i = 0; i < 5; i = i + 1) {
print(i)
}
func factorial(n) {
if (n <= 1) {
return 1
}
return n * factorial(n - 1)
}
print(factorial(5)) // 120
var double = lambda x: x * 2
print(double(21)) // 42
class Animal {
var name = ""
func __init__(name) { self.name = name }
func speak() { return self.name + " speaks" }
}
var cat = Animal("Cat")
print(cat.speak()) // Cat speaks
// Arrays
import array
var arr = [1, 2, 3, 4, 5]
print(array.filter(arr, lambda x: x > 3)) // [4, 5]
print(array.map(arr, lambda x: x * 10)) // [10, 20, 30, 40, 50]
// Maps
var m = {"name": "DariX", "version": 1}
print(m["name"]) // DariX
// Sets
import set
var s = set.from_array([1, 2, 2, 3])
print(s) // [1, 2, 3]
try {
var result = 10 / 0
} catch (ZeroDivisionError e) {
print("Error:", e)
} finally {
print("cleanup")
}
import fs
import json
// Write JSON
var data = {"name": "Alice", "scores": [95, 87, 92]}
fs.write("data.json", json.stringify(data, 2))
// Read and parse
var content = fs.read("data.json")
var parsed = json.parse(content)
print(parsed["name"]) // Alice
import net
import json
var resp = net.http_get("http://httpbin.org/get")
print(resp["status"]) // 200
var data = json.parse(resp["body"])
import math
print(math.sqrt(16)) // 4
print(math.pi()) // 3.14159
print(math.sin(math.pi()/2)) // 1
DariX/
├── cpp-src/ # C++ implementation
│ ├── CMakeLists.txt
│ ├── include/darix/ # Headers
│ │ ├── ast.hpp
│ │ ├── code.hpp
│ │ ├── compiler.hpp
│ │ ├── interpreter.hpp
│ │ ├── lexer.hpp
│ │ ├── object.hpp
│ │ ├── parser.hpp
│ │ ├── token.hpp
│ │ ├── vm.hpp
│ │ └── native/ # Native module headers
│ └── src/ # Source files
│ ├── main.cpp
│ └── native/ # Native module implementations
├── examples/ # Example scripts
├── tests/ # Test scripts
├── benchmarks/ # Performance benchmarks
├── docs/ # Documentation
│ ├── language.md
│ ├── modules.md
│ ├── building.md
│ ├── cli.md
│ ├── architecture.md
│ └── tutorial.md
└── README.md
- Language Reference — Complete language syntax
- Module Reference — All 21 native modules
- Build Guide — Build instructions for all platforms
- CLI Reference — Command-line interface
- Architecture — Internal design and structure
- Tutorial — Step-by-step learning guide
- C++17 compiler (GCC 7+, Clang 5+, MSVC 2017+)
- CMake 3.16+
cd cpp-src
cmake -S . -B build
cmake --build build| Platform | Compiler | Status |
|---|---|---|
| Windows (MSYS2) | MinGW GCC | ✅ |
| Windows (VS) | MSVC 2017+ | ✅ |
| Linux | GCC/Clang | ✅ |
| macOS | Clang | ✅ |
See Build Guide for detailed instructions.
Language features: 133 passed
Math module: 27 passed
String module: 37 passed
Array module: 28 passed
Map module: 22 passed
Set module: 27 passed
Queue module: 25 passed
Stack module: 28 passed
Linked List: 38 passed
Tree module: 22 passed
Graph module: 22 passed
JSON module: 28 passed
Filesystem: 22 passed
Network: 9 passed
Crypto module: 14 passed
DateTime: 30 passed
Random: 16 passed
Regex: 13 passed
IO module: 20 passed
OS module: 15 passed
Encoding: 17 passed
─────────────────────────────
TOTAL: 593 passed
Apache License 2.0 - see LICENSE for details.
Built with ❤️ by shayanheidari01
