1 | .\" %W% %R% (Berkeley) %E%
|
---|
2 | .\"
|
---|
3 | .TH YACC 1 "July 15, 1990"
|
---|
4 | .UC 6
|
---|
5 | .SH NAME
|
---|
6 | yacc \- an LALR(1) parser generator
|
---|
7 | .SH SYNOPSIS
|
---|
8 | .B yacc [ -dlrtv ] [ -b
|
---|
9 | .I file_prefix
|
---|
10 | .B ] [ -p
|
---|
11 | .I symbol_prefix
|
---|
12 | .B ]
|
---|
13 | .I filename
|
---|
14 | .SH DESCRIPTION
|
---|
15 | .I Yacc
|
---|
16 | reads the grammar specification in the file
|
---|
17 | .I filename
|
---|
18 | and generates an LR(1) parser for it.
|
---|
19 | The parsers consist of a set of LALR(1) parsing tables and a driver routine
|
---|
20 | written in the C programming language.
|
---|
21 | .I Yacc
|
---|
22 | normally writes the parse tables and the driver routine to the file
|
---|
23 | .IR y.tab.c.
|
---|
24 | .PP
|
---|
25 | The following options are available:
|
---|
26 | .RS
|
---|
27 | .TP
|
---|
28 | \fB-b \fIfile_prefix\fR
|
---|
29 | The
|
---|
30 | .B -b
|
---|
31 | option changes the prefix prepended to the output file names to
|
---|
32 | the string denoted by
|
---|
33 | .IR file_prefix.
|
---|
34 | The default prefix is the character
|
---|
35 | .IR y.
|
---|
36 | .TP
|
---|
37 | .B -d
|
---|
38 | The \fB-d\fR option causes the header file
|
---|
39 | .IR y.tab.h
|
---|
40 | to be written.
|
---|
41 | .TP
|
---|
42 | .B -l
|
---|
43 | If the
|
---|
44 | .B -l
|
---|
45 | option is not specified,
|
---|
46 | .I yacc
|
---|
47 | will insert #line directives in the generated code.
|
---|
48 | The #line directives let the C compiler relate errors in the
|
---|
49 | generated code to the user's original code.
|
---|
50 | If the \fB-l\fR option is specified,
|
---|
51 | .I yacc
|
---|
52 | will not insert the #line directives.
|
---|
53 | \&#line directives specified by the user will be retained.
|
---|
54 | .TP
|
---|
55 | \fB-p \fIsymbol_prefix\fR
|
---|
56 | The
|
---|
57 | .B -p
|
---|
58 | option changes the prefix prepended to yacc-generated symbols to
|
---|
59 | the string denoted by
|
---|
60 | .IR symbol_prefix.
|
---|
61 | The default prefix is the string
|
---|
62 | .IR yy.
|
---|
63 | .TP
|
---|
64 | .B -r
|
---|
65 | The
|
---|
66 | .B -r
|
---|
67 | option causes
|
---|
68 | .I yacc
|
---|
69 | to produce separate files for code and tables. The code file
|
---|
70 | is named
|
---|
71 | .IR y.code.c,
|
---|
72 | and the tables file is named
|
---|
73 | .IR y.tab.c.
|
---|
74 | .TP
|
---|
75 | .B -t
|
---|
76 | The
|
---|
77 | .B -t
|
---|
78 | option changes the preprocessor directives generated by
|
---|
79 | .I yacc
|
---|
80 | so that debugging statements will be incorporated in the compiled code.
|
---|
81 | .TP
|
---|
82 | .B -v
|
---|
83 | The
|
---|
84 | .B -v
|
---|
85 | option causes a human-readable description of the generated parser to
|
---|
86 | be written to the file
|
---|
87 | .IR y.output.
|
---|
88 | .RE
|
---|
89 | .PP
|
---|
90 | If the environment variable TMPDIR is set, the string denoted by
|
---|
91 | TMPDIR will be used as the name of the directory where the temporary
|
---|
92 | files are created.
|
---|
93 | .SH FILES
|
---|
94 | .IR y.code.c
|
---|
95 | .br
|
---|
96 | .IR y.tab.c
|
---|
97 | .br
|
---|
98 | .IR y.tab.h
|
---|
99 | .br
|
---|
100 | .IR y.output
|
---|
101 | .br
|
---|
102 | .IR /tmp/yacc.aXXXXXX
|
---|
103 | .br
|
---|
104 | .IR /tmp/yacc.tXXXXXX
|
---|
105 | .br
|
---|
106 | .IR /tmp/yacc.uXXXXXX
|
---|
107 | .SH DIAGNOSTICS
|
---|
108 | If there are rules that are never reduced, the number of such rules is
|
---|
109 | reported on standard error.
|
---|
110 | If there are any LALR(1) conflicts, the number of conflicts is reported
|
---|
111 | on standard error.
|
---|