Slide 97
Slide 97 text
• s = new State(‘abc’);
• match(s, /a(b|c)d/)
• test(‘a’, /a/): ✓
• try /b/: match(s’, /bd/)
• test(s’, /b/): ✗
Backtrack
• try /c/: match(s’’, /(b|c)d/)
• test(‘c’, /c/): ✓
• test(‘d’, /d/): ✓
• DONE
record the trace
along the way
a c d
^
a b
c
d
“
s’=s.clone()