Say I have this C program.
#include <stdio.h>
int main(void)
{
int monday = 1;
int tuesday = 2;
if(monday == tuesday) { fprintf("I should quit my day job"); }
return 1;
}
What would the tokens be?
What does bison provide me, as a programmer? Certianly, bison does not generate machine code with just a parser grammar? So how do I interface with bison? I am not expecting a full answer here, just a pointer to good websites and books.
Bison implements a generalized LR parser. See http://www.gnu.org/software/bison/manual/bison.html for fairly extensive documentation, with examples. You don’t get back a parse tree per se; instead, you write “actions” that activate on each reduction. Of course, if your actions simply build a parse tree, that will do the trick, if you want to obtain a parse tree. Modern bison also has a lot of extra tweaking you can insert.