State Machines with xstate (JavaScript)

I found this library in a GatsbyJS plugin, and it looks interesting.

Docs: XState Docs

Here’s a video intro:

Can’t say that I love the website’s examples (bold versus italics). They’re easy-enough to understand but the code bloat factor for something this simple doesn’t really show the merits of the concept.

What would be cool/useful would be for them to show an example of a baby compiler which recognizes keywords as tokens or similar from a string of text. Or how about the code/console colorizers out there?