[antlr-interest] C grammar question

Kieran Simpson kierans777 at gmail.com
Wed Sep 26 01:54:39 PDT 2012


To search the mailing list I use the "site" filter on Google.  You can 
either use the "Advanced search" option from the settings wheel on the 
right hand side or type 
"site:http://www.antlr.org/pipermail/antlr-interest/" into the search 
box before your query.

As for getting up to speed with Antlr, I found the Antlr Reference book 
the easiest way to get into Antlr so pick yourself up a copy (no I don't 
get any commission from Terence for saying that ;) ).

Cheers,


On 25/09/12 7:07 AM, Stuart Maclean wrote:
> Hi from a newbie. I have been using Antlr3 for about 4 days.
>
> First, a quick question. is the mailing list archive searchable in any
> way?? I suspect not (those MailMan interfaces never seem to be), but
> perhaps I am just not seeing it.
>
> My real question relates to the C grammar, bundled in
> examples-v3/java/C. If I build it as is and run against the following
> input:
>
> typedef void (*a2)(int i);
>
> it will print that both 'a2' and 'i' are new types. But only 'a2' is a
> new type here, 'i' should not be seen as a new type. I can see that the
> way the 'isTypedef' info is being communicated from the 'declaration'
> rule to the 'direct_declarator' rule, but the logic is failing if the
> parser has to visit the
>
> '(' declarator ')'
>
> branch of the direct_declarator rule. which it does for the input above.
> To suppress 'i' being seen as a new type, I added this action to the
> direct_declarator rule:
>
> | '( declarator ')'
> { $declaration::isTypedef=false; }
>
> but it seems like a hack and I am wondering if there is some cleaner way
> to do this.
>
> A further question. What does this mean (in the same C.g)?
>
> type_id
> : {isTypeName(input.LT(1).getText())}? IDENTIFIER
>
> Is this a 'pre action'?? If so, what does the '?' mean? I can't find any
> notes about what this construct represents?
>
> Any help gratefully appreciated.
>
> Stuart
>


More information about the antlr-interest mailing list