1YACC(1) General Commands Manual YACC(1)
2
3
4
6 Yacc - an LALR(1) parser generator
7
9 yacc [ -dglrtv ] [ -b file_prefix ] [ -p symbol_prefix ] filename
10
12 Yacc reads the grammar specification in the file filename and generates
13 an LALR(1) parser for it. The parsers consist of a set of LALR(1)
14 parsing tables and a driver routine written in the C programming lan‐
15 guage. Yacc normally writes the parse tables and the driver routine to
16 the file y.tab.c.
17
18 The following options are available:
19
20 -b file_prefix
21 The -b option changes the prefix prepended to the output
22 file names to the string denoted by file_prefix. The
23 default prefix is the character y.
24
25 -d The -d option causes the header file y.tab.h to be writ‐
26 ten.
27
28 -g The -g option causes a graphical description of the gen‐
29 erated LALR(1) parser to be written to the file y.dot in
30 graphviz format, ready to be processed by dot(1).
31
32 -l If the -l option is not specified, yacc will insert #line
33 directives in the generated code. The #line directives
34 let the C compiler relate errors in the generated code to
35 the user's original code. If the -l option is specified,
36 yacc will not insert the #line directives. #line direc‐
37 tives specified by the user will be retained.
38
39 -o output_file
40 specify the filename for the parser file. If this option
41 is not given, the output filename is the file prefix con‐
42 catenated with the file suffix, e.g., y.tab.c. This
43 overrides the -p option.
44
45 -p symbol_prefix
46 The -p option changes the prefix prepended to yacc-gener‐
47 ated symbols to the string denoted by symbol_prefix. The
48 default prefix is the string yy.
49
50 -r The -r option causes yacc to produce separate files for
51 code and tables. The code file is named y.code.c, and
52 the tables file is named y.tab.c.
53
54 -t The -t option changes the preprocessor directives gener‐
55 ated by yacc so that debugging statements will be incor‐
56 porated in the compiled code.
57
58 -v The -v option causes a human-readable description of the
59 generated parser to be written to the file y.output.
60
61 -V print the version number to the standard output.
62
64 If there are rules that are never reduced, the number of such rules is
65 reported on standard error. If there are any LALR(1) conflicts, the
66 number of conflicts is reported on standard error.
67
68
69
704.3 Berkeley Distribution July 15, 1990 YACC(1)