Structured Event-Driven Concurrency
This is the unstable main branch.
Please, switch to stable v0.4.
[ About | Hello World! | Install & Run | Documentation | Resources ]
Atmos is a programming language that reconciles Structured Concurrency, Event-Driven Programming, and Functional Streams, extending classical structured programming with three main functionalities:
- Structured Deterministic Concurrency:
- A
taskprimitive with deterministic scheduling provides predictable behavior and safe abortion. - Structured primitives compose concurrent tasks with lexical scope (e.g.,
watching,every,par_or). - A
taskscontainer primitive holds attached tasks and control their lifecycle. - A
pindeclaration attaches a task or tasks to its enclosing lexical scope.
- A
- Event Signaling Mechanisms:
- An
awaitprimitive suspends a task and wait for events. - An
emitprimitive signals events and awake awaiting tasks.
- An
- Functional Streams (à la ReactiveX):
- (experimental)
- Functional combinators for lazy (infinite) lists.
- Interoperability with tasks & events: tasks and events as streams, and streams as events.
- Safe finalization of stateful (task-based) streams.
Atmos is inspired by synchronous programming languages like Céu and Esterel.
Atmos compiles to Lua and relies on lua-atmos for its concurrency runtime.
During 5 seconds, displays Hello World! every second:
require "atmos.env.clock"
watching @5 {
every @1 {
print "Hello World!"
}
}
We first import the builtin clock environment, which provides timers to
applications.
The program body is a task in Atmos that behaves as follows:
- The
watchingcommand will execute its block during 5 seconds. - The
everyloop will execute its block every second. - Once the
watchingterminates, the body reaches its end, and the program exits cleanly.
sudo luarocks install atmos-lang --lua-version=5.4
atmos <lua-path>/atmos/lang/exs/hello.lua
You may also clone the repository and copy part of the source tree, as follows,
into your lua-atmos path (e.g., /usr/local/share/lua/5.4/atmos/):
TODO
The Atmos distribution includes the single-file project argparse.
Atmos depends on lua-atmos.
An environment is an external component that bridges input events from the real world into an Atmos application.
The standard distribution of Atmos provides the following environments:
atmos.env.clockA simple pure-Lua environment that usesos.clockto issue timer events.atmos.env.socketAn environment that relies on luasocket to provide network communication.atmos.env.sdlAn environment that relies on lua-sdl2 to provide window, mouse, key, and timer events.atmos.env.picoAn environment that relies on [pico-sdl-lua][pico-sdl-lua] as a simpler alternative do SDL.atmos.env.iupAn environment that relies on IUP (iup-lua) to provide graphical user interfaces (GUIs).
- A toy problem: Drag, Click, or Cancel
- A simple but complete 2D game in Atmos:
- Academic publications (Céu):
- Mailing list (Céu & Atmos):
