blanch / projects /

Hierachical State Machine


Writing interactive software leads, due to the lack of adapted control structures, to a code that is difficult to maintain and reuse. Formalisms adapted to the description and to the specification of interactions do exist. We propose to extend imperative programming languages with a control structure borrowed from one of those formalisms : the hierarchical state machines.

A paper in french [B02], and in english [BBL06] describe our work, and a library (libhsm) is provided to experiment the use of hierarchical state machines in C++.


The library provides a preprocessor to generate C++ code from HSMs definitions, a framework to support run-time execution of HSMs, and abstractions for dealing with system dependent aspects of interactive software (dealing with windows, time, files, threads, etc.)

The latter part of the library is fully functionnal under MacOSX system only. The port is almost complete for Win32 systems but not activelly supported, and the windowing part of the port is totally absent for posix / X systems but the libhsm design should make it easy to achieve.


Some easy to prototype widgets (a traditionnal button, a button for crossing-based user interface):


A simple svg editor using a transparent toolglass and bimanual interaction:

simple editor

An interactive tree view:



The hsm library is available as a source archive.
You will need the svgl library if you are planning to use the svg display facility.


Renaud Blanch and Michel Beaudouin-Lafon. Programming Rich Interactions using the Hierarchical State Machine Toolkit. In Proceedings of AVI 2006, pages 51-58, Venice - Italy, mai 2006.
Renaud Blanch, Michel Beaudouin-Lafon, Stéphane Conversy, Yannick Jestin, Thomas Baudel and Yun Peng Zhao. INDIGO : une architecture pour la conception d'applications graphiques interactives distribuées. In Proceedings of IHM 2005, to be published, Toulouse - France, September 2005.
Renaud Blanch. Facilitating post-WIMP Interaction Programming using the Hierarchical State Machine Toolkit. Rapport de Recherche 1410, Laboratoire de Recherche en Informatique, Université Paris-Sud, France, avril 2005.
Renaud Blanch. Programmer l'interaction avec des machines à états hiérarchiques. In Actes des quatorzième journées francophones sur l'Interaction Homme Machine (IHM 2002), pages 129-136, Poitiers - France, Novembre 2002. ACM International Conference Proceedings Series.
last update: october, 6 2008