Swalang
The elegant, Python-compatible language engine with native C FFI, async I/O, and Swahili localized dictionary support.
1 import http
2 import time
3
4 app = http.Server(port=5000)
5
6 @app.route("/")
7 def index(req):
8 sasa = time.time()
9 return f"<h1>Habari, Dunia!</h1><p>Muda wa Server: {sasa}</p>"
10
11 @app.route("/api/v1")
12 def habari_api(req):
13 return {
14 "lugha": "Swalang",
15 "mchezo": "active",
16 "injini": "Go Interpreter"
17 }
18
19 app.run()
Try Swalang
Experiment with Swalang code directly in your browser with our interactive tutorial.
Start CodingUpcoming Events
- SwaConf 2024 - Virtual Event
- Webinar: Async Swalang Patterns
Use Swalang for...
Built with an emphasis on low overhead, cross-platform portability, and powerful extension interfaces.
Concurrent Web APIs
Create highly concurrent, responsive microservices and low-latency WebSocket endpoints using Swalang's event-driven HTTP server modules.
Direct C FFI Integration
Bypass writing complex glue-code wrappers. Seamlessly map struct alignments and run functions out of any compiled C shared library.
System Scripting & Automation
Manage processes, navigate directories, and script server management tasks efficiently with a clean, pythonic native API.
Embedded DB Engines
Leverage pre-configured database drivers like SQLite natively to store data locally and run relational queries out-of-the-box.
Hardware Accelerated Graphics
Build interactive visual scripts and lightweight desktop games with pre-bundled native cross-platform SDL2 and Nuklear graphics.
Cryptographic Routines
Perform advanced hashing, symmetric AES encryption, and TLS certificate negotiations powered by an isolated MbedTLS FFI driver.
Why Swalang?
Explore the engineering and design choices that make Swalang a reliable, robust, and portable system tool.
Clean Pythonic Design
Uses standard indentation-based structures and Python 3 compatible keywords. Developers can use standard English terms or localized Swahili terminology.
Highly Portable Engine
Written in Go, Swalang produces compact, statically compileable, and cross-platform executables. The entire toolchain can be easily shipped to any host.
Native Extension Pipeline
Bundled with a stable Foreign Function Interface (FFI) engine that leverages Zig. You can cross-compile C extensions to expand runtime capabilities.
The Road Ahead
We are continuously refining Swalang's virtual machine, standard library modules, and developer tooling.
Next 6-12 Months
Short Term
- Grow the localized Swahili terminology vocabulary through active community collaboration.
- Optimize bytecode compilation and parsing performance inside the core Go engine.
- Enhance linting, auto-completion, and diagnostics reporting inside the Swalang LSP server.
1-2 Years
Mid Term
- Implement a first-class WebAssembly (WASM) compiler target to enable running complex routines in the browser.
- Integrate a full, asynchronous cooperative task scheduler directly into the core runtime loop.
- Expand pre-bundled standard library coverage for common network and operating system-level routines.
2+ Years
Long Term
- Build a self-hosting compiler chain written completely in Swalang itself.
- Introduce optional, type-annotated ahead-of-time (AOT) compilation pipelines.
- Develop stable graphical windowing libraries utilizing modern, lightweight UI frameworks.
Swalang Success Stories
"Switching our data pipeline to Swalang increased our processing speed by 200%. The simplicity of the language and the strength of its libraries made the transition seamless."
Discover SwaHub
The official package repository. Find, install, and publish packages to accelerate your development.
swift-fetch
A modern, promise-based HTTP client for Swalang, inspired by fetch.
v1.4.5pixel-magic
An easy-to-use image manipulation library for Swalang.
v0.4.0swalang-charts
Create beautiful and interactive charts and graphs with Swalang.
v1.2.0aether-orm
A modern ORM for Swalang that supports PostgreSQL, MySQL, and SQLite.
v0.8.4Become a Swa Foundation Member
The Swa Foundation is the non-profit organization behind Swalang. Help support our mission to promote, protect, and advance the Swalang language.
Join the Swa Foundation