[BACK]Return to yacc.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / yacc

Annotation of src/usr.bin/yacc/yacc.1, Revision 1.32

1.32    ! tedu        1: .\"    $OpenBSD: yacc.1,v 1.31 2015/09/09 21:23:31 schwarze Exp $
1.10      aaron       2: .\"
1.1       deraadt     3: .\" Copyright (c) 1989, 1990 The Regents of the University of California.
                      4: .\" All rights reserved.
                      5: .\"
                      6: .\" This code is derived from software contributed to Berkeley by
                      7: .\" Robert Paul Corbett.
                      8: .\"
                      9: .\" Redistribution and use in source and binary forms, with or without
                     10: .\" modification, are permitted provided that the following conditions
                     11: .\" are met:
                     12: .\" 1. Redistributions of source code must retain the above copyright
                     13: .\"    notice, this list of conditions and the following disclaimer.
                     14: .\" 2. Redistributions in binary form must reproduce the above copyright
                     15: .\"    notice, this list of conditions and the following disclaimer in the
                     16: .\"    documentation and/or other materials provided with the distribution.
1.15      millert    17: .\" 3. Neither the name of the University nor the names of its contributors
1.1       deraadt    18: .\"    may be used to endorse or promote products derived from this software
                     19: .\"    without specific prior written permission.
                     20: .\"
                     21: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
                     22: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
                     23: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
                     24: .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
                     25: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
                     26: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
                     27: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
                     28: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
                     29: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
                     30: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
                     31: .\" SUCH DAMAGE.
                     32: .\"
                     33: .\"    from: @(#)yacc.1        5.7 (Berkeley) 7/30/91
                     34: .\"
1.32    ! tedu       35: .Dd $Mdocdate: September 9 2015 $
1.1       deraadt    36: .Dt YACC 1
                     37: .Os
                     38: .Sh NAME
                     39: .Nm yacc
1.31      schwarze   40: .Nd an LALR(1) parser generator
1.1       deraadt    41: .Sh SYNOPSIS
                     42: .Nm yacc
                     43: .Op Fl dlrtv
1.20      sobrado    44: .Op Fl b Ar file_prefix
1.5       aaron      45: .Op Fl o Ar output_file
1.2       deraadt    46: .Op Fl p Ar symbol_prefix
1.20      sobrado    47: .Ar file
1.1       deraadt    48: .Sh DESCRIPTION
1.10      aaron      49: .Nm
1.20      sobrado    50: reads the grammar specification in
                     51: .Ar file
1.31      schwarze   52: and generates an LR(1) parser for it.
                     53: The parsers consist of a set of LALR(1)
1.1       deraadt    54: parsing tables and a driver routine
                     55: written in the C programming language.
1.10      aaron      56: .Nm
1.1       deraadt    57: normally writes the parse tables and the driver routine to the file
                     58: .Pa y.tab.c .
                     59: .Pp
1.9       aaron      60: The options are as follows:
1.13      aaron      61: .Bl -tag -width Ds
1.20      sobrado    62: .It Fl b Ar file_prefix
1.1       deraadt    63: The
                     64: .Fl b
                     65: option changes the prefix prepended to the output file names to
                     66: the string denoted by
1.20      sobrado    67: .Ar file_prefix .
1.1       deraadt    68: The default prefix is the character
                     69: .Ar y .
                     70: .It Fl d
                     71: The
                     72: .Fl d
                     73: option causes the header file
                     74: .Pa y.tab.h
                     75: to be written.
                     76: .It Fl l
                     77: If the
                     78: .Fl l
                     79: option is not specified,
1.10      aaron      80: .Nm
1.1       deraadt    81: will insert #line directives in the generated code.
                     82: The #line directives let the C compiler relate errors in the
                     83: generated code to the user's original code.
                     84: If the
                     85: .Fl l
                     86: option is specified,
1.10      aaron      87: .Nm
1.1       deraadt    88: will not insert the #line directives.
                     89: #line directives specified by the user will be retained.
1.5       aaron      90: .It Fl o Ar output_file
                     91: The
                     92: .Fl o
1.8       aaron      93: option specifies an explicit name for the parser's output file name instead
1.11      aaron      94: of the default.
                     95: The names of the other output files are constructed from
1.8       aaron      96: .Pa output_file
                     97: as described under the
                     98: .Fl d
                     99: and
                    100: .Fl v
                    101: options.
1.2       deraadt   102: .It Fl p Ar symbol_prefix
                    103: The
                    104: .Fl p
                    105: option changes the prefix prepended to yacc-generated symbols to
                    106: the string denoted by
                    107: .Ar symbol_prefix .
                    108: The default prefix is the string
                    109: .Ar yy .
1.1       deraadt   110: .It Fl r
                    111: The
                    112: .Fl r
                    113: option causes
1.10      aaron     114: .Nm
1.1       deraadt   115: to produce separate files for code and tables.
                    116: The code file is named
                    117: .Pa y.code.c ,
                    118: and the tables file is named
                    119: .Pa y.tab.c .
                    120: .It Fl t
                    121: The
                    122: .Fl t
                    123: option changes the preprocessor directives generated by
1.10      aaron     124: .Nm
1.1       deraadt   125: so that debugging statements will be incorporated in the compiled code.
                    126: .It Fl v
                    127: The
                    128: .Fl v
                    129: option causes a human-readable description of the generated parser to
                    130: be written to the file
                    131: .Pa y.output .
1.12      aaron     132: .El
1.1       deraadt   133: .Sh TABLES
                    134: The names of the tables generated by this version of
1.10      aaron     135: .Nm
1.1       deraadt   136: are
                    137: .Dq yylhs ,
                    138: .Dq yylen ,
                    139: .Dq yydefred ,
                    140: .Dq yydgoto ,
                    141: .Dq yysindex ,
                    142: .Dq yyrindex ,
                    143: .Dq yygindex ,
                    144: .Dq yytable ,
                    145: and
                    146: .Dq yycheck .
                    147: Two additional tables,
                    148: .Dq yyname
                    149: and
                    150: .Dq yyrule ,
                    151: are created if
                    152: .Dv YYDEBUG
                    153: is defined and non-zero.
                    154: .Sh FILES
1.7       millert   155: .Bl -tag -width /tmp/yacc.uXXXXXXXXXX -compact
1.1       deraadt   156: .It Pa y.code.c
                    157: .It Pa y.tab.c
                    158: .It Pa y.tab.h
                    159: .It Pa y.output
1.7       millert   160: .It Pa /tmp/yacc.aXXXXXXXXXX
                    161: .It Pa /tmp/yacc.tXXXXXXXXXX
                    162: .It Pa /tmp/yacc.uXXXXXXXXXX
1.1       deraadt   163: .El
1.25      jmc       164: .Sh EXIT STATUS
                    165: .Ex -std yacc
1.16      jmc       166: .Sh DIAGNOSTICS
                    167: If there are rules that are never reduced, the number of such rules is
                    168: written to the standard error.
1.31      schwarze  169: If there are any LALR(1)
1.16      jmc       170: conflicts, the number of conflicts is also written
                    171: to the standard error.
1.7       millert   172: .Sh SEE ALSO
                    173: .Xr yyfix 1
1.27      jmc       174: .Rs
                    175: .%A F. DeRemer
                    176: .%A T. J. Pennello
                    177: .%D 1982
                    178: .%J TOPLAS
1.28      jmc       179: .%N Issue 4
                    180: .%P pp. 615\(en649
1.27      jmc       181: .%T Efficient Computation of LALR(1) Look-Ahead Sets
1.28      jmc       182: .%V Volume 4
1.27      jmc       183: .Re
1.1       deraadt   184: .Sh STANDARDS
                    185: The
1.10      aaron     186: .Nm
1.18      jmc       187: utility is compliant with the
1.21      jmc       188: .St -p1003.1-2008
1.22      jmc       189: specification,
                    190: though its presence is optional.
1.18      jmc       191: .Pp
                    192: The flags
1.32    ! tedu      193: .Op Fl or
1.18      jmc       194: are extensions to that specification.
1.23      jmc       195: .Sh HISTORY
1.29      schwarze  196: .Nm
                    197: was originally developed at AT&T by
                    198: .An Stephen C. Johnson .
1.24      jmc       199: .Pp
1.29      schwarze  200: Berkeley
                    201: .Nm
                    202: was originally developed using PCC on a VAX with the
                    203: intent of being as compatible as possible with
                    204: .At
                    205: .Nm .
1.23      jmc       206: Much is owed to the unflagging efforts of Keith Bostic.
1.29      schwarze  207: His badgering kept me working on
                    208: .Nm
                    209: long after I was ready to quit.
1.23      jmc       210: .Pp
1.29      schwarze  211: Berkeley
                    212: .Nm
                    213: is based on the excellent algorithm for computing
                    214: LALR(1) lookaheads developed by
                    215: .An Tom Pennello
                    216: and
                    217: .An Frank DeRemer .
1.23      jmc       218: The algorithm is described in their almost impenetrable article in
1.28      jmc       219: TOPLAS (see above).
1.23      jmc       220: .Pp
                    221: Finally, much credit must go to those who pointed out deficiencies
                    222: of earlier releases.
                    223: Among the most prolific contributors were
                    224: Benson I. Margulies,
                    225: Dave Gentzel,
                    226: Antoine Verheijen,
                    227: Peter S. Housel,
                    228: Dale Smith,
                    229: Ozan Yigit,
                    230: John Campbell,
                    231: Bill Sommerfeld,
                    232: Paul Hilfinger,
                    233: Gary Bridgewater,
                    234: Dave Bakken,
                    235: Dan Lanciani,
                    236: Richard Sargent,
                    237: and
                    238: Parag Patel.
                    239: .Sh AUTHORS
                    240: The
                    241: .Nm
                    242: utility was written by
                    243: .An Robert Corbett .