Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ yacc(1) — Reliant UNIX 5.44c4

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

lex(1)

yacc(1)                                                             yacc(1)

NAME
     yacc - generate parser

SYNOPSIS
     yacc [option...] file

DESCRIPTION
     The yacc command (yet another compiler-compiler) converts a context-
     free grammar into a set of tables for a simple automaton that executes
     an LALR(1) parsing algorithm. The grammar may be ambiguous; specified
     precedence rules are used to break ambiguities.

     All yacc output files have the default prefix y, all external names
     have the prefix yy. These prefixes can be changed using options (e.g.
     if a number of yacc processes are to run simultaneously in the same
     directory).

     The output file, y.tab.c, must be compiled by the C compiler to pro-
     duce a program yyparse. This program must be loaded with the lexical
     analyzer program, yylex, as well as main and yyerror, an error han-
     dling routine. These routines must be supplied by the user; the lex(1)
     command is useful for creating lexical analyzers usable by yacc.

OPTIONS
     -v   Prepares the file y.output, which contains a description of the
          parsing tables and a report on conflicts generated by ambiguities
          in the grammar.

     -d   Generates the file y.tab.h with the #define statements that asso-
          ciate the yacc-assigned "token codes" with the user-declared
          "token names". This association allows source files other than
          y.tab.c to access the token codes.

     -l   Specifies that the code produced in y.tab.c will not contain any
          #line constructs. This option should only be used after the gram-
          mar and the associated actions are fully debugged, i.e. are free
          of errors.

     -Q[o]
          Specifies whether version information is to be written to y.tab.c

          o stands for a yes/no specification in the language environment
          set. In an English-language environment -Qy should be specified
          to write version information to y.tab.c, and -Qn to suppress
          this. In a German-language environment, for example, -Qj or -Qn
          should be specified.

          By default, no version information is output.

     -i   Permits the direct creation of localized programs.

          If yacc is called with the option -i, calls of the gettxt()



Page 1                       Reliant UNIX 5.44                Printed 11/98

yacc(1)                                                             yacc(1)

          function are written to the yacc-generated part of the file
          created. gettxt() has access to the localized message catalogs
          [see gettxt(3C)].

     -t   Compiles runtime debugging code by default. Runtime debugging
          code is always generated in y.tab.c under conditional compilation
          control. By default, this code is not included when y.tab.c is
          compiled. Whether or not the -t option is used, the runtime
          debugging code is under the control of YYDEBUG, a preprocessor
          symbol. If YYDEBUG has a nonzero value, then the debugging code
          is included. If its value is zero, then the code will not be
          included. The size and execution time of a program produced
          without the runtime debugging code will be smaller or shorter.

     -b file prefix
          Uses the prefix file prefix instead of y for the output files
          (e.g. file prefix.tab.c).

     -p symbol prefix
          Uses the prefix symbol prefix instead of yy for external names
          (e.g. symbol prefixparse).

     -V   Prints on the standard error output the version information for
          yacc.

     --   If the first filename begins with a dash (-), the end of the
          command-line options must be marked with --.

DIAGNOSTICS
     The number of reduce-reduce and shift-reduce conflicts is reported on
     the standard error output; a more detailed report is found in the
     y.output file. Similarly, if some rules are not reachable from the
     start symbol, this instance is also reported.





















Page 2                       Reliant UNIX 5.44                Printed 11/98

yacc(1)                                                             yacc(1)

LOCALE
     The language of the message texts and yes/no specifications is
     governed by the environment variable LCALL, LCMESSAGES or LANG.

     When the default is set, the system behaves as if it were not interna-
     tionalized, i.e. the message texts are in English and yes/no specifi-
     cations must also be made in English (y or n). You must change one of
     these variables in order to change the language of the message texts.

     The environment variable LCCTYPE determines which characters are
     defined as letters and digits in the currently valid environment. This
     is important for symbol names.

     If variable LCCTYPE has the value DeDE.646, the vertical bar | and
     the opening brace {, for example, are interpreted as letters (their
     code corresponds to the umlauts ö and ä in the German variant of the
     ISO 646 character set). This means that yacc can no longer interpret
     the grammar correctly. In this case, the variable LCCTYPE must be set
     to EnUS.ASCII or an empty string must be allocated to the LANG vari-
     able and, if appropriate, also to the LCCTYPE variable.

     Detailed information on the dependencies of the environment variables
     and on internationalization in general can be found in the manual
     "Programmer's Guide: Internationalization - Localization". Refer also
     to environ(5) for information on setting the user environment.

FILES
     y.output, y.tab.c, y.tab.h
          definitions of token names

     yacc.tmp, yacc.debug, yacc.acts
          temporary files

     LIBDIR/yaccpar
          prototype parser for C programs

     LIBDIR
          usually /usr/ccs/lib

SEE ALSO
     lex(1).

     The "yacc" chapter in the "Guide to Tools for Programming in C".











Page 3                       Reliant UNIX 5.44                Printed 11/98

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026