1GraphViz2::Parse::Yacc(U3s)er Contributed Perl DocumentatGiroanphViz2::Parse::Yacc(3)
2
3
4
6 GraphViz2::Parse::Yacc - Visualize a yacc grammar as a graph
7
9 #!/usr/bin/env perl
10
11 use strict;
12 use warnings;
13
14 use File::Spec;
15
16 use GraphViz2;
17 use GraphViz2::Parse::Yacc;
18
19 use Log::Handler;
20
21 # ------------------------------------------------
22
23 my($logger) = Log::Handler -> new;
24
25 $logger -> add
26 (
27 screen =>
28 {
29 maxlevel => 'debug',
30 message_layout => '%m',
31 minlevel => 'error',
32 }
33 );
34
35 my($graph) = GraphViz2 -> new
36 (
37 edge => {color => 'grey'},
38 global => {directed => 1},
39 graph => {concentrate => 1, rankdir => 'TB'},
40 logger => $logger,
41 node => {color => 'blue', shape => 'oval'},
42 );
43 my($g) = GraphViz2::Parse::Yacc -> new(graph => $graph);
44
45 $g -> create(file_name => File::Spec -> catfile('t', 'calc3.output') );
46
47 my($format) = shift || 'svg';
48 my($output_file) = shift || File::Spec -> catfile('html', "parse.yacc.$format");
49
50 $graph -> run(format => $format, output_file => $output_file);
51
52 See scripts/parse.yacc.pl ("Scripts Shipped with this Module" in
53 GraphViz2).
54
56 Takes a yacc grammar and converts it into a graph.
57
58 You can write the result in any format supported by Graphviz
59 <http://www.graphviz.org/>.
60
61 Here is the list of output formats
62 <http://www.graphviz.org/content/output-formats>.
63
65 This module is available as a Unix-style distro (*.tgz).
66
67 See <http://savage.net.au/Perl-modules/html/installing-a-module.html>
68 for help on unpacking and installing distros.
69
71 Install GraphViz2 as you would for any "Perl" module:
72
73 Run:
74
75 cpanm GraphViz2
76
77 or run:
78
79 sudo cpan GraphViz2
80
81 or unpack the distro, and then either:
82
83 perl Build.PL
84 ./Build
85 ./Build test
86 sudo ./Build install
87
88 or:
89
90 perl Makefile.PL
91 make (or dmake or nmake)
92 make test
93 make install
94
96 Calling new()
97 "new()" is called as "my($obj) = GraphViz2::Parse::Yacc -> new(k1 =>
98 v1, k2 => v2, ...)".
99
100 It returns a new object of type "GraphViz2::Parse::Yacc".
101
102 Key-value pairs accepted in the parameter list:
103
104 o graph => $graphviz_object
105 This option specifies the GraphViz2 object to use. This allows you
106 to configure it as desired.
107
108 The default is GraphViz2 -> new. The default attributes are the
109 same as in the synopsis, above, except for the logger of course,
110 which defaults to ''.
111
112 This key is optional.
113
115 create(file_name => $file_name)
116 Creates the graph, which is accessible via the graph() method, or via
117 the graph object you passed to new().
118
119 Returns $self for method chaining.
120
121 $file_name is the name of a yacc output file. See t/calc3.output.
122
123 graph()
124 Returns the graph object, either the one supplied to new() or the one
125 created during the call to new().
126
128 See "FAQ" in GraphViz2 and "Scripts Shipped with this Module" in
129 GraphViz2.
130
132 Many thanks are due to the people who chose to make Graphviz
133 <http://www.graphviz.org/> Open Source.
134
135 And thanks to Leon Brocard <http://search.cpan.org/~lbrocard/>, who
136 wrote GraphViz, and kindly gave me co-maint of the module.
137
139 Version numbers < 1.00 represent development versions. From 1.00 up,
140 they are production versions.
141
143 The file Changes was converted into Changelog.ini by
144 Module::Metadata::Changes.
145
147 Email the author, or log a bug on RT:
148
149 <https://rt.cpan.org/Public/Dist/Display.html?Name=GraphViz2>.
150
152 GraphViz2 was written by Ron Savage <ron@savage.net.au> in 2011.
153
154 Home page: <http://savage.net.au/index.html>.
155
157 Australian copyright (c) 2011, Ron Savage.
158
159 All Programs of mine are 'OSI Certified Open Source Software';
160 you can redistribute them and/or modify them under the terms of
161 The Perl License, a copy of which is available at:
162 http://dev.perl.org/licenses/
163
164
165
166perl v5.32.0 2020-07-28 GraphViz2::Parse::Yacc(3)