[antlr-interest] C grammar question

Jim Idle jimi at temporal-wave.com
Wed Sep 26 02:40:20 PDT 2012


>From the "support" page you can search the archives directly. The URL it
is using is:

http://antlr.markmail.org

(Though it uses the longer URI on the support page as antlr.markmail.org
was a later addition to markmail). This search is much better than the
Google site filter.

Jim


-----Original Message-----
From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Kieran Simpson
Sent: Wednesday, September 26, 2012 4:55 PM
To: Stuart Maclean
Cc: antlr-interest at antlr.org
Subject: Re: [antlr-interest] C grammar question

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
>

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address


More information about the antlr-interest mailing list