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 generated by lex(1)), with a main(int argc, char *argv[]) program, and with an error handling routine, yyerror(char*).
The options are
–d Create file y.tab.h, containing #define statements 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.
The specification of yacc itself is essentially the same as the
UNIX version described in the references mentioned below. Besides
the –D option, the main relevant differences are:
|
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 |
SOURCE
/sys/src/cmd/yacc.c |
SEE ALSO
lex(1) S. C. Johnson and R. Sethi, ``Yacc: A parser generator'', Unix Research System Programmer's Manual, Tenth Edition, Volume 2 B. W. Kernighan and Rob Pike, The UNIX Programming Environment, Prentice Hall, 1984 |
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. |