[antlr-interest] Q: move from v2 to v3 parser grammar. Rewrite tree rule

Ruslan Zasukhin ruslan_zasukhin at valentina-db.com
Tue Mar 22 14:43:21 PDT 2011


On 3/22/11 11:27 PM, "Jim Idle" <jimi at temporal-wave.com> wrote:

>>> However, using lower case literals in your parser directly is not a
>>> good idea.  Use real tokens so that you error messages are better
>> 
>> Simple example, please?
> 
> Instead of:
> 
> rule : 'join' somerule;
> 
> Use:
> 
> rule : JOIN somerule;
> 
> // Lexer rule to match:
> //
> JOIN : 'join';


Clear.

But this is exactly what was NOT needed in ANTLR v2.
And ANTLR was proud that we can write tokens directly in grammar.

Collecting all this tokens into Lexer is additional manual work. No?
Similar to  Lexer :)


So for me not clear why this is better now for v3?




==============
> And for case insensitivity I specify the token specs all in UPPPER rather
> than lower and then override the input stream as per:
> 
> http://www.antlr.org/wiki/pages/viewpage.action?pageId=1782
> 
> Although someone has added instructions for generating the slowest case
> insensitive lexers in the world with individual letter rules. Use the
> input stream override method in general.

Yes, we have see this page ...

> Support for case insenstive matching is built in to the C target input
> streams. To use it, you must make a method call before using the input stream
> as in the example below and specify all your keyword/lexer tokens in UPPER
> CASE only

    JOIN above  is that  UPPER CASE  example?

I ask because   'join'  above still is in low case ...



-- 
Best regards,

Ruslan Zasukhin
VP Engineering and New Technology
Paradigma Software, Inc

Valentina - Joining Worlds of Information
http://www.paradigmasoft.com

[I feel the need: the need for speed]




More information about the antlr-interest mailing list