3 ms·
┌┐ ↓│ ┌────┴┐ ┌─→│ │←──┐ │ └─────┘ │ ╔════╧═╗ ┌──┴──┐ ├─→║ ╟───A──→│
by thaumasiotes 11y ago
┌┐
↓│
┌────┴┐
┌─→│ │←──┐
│ └─────┘ │
╔════╧═╗ ┌──┴──┐
├─→║ ╟───A──→│ │
╚══════╝ └─┬───┘
↑ │
└─────A,B────┘
Three states if you want to process the whole input. If your model is "reject when you fail to find an appropriate transition" rather than "reject if, after processing the string, you're in a reject state", then you don't need the failure trap and you can do it in two states.
Backtracking is definitely not required, nor helpful.
- hobs 11y agoThat diagram is quite pretty, did you just hand code it?
- thaumasiotes 11y agoYeah, all manual. :/ http://unicode-table.com/en/blocks/box-drawing/ http://unicode-table.com/en/blocks/box-drawing/ http://unicode-table.com/en/sets/arrows-symbols/ http://unicode-table.com/en/sets/arrows-symbols/