YACC(1,C) AIX Commands Reference YACC(1,C) ------------------------------------------------------------------------------- yacc PURPOSE Generates an LR parsing program from input consisting of a context-free grammar specification. SYNTAX +-----------+ yacc ---| +-------+ |-- grammar --| +-| -v -d |-+ ^| -l -s || || -t || |+-------+| +---------+ DESCRIPTION The yacc command converts a context-free grammar into a set of tables for a simple automaton that executes an LR(1) parsing algorithm. The grammar can be ambiguous; specified precedence rules are used to break ambiguities. You must compile the output file, y.tab.c, with a C Language compiler to produce a function yyparse. This function must be loaded with the lexical analyzer function yylex, as well as main and yyerror, an error-handling routine (you must provide these routines). The lex command is useful for creating lexical analyzers usable by yacc. For more detailed discussion of yacc and its operations, see AIX Operating System Programming Tools and Interfaces. FLAGS -d Produces the file y.tab.h. This contains the #define statements that associate the yacc-assigned token codes with your token names. This allows source files other than y.tab.c to access the token codes by including this header file. -l Does not include any #line constructs in y.tab.c. Use this only after the grammar and associated actions are fully debugged. -s Breaks the yyparse function into several smaller functions. Since its size is somewhat proportional to that of the grammar, it is possible for yyparse to become too large to compile, optimize, or execute efficiently. Processed November 8, 1990 YACC(1,C) 1 YACC(1,C) AIX Commands Reference YACC(1,C) -t Compiles run-time debugging code. By default, this code is not included when y.tab.c is compiled. However, the run-time debugging code is under the control of YYDEBUG, a global variable for the cc command preprocessor. If YYDEBUG has a nonzero value, the C compiler (cc) includes the debugging code, whether the -t flag was used. Without compiling this code, yyparse has a faster operating speed. -v Prepares the file y.output. It contains a readable description of the parsing tables and a report on conflicts generated by grammar ambiguities. FILES y.output y.tab.c y.tab.h Definitions for token names. yacc.tmp, yacc.debug Temporary file. yacc.acts Temporary file. /usr/lib/yaccpar Parser prototype for C programs. RELATED INFORMATION See the following command: "lex." See the description of yacc in AIX Operating System Programming Tools and Interfaces. Processed November 8, 1990 YACC(1,C) 2