> I'm writing a C parser using PLY, and recently ran into a problem.
> This code:
>
> typedef int my_type;
> my_type x;
>
> Is correct C code, because my_type is defined as a type previously to
> being used as such. I handle it by filling a type symbol table in the
> parser that gets used by the lexer to differentiate between types and
> simple identifiers.
>
> However, while the type declaration rule ends with SEMI (the ';'
> token), PLY shifts the token 'my_type' from the second line before
> deciding it's done with the first one. Because of this, I have no
> chance to pass the update in the type symbol table to the lexer and it
> sees my_type as an identifier and not a type.
>
> Any ideas for a fix ?
>
> The full code is 
> at:http://code.google.com/p/pycparser/source/browse/trunk/src/c_parser.py
> Not sure how I can create a smaller example out of this.
>

Just wanted to add that the same problem exists with the example ansic
grammar supplied with PLY.

Eli

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"ply-hack" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/ply-hack?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to