I need a hint how to manage what is known as "typedef parsing" problem.
I write a grammar for c language, only for the declaration part. I found this
for lex/yacc and I traslate for Irony.
The problem is with the non terminal type_specifier
the last token TYPE_NAMEis managed in yacc with a little c function:
* pseudo code --- this is what it should check
* if (yytext == type_name)
* it actually will only return IDENTIFIER
the function return that an identifier is a type_name if it is found in a symbol table.
So, my question is:
- What is the best way to manage in Irony the population of a symbol table during parsing?
- How can i use that symbol table to "trasform" a token from identifier to type_name ?
For sake of clarity: sample code c
typedef int MYINT; // here MYINT is an identifier; after I put it in the symbol table
void f( MYINT aa); // here MYINT is a type_name; i have to translate a identifier token to type_name