Remember that there is HTML and there is XHTML and who knows what will come in the future. And also remember that there have been several versions of HTML so you want to make your parser aware of these important notes so it doesn't break easily across versions of HTML.
The easiest way depends on how you best learn. For me it would be to dissect an existing HTML parser. There are lots of open source libraries and programs to learn from.