DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
yacc

End-marker token

The end of the input to the parser is signaled by a special token, called the ``end-marker''. The end-marker is represented by either a zero or a negative number. Thus, every lexical analyzer should be prepared to return 0 or a negative number as a token upon reaching the end of its input. If the tokens up to, but not including, the end-marker form a construct that matches the start symbol, the parser function accepts the input and returns to its caller after the end-marker is seen. If the end-marker is seen in any other context, it is an error.

It is the responsibility of the user-supplied lexical analyzer to return the end-marker when appropriate. Usually the end-marker represents some reasonably obvious I/O status, such as end-of-file or end-of-record. The programmer does not have to deal with this if using lex, which takes care of this job automatically.


Next topic: Reserved token names
Previous topic: Token numbers

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003