manpagez: man pages & more
info bison
Home | html | info | man
[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9 Invoking Bison

The usual way to invoke Bison is as follows:

bison infile

Here infile is the grammar file name, which usually ends in ‘.y’. The parser implementation file’s name is made by replacing the ‘.y’ with ‘.tab.c’ and removing any leading directory. Thus, the ‘bison foo.y’ file name yields ‘foo.tab.c’, and the ‘bison hack/foo.y’ file name yields ‘foo.tab.c’. It’s also possible, in case you are writing C++ code instead of C in your grammar file, to name it ‘foo.ypp’ or ‘foo.y++’. Then, the output files will take an extension like the given one as input (respectively ‘foo.tab.cpp’ and ‘foo.tab.c++’). This feature takes effect with all options that manipulate file names like ‘-o’ or ‘-d’.

For example :

bison -d infile.yxx

will produce ‘infile.tab.cxx’ and ‘infile.tab.hxx’, and

bison -d -o output.c++ infile.y

will produce ‘output.c++’ and ‘outfile.h++’.

For compatibility with POSIX, the standard Bison distribution also contains a shell script called yacc that invokes Bison with the ‘-y’ option.


[ << ] [ < ] [ Up ] [ > ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated on December 1, 2013 using texi2html 5.0.

© manpagez.com 2000-2017
Individual documents may contain additional copyright information.