And Synthesis 0.2.0 is out, with the mentioned graph backend.
Link to generating graphs:
[https://github.com/mratsim/Synthesis#displaying-the-state-machine](https://github.com/mratsim/Synthesis#displaying-the-state-machine)
And some graphs with increasing complexity
**Out-of-tasks worker state machine**
This is the description of the transitions of a worker thread that ran out of
tasks in its own task queue and checks if it managed to steal tasks from other
threads. (The theft is handled in another state machine.)
type
RecvTaskState = enum
RT_CheckChannel
RT_FoundTask
RT_Event = enum
RTE_CheckedAllChannels
RTE_FoundTask
RTE_isWaiting
Run
**sync (await) a task that may be spawned on another thread**
This is the description of the transitions of any thread that syncs (awaits) a
future that may be handled in another thread.
In summary, while the awaited task has child tasks still pending in this worker
thread, those are processed in priority, otherwise, it steals tasks from other
threads to help them on their workload. As soon as the future is ready, it
exits.
type AwaitState = enum
AW_CheckTask
AW_OutOfChildTasks
AW_Steal
AW_SuccessfulTheft
type AwaitEvent = enum
AWE_FutureReady
AWE_HasChildTask
AWE_ReceivedTask
Run
@rayman22201 Yes it can facilitate both stack-free and heap-free implementation
(states are "goto labels" at a low-level so they are not even represented by an
enum or an integer. However for async the state machine would need some kind of
context to know where to resume from.