SMAL (State Machine Abstraction Language) is a compact, human‑readable YAML DSL for defining fully functional state machines that are:
- Simple — easy to write, easy to read
- Robust — validated, structured, and type‑safe
- Debuggable — designed for real firmware workflows
A .smal file describes your entire state machine — states, events, transitions, commands, messages, and error handling — in a clean, declarative format. From that single source of truth, SMAL can generate:
- C, C++, and Rust firmware code
- A complete SVG state machine diagram
- Debug structures for introspection and tooling
- Human-readable reports for developers and QA
SMAL is built for embedded systems, audio devices, wearables, robotics, and any environment where clarity, determinism, and debuggability matter.
SMAL also ships an interactive REPL CLI (smal) for working with your state machines directly from the terminal — load and validate .smal files, generate code and diagrams on demand, and connect to a live device to send messages and run scripted command sequences against it.
✨ Features
🧩 YAML-based DSL
Define states, events, transitions, actions, etc. in a clean, expressive format.
🔧 Multi-language code generation
Generate firmware-ready code in C. C++ and Rust planned for future release.
🖼️ SVG diagram generation
Produce a polished, auto‑layout state machine diagram directly from your .smal file.
🐞 Debug-friendly
SMAL includes a structured debug layout that maps cleanly to firmware and tooling.
📬 Generic Messaging
A simple interface for defining how to communicate with your embedded device is provided so you can add comms directly to the REPL!
📝 Scripting
Want to write structured sequences of messages that you can send with a single command? SMAL provides that with an easy, YAML-based script structure (*.smalscr) that works seamlessly with your messaging paradigm of choice.
🛠️ Extensible
Add custom generators, validators, or analysis tools.
📦 Installation
pip install smal-lang
Or, using uv:
uv tool install smal-lang # install the `smal` CLI globally
uv add smal-lang # or add it as a project dependency
🚀 Quick Start
Try it with one of the bundled examples in src/examples:
smal
smal> machine load src/examples/simple/simple.smal
smal> diagram ./out
This loads the machine and renders out/simple_state_machine_diagram.svg. Run code generate <template> -o <output_dir> to generate firmware code from the same file.
📄 License
MIT — see LICENSE. See CHANGELOG.md for release history.
Metadata
Release files for smal-lang 0.5.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| smal_lang-0.5.6.tar.gz | 80.6 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smal_lang-0.5.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 190.7 kB
Release files / smal_lang-0.5.6.tar.gz
| Download URL | smal_lang-0.5.6.tar.gz |
|---|---|
| Size | 80.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e8e27d991d7f07f0402eed113ee37062817f9e705ec4ea7c3ac8fbf245e376ed
|
|
BLAKE2b-256 checksum How to use checksums |
01eb93c0f4294d8c1fa34235b3e9ff28c8c7d355d1ea20b93a3426afa604072a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logRelease files / smal_lang-0.5.6-py3-none-any.whl
| Download URL | smal_lang-0.5.6-py3-none-any.whl |
|---|---|
| Size | 110.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
35d2e95c85118a96b7b5996fec28364aada8793e038c6d2287c357f6ad73592f
|
|
BLAKE2b-256 checksum How to use checksums |
8f2944df39ea2656600a554b8c9e2dbf8de2c2aedcd1789f4b43ed6c99be7bd3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logSecurity for smal-lang 0.5.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for smal_lang-0.5.6.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 7, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.