.\" %sccs.include.proprietary.roff%
.\" @(#)ss8 6.2 (Berkeley) %G%
When the user inputs a specification
to Yacc, the output is a file of C programs, called
(due to local file system conventions, the names may differ from
installation to installation).
The function produced by Yacc is called
it is an integer valued function.
When it is called, it in turn repeatedly calls
supplied by the user (see Section 3)
Eventually, either an error is detected, in which case
(if no error recovery is possible)
or the lexical analyzer returns the endmarker token
The user must provide a certain amount of environment for this
parser in order to obtain a working program.
For example, as with every C program, a program called
must be defined, that eventually calls
In addition, a routine called
when a syntax error is detected.
These two routines must be supplied in one form or another by the
To ease the initial effort of using Yacc, a library has been
provided with default versions of
The name of this library is system dependent;
on many systems the library is accessed by a
To show the triviality of these default programs, the source is
fprintf( stderr, "%s\en", s );
is a string containing an error message, usually
the string ``syntax error''.
The average application will want to do better than this.
Ordinarily, the program should keep track of the input line number, and print it
along with the message when a syntax error is detected.
The external integer variable
contains the lookahead token number at the time the error was detected;
this may be of some interest in giving better diagnostics.
program is probably supplied by the user (to read arguments, etc.)
the Yacc library is useful only in small
projects, or in the earliest stages of larger ones.
The external integer variable
If it is set to a nonzero value, the parser will output a
verbose description of its actions, including
a discussion of which input symbols have been read, and
what the parser actions are.
Depending on the operating environment,
it may be possible to set this variable by using a debugging system.