I often want to work with specific finite automata within pbsf-lib. I used to build these automata by hand using the API, which meant that I had to add states and create transitions between those states line by line using the correct state identifiers.
dfa = DFA()
dfa.add_symbols({'a', 'b'})
states = dfa.add_states(3)
dfa.set_transition(dfa.initial, states[0], self.symbols['a'])
dfa.set_transition(states[0], states[1], self.symbols['b'])
...
This works well for small automata, but once they get more intricate, it’s sometimes hard to keep track of the right identifiers. There was also a lot of boilerplate involved, which I solved by moving to a small language for building automata within pbsf-lib:
name of automaton
initial <identifier of initial state>
final <identifier(s) of final state(s)>
<id from> <id to> <character>
<id from> <id to> <character>
...
Recently, instead of building an automaton by hand, I tried using Claude to build the automaton for me given a hand-drawn picture of it, and was surprised by how well this worked. This still has a couple of problems, however, and I don’t want to rely on these systems to build automata for me. Today, I wanted to take the first steps towards a new solution using my reMarkable tablet.
This first step includes recording and replaying pen strokes that I make on the tablet, for which I later want to add shape recognition so that I can build and alter automata live through drawing. I used reStream as a basis, but Opus 5.5 did most of the work to give me a tool that records (and can replay) pen strokes.
An added benefit is that I can now export these recordings as animated vector graphics and include them on this site as well: