YACC(1) USER COMMANDS YACC(1)
NAME
yacc - yet another compiler-compiler: parsing program gen-
erator
SYNOPSIS
yacc [ -dvlt ] _g_r_a_m_m_a_r
DESCRIPTION
yacc converts a context-free grammar into a set of tables
for a simple automaton which executes an LR(1) parsing algo-
rithm. The grammar may be ambiguous, in which case speci-
fied precedence rules may be used to break those ambigui-
ties.
The output file, y.tab.c, must be compiled by the C compiler
to produce a function named yyparse(). The yyparse() func-
tion must be loaded with the lexical analyzer yylex(), as
well as main() and the error handling routine yyerror().
These routines must be supplied by the user; lex(1) is use-
ful for creating lexical analyzers usable by yacc-produced
parsers.
OPTIONS
-d Generate the file y.tab.h with the define statements
that associate the yacc-assigned "token codes" with the
user-declared "token names" so that source files other
than y.tab.c can access the token codes.
-v Prepare the file y.output containing a description of
the parsing tables and a report on conflicts generated
by ambiguities in the grammar.
-l Generate y.tab.c containing no numbered line direc-
tives.
-t Set the preprocessor symbol yydebug, so y.tab.c will be
compiled with runtime debugging code.
FILES
y.output description of parsing tables and con-
flict report
y.tab.c output parser
y.tab.h defines for token names
yacc.tmp, yacc.acts temporary files
/usr/lib/yaccpar parser prototype for C programs
/usr/5lib/liby.a library provides primitive routines
main() and yyerror() to facilitate the
initial use of yacc.
SEE ALSO
cc(1V), lex(1)
Sun Release 4.1 Last change: 1 February 1989 1
YACC(1) USER COMMANDS YACC(1)
_P_r_o_g_r_a_m_m_i_n_g _U_t_i_l_i_t_i_e_s _a_n_d _L_i_b_r_a_r_i_e_s
_L_R _P_a_r_s_i_n_g by A. V. Aho and S. C. Johnson, Computing Sur-
veys, June, 1974
DIAGNOSTICS
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, it is also reported
if some rules are not reachable from the start symbol.
NOTES
Because the cc(1V) command does not generate or support 8-
bit symbol names, it is inappropriate to make yacc 8-bit
clean. See cc(1V) for an explanation about why cc is not
8-bit clean.
BUGS
Because file names are fixed, no more than one yacc process
should be active in a given directory at a time.
Sun Release 4.1 Last change: 1 February 1989 2