|yaccviso 1.0 - a tool for visualizing yacc/bison grammars firstname.lastname@example.org (1998-01-24)|
|From:||email@example.com (Leon Aaron Kaplan)|
|Date:||24 Jan 1998 12:21:10 -0500|
|Organization:||Vienna University of Technology, Austria|
|Keywords:||yacc, tools, available|
This is an announcement of a little but maybe useful tool for all
people working with yacc/bison. I post it here as my tool is moer or
less finished but I need some people which take a look at it and
report any bugs.
If you are interested in it and find any bugs, please
1) your input grammar
2) possibly run the tool with the debug option -d DDEBUG and
redirect stderr to a file and include that file
3) a brief description of what went wrong.
Following is the README file for my tool:
/* YaccViso - a tool for visualizing dependencies of nonterminals in a yacc */
/* grammar file */
/* Copyright (C) 1997 Leon Aaron Kaplan, email: firstname.lastname@example.org */
/* This program is free software; you can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License, or */
/* (at your option) any later version. */
/* This program is distributed in the hope that it will be useful, */
/* but WITHOUT ANY WARRANTY; without even the implied warranty of */
/* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/* GNU General Public License for more details. */
/* You should have received a copy of the GNU General Public License */
/* along with this program; if not, write to the Free Software */
/* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
/* ----------------------------------------------- end of legal stuff ------ */
/* file: README
* author: Leon Aaron Kaplan, email@example.com
* last mod.:
TABLE OF CONTENTS
2. What is YaccViso
3. Why YaccViso
5. Where to obtain YaccViso
8. Systems On Which Yaccviso Was Tested
This product is copylefted by the GNU General Public License (GPL).
You should have received a copy of the GPL along with this program. It
is in the file COPYRIGHT.
2. WHAT IS YACCVISO?
Note: throughout this file when I refer to "yacc" I mean both yacc and
YaccViso is a tool for visualizing dependencies of non terminal and
terminal symbols in a yacc grammar. If you do not know what yacc is
then you probably won't need YaccViso. It is thus a tool specifically
designed for people who write compilers with yacc who work on large
YaccViso will take a yacc or bison file, parse it and produce two
dependency graphs: one which can be visualized using VCG and one
which can be visualized using dot.
What do I mean by dependency?
If you have a yacc file of the form:
start : declarations code
declarations : declarations declaration
code : code statement
then YaccViso will generate a directed graph in which there are
directed edges from "start" to "declarations" and "code", etc. In
other words: the rule "start" depends upon "declarations" and "code"
3. WHY YACCVISO?
If you have ever written a large grammar such as the grammar for ANSI
C with more than 50 productions then you will have noticed that it
isn't easy to keep track on each terminal or non terminal symbol, what
it does etc. In such a case I recommend using YaccViso and printing
your dependency graph of your grammar as a huge poster so that you
have a handy reference.
What's more: as YaccViso generates an easily parsable output of a
directed graph, all the standard algorithms can be applied to this
graph and questions such as "which grammar symbol is used in only one
context and in which context?" can be answered automatically. We plan
to incorporate some of these algorithms into YaccViso when time
YaccViso should be compilable on any UN*X system which has:
* bison or yacc (tested on both)
* flex 2.5.4 or higher
* GNU make (See Note gmake)
* GNU C compiler (gcc).
The Code should be highly portable except for the flex file.
I seldomly used any system specific calls except malloc, free, fprintf and
In addition you will need one or more of:
1. VCG ("Visualization of compiler graphs") by Georg Sander
2. the graphviz package (contains dot, lefty, neato, dotty) by AT&T
For the actual visualization. I highly recommend using dot as it produces
a more aesthetic layout and as it is faster than VCG.
The Makefile uses a few lines of conditionals. It was found that these
won't work on BSD make and OSF/1 make. Use GNU make (gmake) instead or
look at the Makefile and adapt it (it is a small Makefile) and remove
5. WHERE TO OBTAIN YACCVISO?
Get it from my Web page: http://mars.tuwien.ac.at/~jjl or request it
via email: firstname.lastname@example.org or email@example.com.
1) make a unique temporary directory
2) copy the .tgz file into that directory
3) ungzip it and untar it. Now you should have a directory structure
|- README (this file)
4) Go into the directory src/ and type "gmake"
5) ignore any warnings
6) you should have an executable "yaccviso". Take it and copy it to any
location that you want to have it.
The documentation in the directory doc/ is far from complete. It gives
some insight however.
8. SYSTEMS ON WHICH YACCVISO WAS TESTED
Redhat Linux 4.2, Pentium 166
DEC OSF/1, DEC Alpha, still a "segmentation fault" after the program exits.
please ignore at the moment. It should have produced the output files.
Return to the
Search the comp.compilers archives again.