|
|
1.1 ! root 1: ! 2: ! 3: yacc Command yacc ! 4: ! 5: ! 6: ! 7: ! 8: Parser generator ! 9: ! 10: yyaacccc [_o_p_t_i_o_n ...] _f_i_l_e ! 11: cccc yy.ttaabb.cc [-llyy] ! 12: ! 13: Many programs process highly structured input according to given ! 14: rules. Compilers are a familiar example. Two of the most com- ! 15: plicated parts of such programs are lexical analysis and parsing ! 16: (sometimes called syntax analysis). The COHERENT system includes ! 17: two powerful tools called lex and yacc to assist you in perfor- ! 18: ming these tasks. lex takes a set of lexical rules and writes a ! 19: lexical analyzer, whereas yacc takes a set of parsing rules and ! 20: writes a parser; both output C source code that can be compiled ! 21: into a full program. ! 22: ! 23: The term yacc is an acronym for ``yet another compiler-com- ! 24: piler''. In brief, the yacc input file describes a context free ! 25: grammar using a BNF-like syntax. The output is a file y.tab.c; ! 26: it contains the definition of a C function yyparse(), which par- ! 27: ses the language described in file. The output is ready for ! 28: processing by the C compiler cc. Ambiguities in the grammar are ! 29: reported to the user, but resolved automatically by precedence ! 30: rules. The user must provide a lexical scanner yylex(), which ! 31: you may generate with lex. The yacc library includes default ! 32: definitions of main, yylex, and yyerror, and may be included with ! 33: the option -ly on the cc command line. ! 34: ! 35: yacc recognizes the following options: ! 36: ! 37: -dd Enable debugging output; implies -v. ! 38: ! 39: -hhddrr _h_e_a_d_e_r_f_i_l_e ! 40: Put the header output in headerfile instead of y.tab.h. ! 41: ! 42: -ll _l_i_s_t_f_i_l_e ! 43: Place a description of the state machine, tokens, parsing ! 44: actions, and statistics in file listfile. ! 45: ! 46: -sstt Print statistics on the standard output. ! 47: ! 48: -vv Verbose option. Like -l, but places the listing in file ! 49: y.output by default. ! 50: ! 51: The following options are useful if table overflow messages ap- ! 52: pear: ! 53: ! 54: -nntteerrmmss _N ! 55: Allow for _N nonterminals; default, 100. ! 56: ! 57: -pprrooddss _N ! 58: Allow for _N productions (rules); default, 175. ! 59: ! 60: -ssttaatteess _N ! 61: Allow for _N states; default, 300. ! 62: ! 63: ! 64: COHERENT Lexicon Page 1 ! 65: ! 66: ! 67: ! 68: ! 69: yacc Command yacc ! 70: ! 71: ! 72: ! 73: ! 74: -tteerrmmss _N ! 75: Allow for _N terminal symbols; default 100. ! 76: ! 77: -ttyyppeess _N ! 78: Allow for _N types; default, ten. ! 79: ! 80: ***** Files ***** ! 81: ! 82: yy.ttaabb.cc -- C source output ! 83: yy.ttaabb.hh -- Default C header output ! 84: yy.oouuttppuutt -- Default listing output ! 85: /lliibb/yyyyppaarrssee.cc -- Protoparser ! 86: /ttmmpp/yy[aaoo]* -- Temporaries ! 87: /uussrr/iinncclluuddee/aaccttiioonn.hh -- Header referenced by protoparser ! 88: /uussrr/lliibb/lliibbyy.aa -- Library ! 89: ! 90: ***** See Also ***** ! 91: ! 92: cc, commands, lex ! 93: _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 ! 94: 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) ! 95: _l_o_o_k_a_h_e_a_d _s_e_t_s. SIGPLAN conference, 1979. ! 96: ! 97: ***** Diagnostics ***** ! 98: ! 99: yacc reports the number of R/R (reduce/reduce) and S/R ! 100: (shift/reduce) conflicts (ambiguities) on the standard error ! 101: stream. ! 102: ! 103: ! 104: ! 105: ! 106: ! 107: ! 108: ! 109: ! 110: ! 111: ! 112: ! 113: ! 114: ! 115: ! 116: ! 117: ! 118: ! 119: ! 120: ! 121: ! 122: ! 123: ! 124: ! 125: ! 126: ! 127: ! 128: ! 129: ! 130: COHERENT Lexicon Page 2 ! 131: ! 132:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.