3 yacc \- yet another compiler-compiler
12 converts a context-free grammar and translation code
14 tables for an LR(1) parser and translator.
15 The grammar may be ambiguous;
16 specified precedence rules are used to break ambiguities.
20 must be compiled by the C compiler
23 This program must be loaded with a lexical analyzer function,
28 .B main(int argc, char *argv[])
29 program, and with an error handling routine,
33 .TP "\w'\fL-o \fIoutput\fLXX'u"
35 Direct output to the specified file instead of
41 containing diagnostic messages.
42 To incorporate them in the parser, compile it with preprocessor symbol
46 diagnostic output from the parser is regulated by
49 The value 0 reports errors; 1 reports reductions;
50 higher values (up to 4) include more information about
56 containing a description of the parsing tables and of
57 conflicts arising from ambiguities in the grammar.
64 statements that associate
66 `token codes' with user-declared `token names'.
67 Include it in source files other than
69 to give access to the token codes.
84 Write a parser that uses
92 itself is essentially the same as the UNIX version
93 described in the references mentioned below.
96 option, the main relevant differences are:
98 The interface to the C environment is by default through
104 option reverses this.
110 which has a couple of effects.
111 First, the return value of
115 second, the starting value for non-terminals is now 0xE000 rather than 257.
117 The generated parser can be recursive: actions can call
119 for example to implement a sort of
121 statement in an interpreter.
123 Finally, some undocumented inner workings of the parser have been
124 changed, which may affect programs that know too much about its structure.
126 .TF /sys/lib/yaccpars
146 parser prototype using stdio
148 .B /sys/src/cmd/yacc.c
152 S. C. Johnson and R. Sethi,
153 ``Yacc: A parser generator'',
155 Unix Research System Programmer's Manual,
156 Tenth Edition, Volume 2
158 B. W. Kernighan and Rob Pike,
160 The UNIX Programming Environment,
163 The parser may not have full information when it writes to
165 so that the names of the tokens returned by