Skip to content

atmos-lang/atmos

Repository files navigation

The Programming Language Atmos

Tests

Structured Event-Driven Concurrency

[ v0.4 | v0.3 | v0.2 ]

This is the unstable main branch. Please, switch to stable v0.4.

[ About | Hello World! | Install & Run | Documentation | Resources ]

Image

About

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 task primitive with deterministic scheduling provides predictable behavior and safe abortion.
    • Structured primitives compose concurrent tasks with lexical scope (e.g., watching, every, par_or).
    • A tasks container primitive holds attached tasks and control their lifecycle.
    • A pin declaration attaches a task or tasks to its enclosing lexical scope.
  • Event Signaling Mechanisms:
    • An await primitive suspends a task and wait for events.
    • An emit primitive signals events and awake awaiting tasks.
  • 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.

Hello World!

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 watching command will execute its block during 5 seconds.
  • The every loop will execute its block every second.
  • Once the watching terminates, the body reaches its end, and the program exits cleanly.

Install & Run

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.

Documentation

Environments

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.clock A simple pure-Lua environment that uses os.clock to issue timer events.
  • atmos.env.socket An environment that relies on luasocket to provide network communication.
  • atmos.env.sdl An environment that relies on lua-sdl2 to provide window, mouse, key, and timer events.
  • atmos.env.pico An environment that relies on [pico-sdl-lua][pico-sdl-lua] as a simpler alternative do SDL.
  • atmos.env.iup An environment that relies on IUP (iup-lua) to provide graphical user interfaces (GUIs).

Resources

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages