Hi,

> Hi, I have two suggestions to improve Antlr 4.0.
> 
> 1) I have a scala target that works for my needs. But it would help me if
> you 
> could rename the match functions and the type fields in the Java runtime, 
> because "match" and "type" are scala keywords.

I'm against doing so. Firstly, assuming that the current runtime is kept in 
general, it breaks existing code in other peoples' projects. The less people 
have to change the API usages the easier can they switch to current ANTLR 
versions.

Secondly, changing the name will affect the other targets as well. I know that 
I'd wonder if the changed name is just cosmetic, if the functions is still the 
same otherwise, if I can keep the .NETified name in my runtime without any 
future problems. And even if I'd be able to remember that "matchBob" is still 
"Match" new target developers are going to be confused and may end up including 
"MatchBob" in their target.

Thirdly, what would be the alternative for "match" and "type"? I can't really 
think of a name, which doesn't look awkward in some way ("_match"? "Match"?). 
Effectively, any change there would poison the cleanliness of the API.

Overall, this is a Scala/Java interaction problem, which shouldn't be "solved" 
here. Demand instead a way to use "match" and "type" as identifiers. C# e.g. 
uses "@" to indicate an identifier which can be otherwise any possible keyword 
(e.g. "@goto"). IMO, all languages designed for interaction should include 
something like that.

Johannes

> 
> 2) I create my AST manually, so i have many rules which look like this:
> 
> foo_declaration returns [FooDeclaration node]
>  :    VARIABLE identifier_list COLON type_mark SEMICOLON
>       {$node=new FooDeclaration(...)};
> 
> 
> foo_declarative_item returns [ASTNode node]
>  :    example_declaration {$node=$example_declaration.node}
>       | foo_declaration {$node=$foo_declaration.node}
>       | bar_declaration {$node=$foo_declaration.node};
> 
> I think i would be better, if a referenced rule without an attribute is
> used, it 
> should automatically use the return value.
> 
> e.g.
> 
> foo_declarative_item returns [ASTNode node]
>  :    example_declaration {$node=$example_declaration}
>       | foo_declaration {$node=$foo_declaration}
>       | bar_declaration {$node=$foo_declaration}
> 
> Christian
> 
> 
> 
> _______________________________________________
> antlr-dev mailing list
> [email protected]
> http://www.antlr.org/mailman/listinfo/antlr-dev

-- 
GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to