

yacc                         Command                         yacc




Parser generator

yyaacccc [_o_p_t_i_o_n ...] _f_i_l_e
cccc yy.ttaabb.cc [-llyy]

Many programs process  highly structured input according to given
rules.  Compilers  are a familiar example.  Two  of the most com-
plicated parts of  such programs are lexical analysis and parsing
(sometimes called syntax analysis).  The COHERENT system includes
two powerful  tools called lex and yacc to  assist you in perfor-
ming these tasks.  lex takes a  set of lexical rules and writes a
lexical analyzer,  whereas yacc takes a set  of parsing rules and
writes a  parser; both output C source code  that can be compiled
into a full program.

The  term yacc  is  an acronym  for  ``yet another  compiler-com-
piler''.  In brief, the  yacc input file describes a context free
grammar using  a BNF-like syntax.  The output  is a file y.tab.c;
it contains the definition  of a C function yyparse(), which par-
ses  the language  described in  file.  The  output is  ready for
processing by the C  compiler cc.  Ambiguities in the grammar are
reported to  the user,  but resolved automatically  by precedence
rules.  The  user must provide  a lexical scanner  yylex(), which
you  may generate  with lex.  The  yacc library  includes default
definitions of main, yylex, and yyerror, and may be included with
the option -ly on the cc command line.

yacc recognizes the following options:

-dd   Enable debugging output; implies -v.

-hhddrr _h_e_a_d_e_r_f_i_l_e
     Put the header output in headerfile instead of y.tab.h.

-ll _l_i_s_t_f_i_l_e
     Place a  description of  the state machine,  tokens, parsing
     actions, and statistics in file listfile.

-sstt  Print statistics on the standard output.

-vv   Verbose  option.  Like  -l, but  places the listing  in file
     y.output by default.

The following  options are useful if  table overflow messages ap-
pear:

-nntteerrmmss _N
     Allow for _N nonterminals; default, 100.

-pprrooddss _N
     Allow for _N productions (rules); default, 175.

-ssttaatteess _N
     Allow for _N states; default, 300.


COHERENT Lexicon                                           Page 1




yacc                         Command                         yacc




-tteerrmmss _N
     Allow for _N terminal symbols; default 100.

-ttyyppeess _N
     Allow for _N types; default, ten.

***** Files *****

yy.ttaabb.cc -- C source output
yy.ttaabb.hh -- Default C header output
yy.oouuttppuutt -- Default listing output
/lliibb/yyyyppaarrssee.cc -- Protoparser
/ttmmpp/yy[aaoo]* -- Temporaries
/uussrr/iinncclluuddee/aaccttiioonn.hh -- Header referenced by protoparser
/uussrr/lliibb/lliibbyy.aa -- Library

***** See Also *****

cc, commands, lex
_I_n_t_r_o_d_u_c_t_i_o_n _t_o _y_a_c_c, _Y_e_t _A_n_o_t_h_e_r _C_o_m_p_i_l_e_r-_C_o_m_p_i_l_e_r
DeRemer  F,   Pennello  TJ:  _E_f_f_i_c_i_e_n_t   _c_o_m_p_u_t_a_t_i_o_n  _o_f  _L_A_L_R(_1)
_l_o_o_k_a_h_e_a_d _s_e_t_s. SIGPLAN conference, 1979.

***** Diagnostics *****

yacc  reports   the  number   of  R/R  (reduce/reduce)   and  S/R
(shift/reduce)  conflicts  (ambiguities)  on the  standard  error
stream.




























COHERENT Lexicon                                           Page 2


