Language to describe 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:

  • MOP FSM plugin by Formal Systems Laboratory.

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


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.


Most of what has been standardised goes beyond simple finite state machines.

If you like XML, there’s State Chart XML and UML’s XMI for UML state charts, both of which are a superset of finite state machine.

There’s also Matlab’s stateflow, but I’m not sure if there’s a text based language behind them or a proprietary format.

Trawling my links from a few years back, Microsoft’s Abstract state machine language has an implementation XASM ( I’ve not used it ) and a paper ‘SML-a high level language for the design and verification of finite state machines’. If you want something more of domain language within a programming languages, there’s this question Is there a programming language with built-in state machine construct?


Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *