GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
GraphViz2::Parse::Yacc(3) User Contributed Perl Documentation GraphViz2::Parse::Yacc(3)

GraphViz2::Parse::Yacc - Visualize a yacc grammar as a graph

    use GraphViz2::Parse::Yacc;
    # no objects - quicker
    my $gd = GraphViz2::Parse::Yacc::to_graph('t/calc3.output');

    # populate a GraphViz2 object with a Graph::Directed of a parser
    my $gv = GraphViz2->from_graph(GraphViz2::Parse::Yacc::graphvizify($gd));

    # OO interface, using lazy-built attributes
    my $gvp = GraphViz2::Parse::Yacc->new(file_name => $file_name);
    my $gd = $gvp->as_graph; # Graph::Directed object
    # or supply a suitable Graph::Directed object
    my $gvp = GraphViz2::Parse::Yacc->new(as_graph => $gd);
    # then get the GraphViz2 object
    my $gv = $gvp->graph;

    # DEPRECATED ways to get $gvp with populated $gv
    my $gvp = GraphViz2::Parse::Yacc->new;
    $gvp->create(file_name => 't/calc3.output');
    my $gv = $gvp->graph;
    # or give it a pre-set-up GraphViz2 object
    my $gv = GraphViz2->new(...);
    my $gvp = GraphViz2::Parse::Yacc->new(graph => $gv);
    # call ->create as above

    # produce a visualisation
    my $format = shift || 'svg';
    my $output_file = shift || "output.$format";
    $gv->run(format => $format, output_file => $output_file);

See t/gen.parse.yacc.pl.

Takes a yacc grammar and converts it into a Graph::Directed object, or directly into a GraphViz2 object.

This is the recommended interface.

    my $gd = GraphViz2::Parse::Yacc::to_graph('t/calc3.output');

Given a yacc grammar, returns a Graph::Directed object describing the finite state machine for it.

    my $gv = GraphViz2->from_graph(GraphViz2::Parse::Yacc::graphvizify($gd));

Mutates the given graph object to add to it the "graphviz" attributes visualisation "hints" that will make the "from_graph" in GraphViz2 method visualise this regular expression in the most meaningful way, including labels and groupings.

It is idempotent as it simply sets the "graphviz" attribute of the relevant graph entities.

Returns the graph object for convenience.

This is a Moo class, but with a recommended functional interface.

file_name

The name of a yacc output file. See t/calc3.output.

This key is optional. You need to provide it by the time you access either the "as_graph" or "graph".

as_graph

The Graph::Directed object to use. If not given, will be lazily built on access, from the "file_name".

graph

The GraphViz2 object to use. This allows you to configure it as desired.

This key is optional. If provided, the "create" method will populate it. If not, it will have these defaults, lazy-built and populated from the "as_graph".

    my $gv = GraphViz2->new(
            edge   => {color => 'grey'},
            global => {directed => 1},
            graph  => {rankdir => 'TB'},
            node   => {color => 'blue', shape => 'oval'},
    );

DEPRECATED. Mutates the object to set the "file_name" attribute, then accesses the "as_graph" attribute (possibly lazy-building it), then "graphvizify"s its "as_graph" attribute with that information, then "from_graph"s its "graph".

Returns $self for method chaining.

Many thanks are due to the people who chose to make Graphviz <http://www.graphviz.org/> Open Source.

And thanks to Leon Brocard <http://search.cpan.org/~lbrocard/>, who wrote GraphViz, and kindly gave me co-maint of the module.

GraphViz2 was written by Ron Savage <ron@savage.net.au> in 2011.

Home page: <http://savage.net.au/index.html>.

Australian copyright (c) 2011, Ron Savage.

All Programs of mine are 'OSI Certified Open Source Software'; you can redistribute them and/or modify them under the terms of The Perl License, a copy of which is available at: http://dev.perl.org/licenses/

2020-10-31 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.