Previous: , Up: Invoking Bison   [Contents][Index]


9.3 Yacc Library

The Yacc library contains default implementations of the yyerror and main functions. These default implementations are normally not useful, but POSIX requires them. To use the Yacc library, link your program with the -ly option. Note that Bison’s implementation of the Yacc library is distributed under the terms of the GNU General Public License (see GNU GENERAL PUBLIC LICENSE).

If you use the Yacc library’s yyerror function, you should declare yyerror as follows:

int yyerror (char const *);

The int value returned by this yyerror is ignored.

The implementation of Yacc library’s main function is:

int main (void)
{
  setlocale (LC_ALL, "");
  return yyparse ();
}

so if you use it, the internationalization support is enabled (e.g., error messages are translated), and your yyparse function should have the following type signature:

int yyparse (void);