Hierarchical State Machine implemented in the D programming language