[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bison version in graph output file
From: |
tys lefering |
Subject: |
Re: bison version in graph output file |
Date: |
Sun, 9 May 2010 02:21:01 +0200 |
User-agent: |
SquirrelMail/1.4.18 |
Hi Akim,
Just another idea to add extra bison info to the dot graph
without introducing attributes that "don't make sense".
On Tue, May 4, 2010 11:04, Akim Demaille wrote:
> Maybe we should use the fact that attributes are free, and it is not an
> error (at least with the tools I know) to have attributes that "don't make
> sense". Tools already tailored to parse Dot files would have access to
> Bison attributes for free, instead of having to learn how to parse our
> comments. Say
>
> graph "The title"
> {
> graph [
> bisonVersion = "2.4.3",
> bisonGrammarFile = "parse-dot.y",
> bisonAutomatonType = "LALR(1)",
> ]
> }
It is possible to add invisible nodes to the graph,
then the dot graph has usual syntax, more extra info
can be added later on, easy to parse.
small example as a bison generated dot graph:
digraph "c.y"
{
"0" [label="0\n$accept -> . unit \"end of file\""]
... more nodes and edges here ...
"18" [label="18\nexp -> exp . '+' exp\nexp -> exp . '-' exp\nexp -> exp
. '*' exp\nexp -> exp . '/' exp\nexp -> exp '/' exp ."]
"bisonversion" [label="GNU Bison 2.4.507-c826-dirty",style="invis"];
"bisonskeleton" [label="lalr",style="invis"];
... more bison information can be added here similar way ...
}
In this example nodes "bisonversion" and "bisonskeleton"
are added with the argument as label text, style invisible.
The bison grammar input name too can be added this way,
the %expect value, and other interesting bison info.
These nodes are not visible in dot image output,
but appear in dot postscript output as:
% bisonversion
% bisonskeleton
or in dot svg output as:
<!-- bisonversion -->
<!-- bisonskeleton -->
or in dot xdot or dot output as:
bisonversion [label="GNU Bison 2.4.507-c826-dirty", style=invis,
pos="638,1177", width="3.3611", height="0.5"];
bisonskeleton [label=lalr, style=invis, pos="804,1177", width="0.75",
height="0.5"];
And the parsername appears in svg output as:
<!-- Title: c.y Pages: 1 -->
<title>c.y</title>
or in postscript output as:
%%Title: c.y
or in dot, xdot output as:
digraph "c.y"
Tools to parse dot can scan for these invis nodes beginning
with name "bison", and get a ususal dot grammar this way,
without strange node attributes.
Thanks.
c.dot
Description: Binary data