Ceu is a synchronous programming language that reconciles Structured Concurrency with Event-Driven Programming. Ceu extends classical structured programming with three main functionalities:
- Structured Deterministic Concurrency:
- A set of structured primitives to compose concurrent tasks (e.g.,
spawn,par-or,toggle). - A synchronous and deterministic scheduling policy, which provides predictable behavior and safe abortion of tasks.
- A container primitive to hold dynamic tasks, which automatically releases them on termination.
- A set of structured primitives to compose concurrent tasks (e.g.,
- Event Signaling Mechanisms:
- An
awaitprimitive to suspend a task and wait for events. - A
broadcastprimitive to signal events and awake awaiting tasks.
- An
- Lexical Memory Management:
- Even dynamic allocation is attached to lexical blocks.
- Strict escaping rules to preserve structure reasoning.
- Garbage collection restricted to local references only.
Ceu is inspired by Esterel and Lua.
Follows a summary of the main ideas in the design of Ceu:
Follows an extended list of functionalities in Ceu:
- Dynamic typing
- Expression based (statements are expressions)
- Stackless coroutines (the basis of tasks)
- Restricted closures (upvalues must be explicit and final)
- Deferred statements (for finalization)
- Exception handling
- Dynamic collections (tuples, vectors, and dictionaries)
- Hierarchical tuple templates (for data description)
- Seamless integration with C (source-level compatibility)
Ceu is in experimental stage. Both the compiler and runtime can become very slow.
- Install
gccandjava:
$ sudo apt install gcc default-jre
- Install
ceu:
$ wget https://github.com/fsantanna/dceu/releases/download/v0.1.0/install-v0.1.0.sh
$ sh install-v0.1.0.sh ./ceu/
- You may want to
- add
./ceu/to yourPATH - modify
./ceu/to another destination
- add
- Execute
ceu:
$ ./ceu/ceu ./ceu/hello-world.ceu
[0,hello]
[1,world]
The best way to try Ceu is through pico-ceu, a graphical library based
on SDL:
- Install
SDL:
$ sudo apt install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl2-gfx-dev
- Clone
pico-ceu:
$ cd ceu/
$ git clone https://github.com/fsantanna/pico-ceu pico/
- Clone
pico-sdl:
$ cd pico/
$ git clone https://github.com/fsantanna/pico-sdl sdl/
- Execute
pico-ceu:
$ cd ../../ # back to your initial working directory
$ ./ceu/ceu --lib=pico ./ceu/pico/tst/par.ceu
- Your directory hierarchy should become as follows:
+ ceu/
|---+ pico/
|---+ sdl/
- A toy Problem: Drag, Click, or Cancel
- https://fsantanna.github.io/toy.html
- Run with
pico-ceu:ceu --lib=pico ./ceu/pico/tst/click-drag-cancel.ceu
- Comparison with JS generators:
- A simple but complete 2D game in Ceu:
- https://github.com/fsantanna/pico-ceu-rocks
- Clone, cd to it, and run with
pico-ceu:ceu --lib=pico main.ceu