Introduction to Djazair
Djazair is a modern, expressive, lightweight scripting language inspired by the vibrant spirit of North Africa. Built from the ground up in ANSI C, it seamlessly combines the intuitive elegance of high-level dynamic languages with the raw performance and low memory footprint of a compact bytecode virtual machine.
Djazair was engineered to solve a common dilemma: developers shouldn't have to choose between developer happiness and execution efficiency. It offers first-class functions, closures, class-based object-oriented programming, pattern matching, native Unicode support, and a complete 20-module standard library—all inside an engine that embeds into any C or C++ application in less than 20 lines of code.
Core Architectural Philosophy
- Clean, Readable Syntax: No cryptic semicolons or braces cluttering your logic. Blocks use familiar, expressive keywords like
fn ... end,class ... end, andif ... end. - Bytecode Virtual Machine (VM): Single-pass compilation from source code directly into optimized bytecode instructions, executed by an efficient stack-based C virtual machine.
- Exact Garbage Collection: Automatic memory management with mark-and-sweep garbage collection, ensuring developers never have to worry about manual memory leaks.
- Uncompromising Unicode UTF-8: Variables, function identifiers, strings, and looping constructs treat multi-byte UTF-8 sequences (including Arabic characters and emojis) as first-class citizens.
- Actor-Model Concurrency: True parallel execution using native OS threads with actor-style message passing, isolating state and preventing race conditions without complex mutex locking.
Djazair at a Glance
Here is a snippet showcasing variable declarations, first-class functions, string interpolation, and collection operations:
# A quick taste of Djazair
fn createMultiplier(factor)
return fn(number) => number * factor
end
let double = createMultiplier(2)
let numbers = [1, 2, 3, 4, 5]
# Functional transformation with map and filter
let doubledOdds = numbers
.filter(fn(n) => n % 2 != 0)
.map(double)
print("Doubled odd numbers: ${doubledOdds}")
# => Doubled odd numbers: [2, 6, 10]
Feature Summary
| Capability | Specification | Highlights |
|---|---|---|
| Typing System | Dynamic with strong runtime contracts | Int, Float, String, Bool, Null, Array, Map, Function, Range, Class |
| Unicode | First-Class 100% UTF-8 | Arabic identifiers (e.g. let السرعة = 100), logical code-point indexing |
| Functions | First-Class Citizens & Closures | Default arguments, rest parameters (...args), arrow expressions (=>) |
| Object-Oriented | Class-based with Single Inheritance | class ... is ..., super, self, new, instanceof |
| Concurrency | Actor Model / Worker Threads | Worker threads with send(), receive(), and structured JSON messaging |
| Standard Library | 20 Built-in Standard Modules | http, net, json, crypto, regex, datetime, file, dir, process, thread, etc. |
| Embeddable | Pure C Header (djazair.h) |
Zero external hard runtime dependencies; embeds anywhere in seconds |