Library

PDT · Pushdown transduction

Reverse every word

Letters are pushed as they arrive; a space, written _, pops the word back out reversed and then prints the space. “ab_cde” becomes “ba_edc”: a stack reverses, and a separator says when.

readspaceenddone
The machine as drawn — 4 states, 10 transitions.

The author’s examples, run

_ → accept · _a → accept · a__ → accept · ___a → accept · _a___ → accept · ___bbb_aa_b_abaa__a → accept · bbb_aa_b_aaba__a