Is there a way to create a uniquie identifier for each token that flex reads?
ex:
flex:
"+" {yylval.string =yytext;return PLUS;}
[0-9]+ {
yylval.string =yytext;
return INT;}
bison:
E: INT PLUS INT
{
Node($1.ID);Node(PLUS.ID);Node($3.ID);Edge(PLUS.ID,$1.ID);Edge(PLUS.ID,$3.ID);
}
Every time there is input unique nodes are created. This is only an example of what i'd like to accomplish. When Node(...) and Edge(...) are called there are prints to a file that is later converted to a graph. I'd like them unique because I want to create this:

and not this:

Other types of solutions are also welcome.