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
91 Disable #line directives in the generated parser.
94 Generate a parser that takes an argument of type Yyarg
95 and passes this argument to each invocation of the lexer
96 function, yylex. Yyarg contains per-instance state
97 and a single user-visible member, arg, of type void*.
101 itself is essentially the same as the UNIX version
102 described in the references mentioned below.
105 option, the main relevant differences are:
107 The interface to the C environment is by default through
113 option reverses this.
119 which has a couple of effects.
120 First, the return value of
124 second, the starting value for non-terminals is now 0xE000 rather than 257.
126 The generated parser can be recursive: actions can call
128 for example to implement a sort of
130 statement in an interpreter.
132 Finally, some undocumented inner workings of the parser have been
133 changed, which may affect programs that know too much about its structure.
155 parser prototype using stdio
157 .B \*9/src/cmd/yacc.c
161 S. C. Johnson and R. Sethi,
162 ``Yacc: A parser generator'',
164 Unix Research System Programmer's Manual,
165 Tenth Edition, Volume 2
167 B. W. Kernighan and Rob Pike,
169 The UNIX Programming Environment,
172 The parser may not have full information when it writes to
174 so that the names of the tokens returned by