End marker
The end of parser input is marked by a special token called the end marker. This token is often written as $end; the value of the token is zero.
It is the job of the lexical analyzer yylex() to return a zero to indicate $end when the end of input is reached (for example, at end of file, or at a keyword that indicates end of input).
yyparse() terminates when it has parsed a start symbol followed by the end marker.