This document should generate three warnings: one for line 37, one for line 53 and one for line 65.
First of all, this is the basic definition of a SGML comment (and since HTML is an SGML application, it is also the definition of a HTML comment):
A comment declaration starts with <!, followed by zero or more comments, followed by >. A comment starts and ends with "--", and does not contain any occurrence of "--".
Note that an "empty" comment tag, with just "--" characters, should always have a multiple of four "-" characters to be legal. (And yes, <!> is also a legal comment - it's the empty comment).
<!> the empty comment (zero dashes)
<!-- standard comment (four dashes) -->
<!-- text -- comment -- end (8 dashes) -->
<!-- this is a bad comment -- you see? (6 dashes) -->
<!-- a comment spanning multiple lines -- and it's a correct comment as well (8 dashes) -- -->
<!-- a comment spanning multiple lines -- -- and it's a bad one (10 dashes) -- -->
<!---------------- International Sales Offices ---------------------->(saillant detail: this comment comes straight from a Netscape document...)
(bad comment, 38 dashes)
a nested comment (8 dashes) -->
<!----<--> a nested comment (8 dashes) -->(most browsers I know of get the above comment wrong: the a nested ... will appear twice in them)
hello-->
<!------> hello-->(again, most browsers will also get this one wrong: the hello--> will appear twice)
<!-- a comment - with dashes in between - (4 dashes and *not* 6) -->