YACC(1) YACC(1)
NAME
yacc - yet another compiler-compiler
SYNOPSIS
yacc [ option ... ] grammar
DESCRIPTION
Yacc converts a context-free grammar and translation code
into a set of tables for an LR(1) parser and translator.
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 a lexical analyzer function, yylex(void) (often gener-
ated by lex(1)), with a main(int argc, char *argv[]) pro-
gram, and with an error handling routine, yyerror(char*).
The options are
-o output Direct output to the specified file instead of
y.tab.c.
-Dn Create file y.debug, containing diagnostic mes-
sages. The amount of diagnostic output from the
parser is regulated by value n:
0 Report errors.
1 Also report reductions.
2 Also report the name of each token returned
by `yylex'.
-v Create file y.output, containing a description of
the parsing tables and of conflicts arising from
ambiguities in the grammar.
-d Create file y.tab.h, containing #define state-
ments that associate yacc-assigned `token codes'
with user-declared `token names'. Include it in
source files other than y.tab.c to give access to
the token codes.
-s stem Change the prefix `y' of the file names y.tab.c,
y.tab.h, y.debug, and y.output to stem.
-S Write a parser that uses stdio instead of the
print routines in libc.
Page 1 Plan 9 (printed 11/6/25)
YACC(1) YACC(1)
FILES
y.output
y.tab.c
y.tab.h
y.debug
y.tmp.* temporary file
y.acts.* temporary file
/sys/lib/yaccpar parser prototype
/sys/lib/yaccpars parser prototype using stdio
SEE ALSO
lex(1)
Yacc: A parser generator, S. C. Johnson and R. Sethi, Unix
Research System Programmer's Manual, Volume 2
BUGS
The parser may not have full information when it writes to
y.debug so that the names of the tokens returned by `yylex'
may be missing.
Page 2 Plan 9 (printed 11/6/25)