Name

yacc

Synopsis

    yacc [options] file
    byacc [options]filename

Given a file containing a context-free LALR(1) grammar, convert it to tables for subsequent parsing and send output to y.tab.c. This command name stands for yet another compiler-compiler. On Solaris yacc is found in /usr/ccs/bin. See also lex, flex, and bison, and lex & yacc, which is listed in the Bibliography.

Mac OS X uses Berkeley Yacc for yacc, which accepts the traditional options as well as -o. GNU/Linux provides Berkeley Yacc under the name byacc.

Common Options

-d

Generate y.tab.h, producing #define statements that relate yacc’s token codes to the token names declared by the user.

-l

Exclude #line constructs from code produced in y.tab.c. (Use after debugging is complete.)

-t

Compile runtime debugging code by default.

-v

Generate y.output, a file containing diagnostics and notes about the parsing tables.

-V

Print the version of yacc on standard error. (May not be in all versions.)

GNU/Linux and Mac OS X Option

-r

Produce separate files for code and tables named y.code.c and y.tab.c, respectively.

Solaris Options

-b prefix

Use prefix instead of y for the generated filenames.

-p prefix

Use prefix instead of yy for all external names in the generated parser.

-P parser

Use parser instead of /usr/ccs/bin/yaccpar.

-Q c

Place version information about yacc in y.tab.c (if c = y) or suppress information (if c = n, the default).

Berkeley Yacc Option

-o filename

Write the generated parser to filename instead of to y.tab.c.

Get Unix in a Nutshell, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.