Is there a programming language with built-in state machine construct?

Viewed 12969

I am just curious if there is a programming language which has state machines (similar to boost::statechart) as primary language construct.

Analogies - c# has delegates where java uses the observer pattern and C has callbacks. Perl and python have built-in hashes while C++ and java needs a library.

Update:

This should be general programming language in the sense of C++, C#, Java, Lisp ...

I mean "mature" state machines with all bells and whistles on the level of Harel formalism or UML state diagrams or boost::statechart.

14 Answers

I'm almost a decade late to the party but I recently stumbled upon an obscure language which borrows ideas from FSMs called Hume

I'm not sure if it's still actively maintained, but you can at least download the compiler and play around with it. Information is hard to come by, but there's a few papers and articles online that show the essentials.

In Sep 2015 the xstate project was launched. It implements SCXML and aims to provide JavaScript and TypeScript finite state machines and statecharts for the modern web. link to the documentation

Related