|
|
coherent
yacc Command yacc
Parser generator
yyaacccc [_o_p_t_i_o_n ...] _f_i_l_e
cccc yy.ttaabb.cc [-llyy]
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:
-dd Enable debugging output; implies -v.
-hhddrr _h_e_a_d_e_r_f_i_l_e
Put the header output in headerfile instead of y.tab.h.
-ll _l_i_s_t_f_i_l_e
Place a description of the state machine, tokens, parsing
actions, and statistics in file listfile.
-sstt Print statistics on the standard output.
-vv 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:
-nntteerrmmss _N
Allow for _N nonterminals; default, 100.
-pprrooddss _N
Allow for _N productions (rules); default, 175.
-ssttaatteess _N
Allow for _N states; default, 300.
COHERENT Lexicon Page 1
yacc Command yacc
-tteerrmmss _N
Allow for _N terminal symbols; default 100.
-ttyyppeess _N
Allow for _N types; default, ten.
***** Files *****
yy.ttaabb.cc -- C source output
yy.ttaabb.hh -- Default C header output
yy.oouuttppuutt -- Default listing output
/lliibb/yyyyppaarrssee.cc -- Protoparser
/ttmmpp/yy[aaoo]* -- Temporaries
/uussrr/iinncclluuddee/aaccttiioonn.hh -- Header referenced by protoparser
/uussrr/lliibb/lliibbyy.aa -- 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
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.