Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint

6.5. C++ Parsers

Bison can produce a C++ parsers. If your bison file is called comp.yxx, it will create the C++ source comp.tab.cxx and header comp.tab.hxx files. (You can change the output filenames with the -o flag, perhaps as -o comp.c++, which will also rename the header to comp.h++.) It also creates the header files stack.hh, location.hh, and position.hh, which define three classes used in the parser. The contents of these three files are always the same unless you use -p or %name-prefix to change the namespace of the parser from “yy” to something else.

Bison defines a class called yy::parser (unless you change its name) with a main parse routine and some minor routines for error reporting and debugging. See Section 9.3 for more details.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial