I was playing with flex and bison today, and something kind of eerie came to my attention.
localhost:c math4tots$ lex c.l
localhost:c math4tots$ yacc -d c.y
localhost:c math4tots$ rm c.l c.y
localhost:c math4tots$ gcc c.c lex.yy.c y.tab.c
c.y: In function ‘opr’:
c.y:120: error: ‘nodeType’ has no member named ‘oper’
I've only passed c.c lex.yy.c, and y.tab.c (c.h and y.tab.h are also included as headers), but somehow gcc knows about c.l and c.y. In fact, even after I've deleted c.l and c.y, gcc knows where in c.y the error in the code was. How does it do that?
I feel like I've seen something similar for some different tools I've used in the past, but I can't exactly remember what they were.