Bison Internals

GNU/Bison is a LALR parser generator written in C. It can generate C and C++ code that implements LALR and GLR parsers. This project is an effort to document internal data structures of Bison.

Wednesday, May 10, 2006

Where to begin

I was wondering where to begin hacking bison; Akim sent a mail describing the structure of bison in brief. Just want to record that mail here:

"Well, that would depend upon which part you wish to study. There is a front end, which task is to read the grammar and apply a few transformations upon it. Then there is the core of the program, which builds the LR(0) automaton, then the LALR automaton, deals with precedence, associativity and other conflicts, and then prepares (compresses) the tables. Then there is the back end, which prepares a batch of M4 definitions corresponding to the grammar, and it calls M4 giving it these definitions, and the selected skeleton.

Basically, see... main.c :)"

So I jumped into main.c and lo and behold! everything is hazily making sense...; but I decided not to rush. I am reading the complete bison manual first since I had not used all the features of bison, at least I need to know which is what. For e.g, there is this feature called "locations" that I had not used before;

Started to read bison manual today. It is at http://www.gnu.org/software/bison/manual/html_mono/bison.html.gz

0 Comments:

Post a Comment

<< Home