Language to describe Finite State Machine

finite-state machine

I'm doing a lot of code analysis using lexer and finite state machine. For time being I'm using table to describe FSM:

| token | current state | target state |
+-------+---------------+--------------+
| .     | start         | dot          |
| trace | dot           | method       |
| (     | method        | detected     |

Using this table and implicit start state FSM is created:

enter image description here

Lexer is used to generate a stream of tokens and token used as trigger for state transition. In case transition from current state is impossible – FSM is set to start state.

Using table to describe FSM is alright for fairly small number of states, but it gets complicated fairly quickly. Google search suggested very few interesting results:

So the question is there standard or de facto language to describe finite state machines?

Best Answer

Since finite state machines are a basically subset of (labelled) directed graphs, what about something like DOT. It was just the first thing that popped up on a Google "directed graph language". I've never used it.

Related Topic