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

8.3 Visualizing your parser in multiple formats

Bison supports two major report formats: textual output (see section Understanding Your Parser) when invoked with option ‘--verbose’, and DOT (see section Visualizing Your Parser) when invoked with option ‘--graph’. However, another alternative is to output an XML file that may then be, with xsltproc, rendered as either a raw text format equivalent to the verbose file, or as an HTML version of the same file, with clickable transitions, or even as a DOT. The ‘.output’ and DOT files obtained via XSLT have no difference whatsoever with those obtained by invoking bison with options ‘--verbose’ or ‘--graph’.

The XML file is generated when the options ‘-x’ or ‘--xml[=FILE]’ are specified, see Invoking Bison. If not specified, its name is made by removing ‘.tab.c’ or ‘.c’ from the parser implementation file name, and adding ‘.xml’ instead. For instance, if the grammar file is ‘foo.y’, the default XML output file is ‘foo.xml’.

Bison ships with a ‘data/xslt’ directory, containing XSL Transformation files to apply to the XML file. Their names are non-ambiguous:


Used to output a copy of the DOT visualization of the automaton.


Used to output a copy of the ‘.output’ file.


Used to output an xhtml enhancement of the ‘.output’ file.

Sample usage (requires xsltproc):

$ bison -x gr.y
$ bison --print-datadir
$ xsltproc /usr/local/share/bison/xslt/xml2xhtml.xsl gr.xml >gr.html

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

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

© 2000-2022
Individual documents may contain additional copyright information.