can i change a non-terminal type without using %union?

2009-07-21 Thread bookman bookman
I tried a caculator using flex&bison, but i can not using it to caculate real number. The flex and bison are as follows: --flex cal.l-- %{ #define YYSTYPE double #include "cal.y.h" %} floatNumber [0-9]+|([0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)? %% {floatNumber} { yylval=atof(yytex

What are the arrays (yytranslate, yyprhs...) mean and how are they caculated in bison?

2009-07-31 Thread bookman bookman
Hi everyone, I am a newer in bison and i have used lex and bison to implement a caculator. When i opened the source generated by bison, I found some arrays instead of shift/reduce table and goto table, but i do not know what they are stand for and how they are caculated. These are the arrays that