Zero-dependency embeddable engine with async coroutines, pattern matching, OOP, automatic memory management, and a comprehensive standard library — designed for tooling, automation, game logic, and extending C/C++ applications.
use math
fn greet(name)
return "Hello, ${name}!"
end
let radius = 5
print(greet("Djazair"))
print("Area: ${math.PI * math.pow(radius, 2)}")
# => Hello, Djazair!
# => Area: 78.5398
fn fib(n)
if n <= 1
return n
end
return fib(n - 1) + fib(n - 2)
end
# Calculate first 10 Fibonacci numbers
for i in 0..10
print("fib(${i}) = " + str(fib(i)))
end
use http
use json
async fn fetchIP()
print("Fetching IP data...")
let res = await http.get("http://ip-api.com/json")
return json.parse(res.body)
end
async fn main()
let task = fetchIP()
let data = await task
print("Query IP: " + data["query"])
print("Country: " + data["country"])
end
await main()
# 1. Iterate over a range (0 to 5 inclusive)
for i in 0..5
print("Number: ${i}")
end
# 2. Iterate directly over array elements
let fruits = ["apple", "banana", "cherry"]
for fruit in fruits
print("Fruit: " + fruit)
end
# 3. Iterate over hash keys and values
let person = {"name": "Riad", "age": 30}
for key, value in person
print("${key}: ${value}")
end
fn divide(a, b)
if b == 0
throw "Division by zero error!"
end
return a / b
end
try
let result = divide(10, 0)
print("Result: ${result}")
catch err
print("Caught error: " + str(err))
finally
print("Cleanup: execution complete.")
end
A lightweight, future-ready scripting language with high-performance C integration and a rich feature set.
safeExecute / safeQuery) to prevent SQL injections.See how Djazair handles real-world scenarios across games, desktop apps, web dev, and database integration.
Djazair features an official Object-Oriented wrapper for the popular Raylib engine. Build 2D graphics, handle window drawing loops, configure FPS targets, poll keyboard/mouse inputs, and manage audio devices directly in Djazair.
use raylib as rl
let win = rl.Window(800, 600, "Djazair Raylib Sandbox")
win.setFPS(60)
while win.isOpen()
win.begin()
win.clear(rl.BLACK)
rl.drawCircle(400, 300, 30, rl.PURPLE)
rl.drawText("Press ESC to exit", 10, 10, 20, rl.WHITE)
win.finish()
end
win.close()
use webview
let app = webview.createWindow({
"title": "Djazair Desktop App",
"width": 800,
"height": 600
})
app.onReady(fn()
app.window.setHtml("<h1>Hello from Edge WebView2!</h1>")
end)
app.run()
use sqlite
let db = sqlite.connect("app.db")
if db.isConnected()
db.execute("CREATE TABLE IF NOT EXISTS users (id INT, name TEXT)")
# Safe query execution (prevents SQL injection)
db.safeExecute("INSERT INTO users VALUES (?, ?)", [1, "Riad"])
let res = db.safeQuery("SELECT * FROM users WHERE id = ?", [1])
print(res.fetchAllAssoc())
res.close()
db.close()
end
use http
let server = http.createServer(fn(req, res)
res.send("Hello from Djazair Asynchronous HTTP Server!")
end)
print("Server started at http://127.0.0.1:8080")
server.listen(8080)
Djazair is engineered to be as featherlight as Lua, while providing modern developer comforts.
Official language extensions provide syntax highlighting, code formatting, and smart completions — available for the most popular editors.
Dive into the documentation, explore the standard library, or browse the source on GitHub.