All projects

fsm

A finite state machine combinator library for constructing regular-language recognizers through a Ruby DSL.

Technologies: Ruby, State machines, DSL

GitHub repository

Small machines, composed together

fsm is a finite state machine library written in Ruby. It supports constructing nondeterministic and deterministic finite automata, with a DSL for composing recognizers for regular languages.

The project treats a recognizer as something that can be built from smaller pieces rather than described only as a single opaque pattern.

Making the model explicit

A state machine represents behavior in terms of states and transitions. Working directly with that model makes regular-language operations something to implement and combine.

The repository points to the Ragel user guide as a reference for several of the implemented operators.

What this project explores

  • Nondeterministic and deterministic finite automata.
  • Combinators for regular-language recognition.
  • An expressive Ruby DSL over an explicit computational model.