RepositoryC++USUnited States
GO

google/statechart

C++ StateChart Library

121stars
34forks
0issues
1views

C++ StateChart Library

StateCharts (Harel, 1987) is a visual formalism for declarative description of complex interactive systems. It extends the conventional state machine formalism with Hierarchy, Concurrency and Communication.

SCXML is a W3C standard based on StateCharts. This is a C++ library that implements the SCXML specification. Instead of XML, a StateChart is represented as a StateChart protobuf.

Features

Many features from the SCXML standard have been implemented.

  • Composite State
  • Parallel State
  • Datamodel
  • Transitions (Conditional, Eventless)
  • Executable Statements (Raise, Log, Assign, If, ForEach, Send)
  • Serialize/Deserialize the state machine

TODO

  • History

Example

Here's an example of a StateChart that describes a Microwave.

Microwave StateChart

You can see //statechart/example/microwave_example_main.cc for details on how to specify such a StateChart as a StateChart proto and how to use it in code.

Usage

To build the library you'll need bazel. You can download and install it from here.

# Download/Clone the repo.
git clone https://github.com/google/statechart.git
cd statechart

# Build the library
bazel build //statechart/...

# Run unit tests
bazel test //statechart/...

# Run the Microwave example
bazel run //statechart/example:microwave_example_main -- --alsologtostderr

Disclaimer

This is not an officially supported Google product.

References

  • David Harel, 1987, Statecharts: a visual formalism for complex systems, Science of Computer Programming. Link
  • State Chart XML (SCXML): State Machine Notation for Control Abstraction. Link

Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
statelyai/xstate

State machines, statecharts, and actors for complex logic

30.6k
Nov 30, 2026
RepositoryTypeScript
sverweij/state-machine-cat

write beautiful state charts :scream_cat:

874
Nov 22, 2026
RepositoryPython
practical-tutorials/project-based-learning

Curated list of project-based tutorials

290.9k
Nov 30, 2026
RepositoryJavaScript
CyC2018/CS-Notes

:books: 技术面试必备基础知识、Leetcode、计算机操作系统、计算机网络、系统设计

186.6k
Nov 27, 2026
RepositoryC++
alexzhornyak/ScxmlEditor-Tutorial

ScxmlEditor - powerful tool for creating, editing and debugging scxml files

89
Jul 9, 2026
RepositoryC
QuantumLeaps/qpc

QP/C Real-Time Event Framework/RTOS implements event-driven Active Object (Actor) model combined with Hierarchical State Machines. Specifically designed for embedded systems (e.g., ARM Cortex-M MCUs).

1.4k
Nov 28, 2026
RepositoryRust
mdeloof/statig

Hierarchical state machines for designing event-driven systems

814
Nov 29, 2025
RepositoryTypeScript
statelyai/agent

Create state-machine-powered LLM agents using XState

511
Nov 25, 2026
RepositoryTypeScript
firecrawl/firecrawl

Firecrawl is the knowledge infrastructure to make your agents smarter. It connects your agents to the web, and to Alexandria, our library of everything else.

215.1k
Dec 2, 2026