by ChrisSD · 7y ago · 0 comments
[1] https://en.m.wikipedia.org/wiki/Pushdown_automaton
[2] https://en.m.wikipedia.org/wiki/Linear_bounded_automaton
More specifically, a stack lets you keep track of nesting. See an opening tag, push something onto a stack. See a closing tag, pop the stack. If the stack is empty at the end, the tags match.
Parsing XHTML in real life is of course much more complicated than this, but this is the basic idea.