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

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



   yacc.1p    ( 1 )

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

Использование в приложениях (Application usage)

Historical implementations experience name conflicts on the names
       yacc.tmp, yacc.acts, yacc.debug, y.tab.c, y.tab.h, and y.output
       if more than one copy of yacc is running in a single directory at
       one time. The -b option was added to overcome this problem. The
       related problem of allowing multiple yacc parsers to be placed in
       the same file was addressed by adding a -p option to override the
       previously hard-coded yy variable prefix.

The description of the -p option specifies the minimal set of function and variable names that cause conflict when multiple parsers are linked together. YYSTYPE does not need to be changed. Instead, the programmer can use -b to give the header files for different parsers different names, and then the file with the yylex() for a given parser can include the header for that parser. Names such as yyclearerr do not need to be changed because they are used only in the actions; they do not have linkage. It is possible that an implementation has other names, either internal ones for implementing things such as yyclearerr, or providing non-standard features that it wants to change with -p.

Unary operators that are the same token as a binary operator in general need their precedence adjusted. This is handled by the %prec advisory symbol associated with the particular grammar rule defining that unary operator. (See Grammar Rules in yacc.) Applications are not required to use this operator for unary operators, but the grammars that do not require it are rare.