Commit | Line | Data |
---|---|---|
cd63924f | 1 | .\" @(#)yacc.1 6.1 (Berkeley) %G% |
f1af6e88 | 2 | .\" |
cd63924f | 3 | .TH YACC 1 "" |
f1af6e88 KM |
4 | .AT 3 |
5 | .SH NAME | |
6 | yacc \- yet another compiler-compiler | |
7 | .SH SYNOPSIS | |
8 | .B yacc | |
9 | [ | |
10 | .B \-vd | |
11 | ] | |
12 | grammar | |
13 | .SH DESCRIPTION | |
14 | .I Yacc | |
15 | converts a context-free grammar into a set of | |
16 | tables for a simple automaton which executes an LR(1) parsing | |
17 | algorithm. | |
18 | The grammar may be ambiguous; | |
19 | specified precedence rules are used to break ambiguities. | |
20 | .PP | |
21 | The output file, | |
22 | .IR y.tab.c , | |
23 | must be compiled by the C compiler | |
24 | to produce a program | |
25 | .IR yyparse . | |
26 | This program must be loaded with the lexical analyzer program, | |
27 | .IR yylex , | |
28 | as well as | |
29 | .I main | |
30 | and | |
31 | .IR yyerror , | |
32 | an error handling routine. | |
33 | These routines must be supplied by the user; | |
34 | .IR Lex (1) | |
35 | is useful for creating lexical analyzers usable by | |
36 | .IR yacc . | |
37 | .PP | |
38 | If the | |
39 | .B \-v | |
40 | flag is given, the file | |
41 | .I y.output | |
42 | is prepared, which contains a description of the parsing tables | |
43 | and a report on | |
44 | conflicts generated by ambiguities in the grammar. | |
45 | .PP | |
46 | If the \-\fBd\fR flag is used, the file | |
47 | .I y.tab.h | |
48 | is generated with the | |
49 | .I define | |
50 | statements that associate the | |
51 | .I yacc\c | |
52 | -assigned `token codes' with the user-declared `token names'. | |
53 | This allows source files other than | |
54 | .I y.tab.c | |
55 | to access the token codes. | |
56 | .SH FILES | |
57 | .ta \w'yacc.tmp, yacc.acts 'u | |
58 | y.output | |
59 | .br | |
60 | y.tab.c | |
61 | .br | |
62 | y.tab.h defines for token names | |
63 | .br | |
64 | yacc.tmp, yacc.acts temporary files | |
65 | .br | |
66 | /usr/lib/yaccpar parser prototype for C programs | |
67 | .SH "SEE ALSO" | |
68 | .IR lex (1) | |
69 | .br | |
70 | .I "LR Parsing" | |
71 | by A. V. Aho and S. C. Johnson, | |
72 | Computing Surveys, June, 1974. | |
73 | .br | |
74 | .I "YACC \- Yet Another Compiler Compiler" | |
75 | by S. C. Johnson. | |
76 | .SH DIAGNOSTICS | |
77 | The number of reduce-reduce and shift-reduce conflicts | |
78 | is reported on the standard output; | |
79 | a more detailed report is | |
80 | found in the | |
81 | .I y.output | |
82 | file. | |
83 | Similarly, if some rules are not reachable from the | |
84 | start symbol, this is also reported. | |
85 | .SH BUGS | |
86 | Because file names are fixed, at most one | |
87 | .I yacc | |
88 | process can be active in a given directory at | |
89 | a time. |