Updated with Tizen:Base source codes
[external/byacc.git] / yacc.1
1 .\" $Id: yacc.1,v 1.6 2005/05/04 22:11:56 tom Exp $
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 [ -dglrtv ] [ \-b
9 .I file_prefix
10 .B ] [ \-p
11 .I symbol_prefix
12 .B ]
13 .I filename
14 .SH DESCRIPTION
15 .B Yacc
16 reads the grammar specification in the file
17 .I filename
18 and generates an LALR(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 .B 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 \fP\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 \-g
43 The
44 .B \-g
45 option causes a graphical description of the generated LALR(1) parser to
46 be written to the file
47 .IR y.dot
48 in graphviz format, ready to be processed by dot(1).
49 .TP
50 .B \-l
51 If the
52 .B \-l
53 option is not specified,
54 .B yacc
55 will insert \fI#line\fP directives in the generated code.
56 The \fI#line\fP directives let the C compiler relate errors in the
57 generated code to the user's original code.
58 If the \fB-l\fR option is specified,
59 .B yacc
60 will not insert the \fI#line\fP directives.
61 \&\fI#line\fP directives specified by the user will be retained.
62 .TP
63 \fB\-o \fP\fIoutput_file\fR
64 specify the filename for the parser file.
65 If this option is not given, the output filename is
66 the file prefix concatenated with the file suffix, e.g., \fBy.tab.c\fP.
67 This overrides the \fB-p\fP option.
68 .TP
69 \fB\-p \fP\fIsymbol_prefix\fR
70 The
71 .B \-p
72 option changes the prefix prepended to yacc-generated symbols to
73 the string denoted by
74 .IR symbol_prefix.
75 The default prefix is the string
76 .IR yy.
77 .TP
78 .B \-r
79 The
80 .B \-r
81 option causes
82 .B yacc
83 to produce separate files for code and tables.  The code file
84 is named
85 .IR y.code.c,
86 and the tables file is named
87 .IR y.tab.c.
88 .TP
89 .B \-t
90 The
91 .B \-t
92 option changes the preprocessor directives generated by
93 .B yacc
94 so that debugging statements will be incorporated in the compiled code.
95 .TP
96 .B \-v
97 The
98 .B \-v
99 option causes a human-readable description of the generated parser to
100 be written to the file
101 .IR y.output.
102 .TP
103 .B \-V
104 print the version number to the standard output.
105 .RE
106 .SH DIAGNOSTICS
107 If there are rules that are never reduced, the number of such rules is
108 reported on standard error.
109 If there are any LALR(1) conflicts, the number of conflicts is reported
110 on standard error.