Library

DFA · Regular

A string literal with escapes

Between two quotes, a backslash escapes whatever comes next — including a quote or another backslash. a stands for any ordinary character.

startinescdone"a\", \, a"
The machine as drawn — 4 states, 7 transitions.Every word up to length 5, one row per length in shortlex order, inked where it is accepted.

The author’s examples, run

"" → accept"a" → accept"a\"a" → accept"\\" → accept"a\" → reject"a"a → reject"\a\\" → accept