help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Variables produced by Bison


From: Hart, Justin
Subject: RE: Variables produced by Bison
Date: Wed, 18 Sep 2002 20:24:20 +0200

Thank you for the response, but it doesn't really answer my question.
Perhaps I stated myself incorrectly.

I am familiar with the Dragon book (Aho, Sethi, Ulman.  Compilers:
Principals, Techniques, and Tools), which I used in a compiler class that I
took in college, as well as with LALR parsers and PDAs.  None of the
algorithms involved in writing a parser are a mystery to me.  In your
position, I probably would have answered the question much the same, given
that many people don't.

What is a mystery to me, and what I am seeing a lack of documentation on, is
the code produced during a yacc compile.  For instance, what are yyact,
yypact, and yypgoto?  All of the data that I can find in these books on the
algorithm does me nothing if I am pointing at the wrong table when I try to
implement it.  I have started by reading bison.simple, but what I really
would like is just somewhere that I can go to find yacc's output with some
comments on it explaining what these tables are.  While I have made educated
guesses on what several of these tables mean, and some of them have comments
in the code, I would be much more comfortable coding a yyparse based on some
documentation of what these tables are.  Is there anywhere?

Thanks!

Justin


-----Original Message-----
From: Hans Aberg [mailto:address@hidden
Sent: Wednesday, September 18, 2002 1:13 PM
To: Hart, Justin
Cc: 'address@hidden'
Subject: Re: Variables produced by Bison


At 12:37 -0400 2002/09/18, Hart, Justin wrote:
>Hi, I just joined this list today.  I figured that if anybody would know
>where to go for this sort of documentation, it would be here.
>
>I am currently developing a system that uses a yacc grammar in an
>interesting fashion.  Unfortunately, some things that this system does will
>require me to redefine yyparse().  Of course, there is tons of
documentation
>on writing yacc files on the web, and I have written numerous ones before.
>However, there seems to be a lack of documentation on the output files.  Is
>there anywhere that I can go to find documentation on the variables in the
>y.tab.c output files?  I need to know what they are in order to develop my
>yyparse.

Bison is using the LALR(1) algorithm to eliminate all variables, and
replace them with states for use with a stack based machine called
push-down automaton.

LALR(1) and such algorithms are described in books on compilers, like Aho,
Sethi & Ullman, "Compilers...", or perhaps the Parsing Techniques book:
    http://www.cs.vu.nl/~dick/PTAPG.html

Bison has an option --verbose that produces a .output file with all the
data of this translation.

>I can use either bison or the yacc distributed with the Forte compiler, but
>I really need to know what these variables are in either case.

Latest Bison beta: ftp://alpha.gnu.org/gnu/bison/  (bison-1.49x.tar.gz)

  Hans Aberg






reply via email to

[Prev in Thread] Current Thread [Next in Thread]