Путеводитель по Руководству Linux

  User  |  Syst  |  Libr  |  Device  |  Files  |  Other  |  Admin  |  Head  |



   yacc.1p    ( 1 )

еще один компилятор компилятора (РАЗРАБОТКА) (yet another compiler compiler (DEVELOPMENT))

Примеры (Examples)

Access to the yacc library is obtained with library search
       operands to c99.  To use the yacc library main():

c99 y.tab.c -l y

Both the lex library and the yacc library contain main(). To access the yacc main():

c99 y.tab.c lex.yy.c -l y -l l

This ensures that the yacc library is searched first, so that its main() is used.

The historical yacc libraries have contained two simple functions that are normally coded by the application programmer. These functions are similar to the following code:

#include <locale.h> int main(void) { extern int yyparse();

setlocale(LC_ALL, "");

/* If the following parser is one created by lex, the application must be careful to ensure that LC_CTYPE and LC_COLLATE are set to the POSIX locale. */ (void) yyparse(); return (0); }

#include <stdio.h>

int yyerror(const char *msg) { (void) fprintf(stderr, "%s\n", msg); return (0); }