[antlr-interest] Help with semantic actions commit
swalton
swalton at cs.utah.edu
Thu Mar 18 16:54:52 PDT 2010
I derived my grammar from Terry's C grammar. I have added a lot of
semantic actions and kept the typedef symbol definition. I have run into a
problem and need help. Consider the following:
typedef int uint32_t;
typedef uint32_t result_t;
I can have any number of these typedefs, but this case is sufficient to
illustrate the problem I am encountering. The grammar looks ahead beyond
the first semicolon before committing the 'uint32_t' in the scope table.
Needless to say, the second line always fails. I watched step-by-step,
placing System.err.print()'s along the way to find out when the
'$Symbols::types.add(name);' is called. The test (boolean
isTypeName(String name)) always occurs *before* 'uint32_t' is stored. I
added a { addName(name) }? test (which always returns true) to see if I
could force an execution of the semantic action without success.
How do I get the symbol committed?
How do I keep ANTLR from looking so far ahead?
Any help is appreciated. This is a major roadblock.
-Sean Walton
PhD Student, SoC, U of U
More information about the antlr-interest
mailing list