YACC (1)


yacc - yet another compiler-compiler


See Also


yacc [-vVdlt] [-Q(y|n)] [-b file_prefix] [-p sym_prefix] [-P parser] [-Y directory] grammar


Yacc converts a context-free grammar into a set of tables for a simple automaton which executes an LR(1) parsing algorithm. The grammar may be ambiguous; specified precedence rules are used to break ambiguities.

The output file, y.tab.c, must be compiled by the C compiler to produce a program yyparse. This program must be loaded with the lexical analyzer program, yylex, as well as main and yyerror, an error handling routine. These routines must be supplied by the user; Lex(1) is useful for creating lexical analyzers usable by yacc.

The following options are accepted:
-b file_prefix
  Use file_prefix instead of 'y' when generating output files, i.e. generate 'file_prefix.tab.c' and so forth. This option was introduced by POSIX.2.
-d If this option is used, the file y.tab.h is generated with the define statements that associate the yacc-assigned 'token codes' with the user-declared 'token names'. This allows source files other than y.tab.c to access the token codes.
-l Do not emit '#line' preprocessor directives when writing y.tab.c. These are normally inserted to facilitate debugging.
-p sym_prefix
  Use sym_prefix instead of 'yy' as the prefix for names with global scope, i.e. generate 'sym_prefixparse' and so forth. This option was introduced by POSIX.2.
-P driver_file
  Use the file driver_file as driver file instead of 'yaccpar'.
-Q(y|n) With -Qy, a version identification variable is put into y.tab.c. With -Qn (the default), no such variable is generated.
-t Enable run-time debugging code by default, i.e. define the 'YYDEBUG' preprocessor symbol.
-v If this option is given, the file y.output is prepared, which contains a description of the parsing tables and a report on conflicts generated by ambiguities in the grammar.
-V Causes version information for yacc to be printed.
-Y directory
  Use the file 'directory/yaccpar' as driver file. This option is an extension.


y.tab.h             defines for token names
yacc.tmp, yacc.acts temporary files
/usr/ccs/lib/yaccparparser prototype for C programs
/usr/ccs/lib/liby.a library with default 'main' and 'yyerror'


LR Parsing by A. V. Aho and S. C. Johnson, Computing Surveys, June, 1974.
YACC - Yet Another Compiler Compiler by S. C. Johnson.


The number of reduce-reduce and shift-reduce conflicts is reported on the standard output; a more detailed report is found in the y.output file. Similarly, if some rules are not reachable from the start symbol, this is also reported.

Heirloom Development Tools YACC (1) 11/27/05
Generated by a modified version of manServer 1.07 from heirloom-devtools-070527/yacc/yacc.1 using man macros.