[antlr-interest] ANTLR 3 & hidden token management?

Kay Roepke kroepke at classdump.org
Sun Aug 6 18:33:29 PDT 2006


On 7. Aug 2006, at 3:10 Uhr, Prashant Deva wrote:

> I have also noticed in quite a few places that people (esp  
> newcomers) seem
> to find the antlr syntax too confusing.
> Maybe we should reservere a week just to discuss and try to make  
> the syntax
> of antlr 3 more friendly.

What part of the syntax do you mean? The channel thing is just an  
instance variable assignment (or whatever the Java dudes call this).
Not much different to the method call in v2, is it? To assign the  
channel a name is just a one liner in Token.java or do it yourself in  
the
@members section of your grammar. The important part really is that  
the channel number is not the value of DEFAULT_CHANNEL or it wouldn't
be skipped in the unmodified version of CommonTokenStream.

I find it a bit late in the game to be requesting a discussion about  
syntax. We should be trying to get the thing out of the door ASAP
and not start a new "but I like {}?=>#$%-> better for gating  
sempreds, because that other language is using something similar"- 
flamewar.
The grammars for v3 are still in v2, you know, and changing stuff  
around probably makes it a lot harder for Ter to actually fix the  
outstanding
bugs on the list.

I think the syntax is pretty consistent and powerful. Not hard to  
remember, and not hard to learn. The hardest thing probably is  
understanding
why things don't parse the way you intended them to parse, but that's  
generally just the lack of knowledge about parsing theory more than the
syntax. And really, anyone who even considers writing a grammar  
should be capable of learning that bit of a new syntax to make things  
happen.
There are a lot of non-trivial examples available, the list is  
generally helpful and responsive esp. to newbie questions and the  
wiki starts getting
a good resource, too.

In time v3 goes final we will have a couple of real-world examples,  
too, at least that's what I gather. So this should really be enough.

With all due respect,

-k
-- 
Kay Röpke <kroepke at classdump.org>
classdump Software




More information about the antlr-interest mailing list