1GraphViz::Parse::Yacc(3U)ser Contributed Perl DocumentatiGornaphViz::Parse::Yacc(3)
2
3
4

NAME

6       GraphViz::Parse::Yacc - Visualise grammars
7

SYNOPSIS

9         use GraphViz::Parse::Yacc;
10
11         # Pass in a file generated via yacc -v
12         my $graph = GraphViz::Parse::Yacc->new('Yacc.output');
13         print $g->as_png;
14

DESCRIPTION

16       This module makes it easy to visualise Parse::Yacc grammars.  Writing
17       Parse::Yacc grammars is tricky at the best of times, and grammars
18       almost always evolve in ways unforseen at the start. This module aims
19       to visualise a grammar as a graph in order to make the structure clear
20       and aid in understanding the grammar.
21
22       Rules are represented as nodes, which have their name on the left of
23       the node and their productions on the right of the node. The subrules
24       present in the productions are represented by edges to the subrule
25       nodes.
26
27       Thus, every node (rule) should be connected to the graph - otherwise a
28       rule is not part of the grammar.
29
30       This uses the GraphViz module to draw the graph. Thanks to Damian
31       Conway for the original idea.
32

METHODS

34   new
35       This is the constructor. It takes one mandatory argument, which is a
36       filename of the output file generated by running "yacc -v " on the
37       grammar file. For example, if your Parse::Yacc grammar file is called
38       "calc.yp", you would run "yacc -v calc.y" and pass in "calc.output" as
39       an argument here. A GraphViz object is returned.
40
41         # Pass in a file generated via yacc -v
42         my $graph = GraphViz::Parse::Yacc->new('Yacc.output');
43         print $g->as_png;
44
45   as_*
46       The grammar can be visualised in a number of different graphical
47       formats. Methods include as_ps, as_hpgl, as_pcl, as_mif, as_pic, as_gd,
48       as_gd2, as_gif, as_jpeg, as_png, as_wbmp, as_ismap, as_imap, as_vrml,
49       as_vtx, as_mp, as_fig, as_svg. See the GraphViz documentation for more
50       information. The two most common methods are:
51
52         # Print out a PNG-format file
53         print $g->as_png;
54
55         # Print out a PostScript-format file
56         print $g->as_ps;
57

AUTHOR

59       Leon Brocard <acme@astray.com>
60
62       Copyright (C) 2001, Leon Brocard
63
64       This module is free software; you can redistribute it or modify it
65       under the Perl License, a copy of which is available at
66       <http://dev.perl.org/licenses/>.
67
68
69
70perl v5.30.0                      2019-07-26          GraphViz::Parse::Yacc(3)
Impressum