[antlr-interest] [C target] ANTLR 3.1 issues with token offsets and generated AST return types
Gavin Lambert
antlr at mirality.co.nz
Wed Aug 20 04:48:23 PDT 2008
At 21:13 20/08/2008, Sven Van Echelpoel wrote:
>Naturally I was working with 3.1b2 and not the official release,
so
>when I saw that 3.1 was released I went ahead and tried that
one.
>This was even worse! 3.1 with the C target does not even
generate
>the type of the AST in the return structs of the rules. This is
>what comes out:
>
>typedef struct WarpParser_translation_unit_return_struct
>{
> /** Generic return elements for ANTLR3 rules that are not in
> tree parsers or returning trees
> */
> pANTLR3_COMMON_TOKEN start;
> pANTLR3_COMMON_TOKEN stop;
> tree; <---------------- No type here!
>
>}
> WarpParser_translation_unit_return;
To fix that one, I think you need to include:
ASTLabelType = pANTLR3_BASE_TREE;
in the options block at the top of your grammar. (I'm not sure
why it wouldn't default to this any more, but it's been mentioned
a few times recently on the list.)
More information about the antlr-interest
mailing list