title: How does a parser (for example, HTML) work?
body: <p>For argument's sake lets assume a HTML parser.</p>
  
  <p>I've read that it <em>tokenizes</em> everything first, and then parses it.</p>
  
  <p>What does tokenize mean?</p>
  
  <p>Does the parser read every character each, building up a multi dimensional array to store the structure?</p>
  
  <p>For example, does it read a <code>&lt;</code> and then begin to capture the element, and then once it meets a closing <code>&gt;</code> (outside of an attribute) it is pushed onto a array stack somewhere?</p>
  
  <p>I'm interested for the sake of knowing (I'm curious).</p>
  
  <p>If I were to read through the source of something like <a href="http://htmlpurifier.org/" rel="noreferrer">HTML Purifier</a>, would that give me a good idea of how HTML is parsed?</p>