bison - How to use yylval with strings in yacc -
I want to pass the actual string of tokens. If I have the token named ID, then I want my yacc file to be actually aware what the id is. I have a thing from Flex file and how do I do this?
view
interfacing with 15f
< P> One of the main uses of Flex is as yacc parser-generator partner. The Yacc parser expects to call a regular name called yylex () to find the next input token. This routine should return any associated value to the global tollin along with the next token type. To use Flex with Yacc, a y-t option is specified in the yacc to generate the y.tab.h file which defines all the% tokens that appear in the yacc input. This file is included in the Flex scanner. For example, if one of the tokens is TOK_NUMBER, then the scanner part might look like:% {# "y.tab.h"%} %% [0-9] + Include Yilavl = Atoi (Yatext); Return TOK_NUMBER;
Comments
Post a Comment