/sys/doc/ Documentation archive

YACC(I)                      11/25/74                     YACC(I)

     yacc - yet another compiler-compiler

     yacc [ -vor ] [ grammar ]

     Yacc  converts  a  context-free grammar into a set of tables
     for a simple automaton which executes an LR(1) parsing algo-
     rithm.   The  grammar may be ambiguous; specified precedence
     rules are used to break ambiguities.

     The output is y.tab.c, which must be compiled by the C  com-
     piler and loaded with any other routines required (perhaps a
     lexical analyzer) and the Yacc library:

          cc y.tab.c other.o -ly

     If the -v flag is given,  the  file  y.output  is  prepared,
     which contains a description of the parsing tables and a re-
     port on conflicts generated by ambiguities in the grammar.

     The -o flag calls an optimizer for the tables; the optimized
     tables, with parser included, appear on file y.tab.c

     The  -r  flag causes Yacc to accept grammars with Ratfor ac-
     tions, and produce Ratfor output on y.tab.r; -r implies  the
     -o flag.  Typical usage is then

          rc y.tab.r other.o

     ``LR  Parsing'',  by  A. V. Aho and S. C. Johnson, Computing
     Surveys, June, 1974.  ``The YACC Compiler-compiler'', inter-
     nal memorandum.

     S. C. Johnson

     y.tab.r             when ratfor output is obtained
     yacc.tmp       when optimizer is called
     /lib/liby.a         runtime library for compiler
     /usr/yacc/fpar.r    ratfor parser
     /usr/yacc/opar.c    parser for optimized tables
     /usr/yacc/yopti          optimizer postpass

     The  number  of  reduce-reduce and shift-reduce conflicts is
     reported on the standard output; a more detailed  report  is
     found in the y.output file.

                              - 1 -

YACC(I)                      11/25/74                     YACC(I)

     Because  file  names are fixed, at most one Yacc process can
     be active in a given directory at a time.

                              - 2 -