[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.22

1.22    ! jmc         1: .\"    $OpenBSD: yacc.1,v 1.21 2009/02/08 17:15:10 jmc 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.22    ! jmc        35: .Dd $Mdocdate: February 8 2009 $
1.1       deraadt    36: .Dt YACC 1
                     37: .Os
                     38: .Sh NAME
                     39: .Nm yacc
                     40: .Nd an
                     41: .Tn LALR(1)
                     42: parser generator
                     43: .Sh SYNOPSIS
                     44: .Nm yacc
                     45: .Op Fl dlrtv
1.20      sobrado    46: .Op Fl b Ar file_prefix
1.5       aaron      47: .Op Fl o Ar output_file
1.2       deraadt    48: .Op Fl p Ar symbol_prefix
1.20      sobrado    49: .Ar file
1.1       deraadt    50: .Sh DESCRIPTION
1.10      aaron      51: .Nm
1.20      sobrado    52: reads the grammar specification in
                     53: .Ar file
1.1       deraadt    54: and generates an
                     55: .Tn LR(1)
                     56: parser for it.
                     57: The parsers consist of a set of
                     58: .Tn LALR(1)
                     59: parsing tables and a driver routine
                     60: written in the C programming language.
1.10      aaron      61: .Nm
1.1       deraadt    62: normally writes the parse tables and the driver routine to the file
                     63: .Pa y.tab.c .
                     64: .Pp
1.9       aaron      65: The options are as follows:
1.13      aaron      66: .Bl -tag -width Ds
1.20      sobrado    67: .It Fl b Ar file_prefix
1.1       deraadt    68: The
                     69: .Fl b
                     70: option changes the prefix prepended to the output file names to
                     71: the string denoted by
1.20      sobrado    72: .Ar file_prefix .
1.1       deraadt    73: The default prefix is the character
                     74: .Ar y .
                     75: .It Fl d
                     76: The
                     77: .Fl d
                     78: option causes the header file
                     79: .Pa y.tab.h
                     80: to be written.
                     81: .It Fl l
                     82: If the
                     83: .Fl l
                     84: option is not specified,
1.10      aaron      85: .Nm
1.1       deraadt    86: will insert #line directives in the generated code.
                     87: The #line directives let the C compiler relate errors in the
                     88: generated code to the user's original code.
                     89: If the
                     90: .Fl l
                     91: option is specified,
1.10      aaron      92: .Nm
1.1       deraadt    93: will not insert the #line directives.
                     94: #line directives specified by the user will be retained.
1.5       aaron      95: .It Fl o Ar output_file
                     96: The
                     97: .Fl o
1.8       aaron      98: option specifies an explicit name for the parser's output file name instead
1.11      aaron      99: of the default.
                    100: The names of the other output files are constructed from
1.8       aaron     101: .Pa output_file
                    102: as described under the
                    103: .Fl d
                    104: and
                    105: .Fl v
                    106: options.
1.2       deraadt   107: .It Fl p Ar symbol_prefix
                    108: The
                    109: .Fl p
                    110: option changes the prefix prepended to yacc-generated symbols to
                    111: the string denoted by
                    112: .Ar symbol_prefix .
                    113: The default prefix is the string
                    114: .Ar yy .
1.1       deraadt   115: .It Fl r
                    116: The
                    117: .Fl r
                    118: option causes
1.10      aaron     119: .Nm
1.1       deraadt   120: to produce separate files for code and tables.
                    121: The code file is named
                    122: .Pa y.code.c ,
                    123: and the tables file is named
                    124: .Pa y.tab.c .
                    125: .It Fl t
                    126: The
                    127: .Fl t
                    128: option changes the preprocessor directives generated by
1.10      aaron     129: .Nm
1.1       deraadt   130: so that debugging statements will be incorporated in the compiled code.
                    131: .It Fl v
                    132: The
                    133: .Fl v
                    134: option causes a human-readable description of the generated parser to
                    135: be written to the file
                    136: .Pa y.output .
1.12      aaron     137: .El
1.1       deraadt   138: .Sh ENVIRONMENT
                    139: .Bl -tag -width TMPDIR
                    140: .It Ev TMPDIR
1.10      aaron     141: Name of directory where temporary files are to be created.
1.1       deraadt   142: .El
                    143: .Sh TABLES
                    144: The names of the tables generated by this version of
1.10      aaron     145: .Nm
1.1       deraadt   146: are
                    147: .Dq yylhs ,
                    148: .Dq yylen ,
                    149: .Dq yydefred ,
                    150: .Dq yydgoto ,
                    151: .Dq yysindex ,
                    152: .Dq yyrindex ,
                    153: .Dq yygindex ,
                    154: .Dq yytable ,
                    155: and
                    156: .Dq yycheck .
                    157: Two additional tables,
                    158: .Dq yyname
                    159: and
                    160: .Dq yyrule ,
                    161: are created if
                    162: .Dv YYDEBUG
                    163: is defined and non-zero.
                    164: .Sh FILES
1.7       millert   165: .Bl -tag -width /tmp/yacc.uXXXXXXXXXX -compact
1.1       deraadt   166: .It Pa y.code.c
                    167: .It Pa y.tab.c
                    168: .It Pa y.tab.h
                    169: .It Pa y.output
1.7       millert   170: .It Pa /tmp/yacc.aXXXXXXXXXX
                    171: .It Pa /tmp/yacc.tXXXXXXXXXX
                    172: .It Pa /tmp/yacc.uXXXXXXXXXX
1.1       deraadt   173: .El
1.16      jmc       174: .Sh DIAGNOSTICS
                    175: If there are rules that are never reduced, the number of such rules is
                    176: written to the standard error.
                    177: If there are any
                    178: .Tn LALR(1)
                    179: conflicts, the number of conflicts is also written
                    180: to the standard error.
1.7       millert   181: .Sh SEE ALSO
                    182: .Xr yyfix 1
1.17      otto      183: .Pp
                    184: "YACC \- Yet Another Compiler-Compiler",
                    185: .Pa /usr/share/doc/psd/15.yacc/ .
1.1       deraadt   186: .Sh STANDARDS
                    187: The
1.10      aaron     188: .Nm
1.18      jmc       189: utility is compliant with the
1.21      jmc       190: .St -p1003.1-2008
1.22    ! jmc       191: specification,
        !           192: though its presence is optional.
1.18      jmc       193: .Pp
                    194: The flags
                    195: .Op Fl or
                    196: are extensions to that specification.