For #1:

Scala's syntax for accessing members from other JVM languages that are
reserved words in Scala is the following:

`match` (backticks)

Source:
http://stackoverflow.com/questions/1215767/scala-keyword-as-package-name

This ability is standard in any language that can conflict with another
language on the same runtime. When targeting the CLR, code can be
"CLS-compliant" (a strict set of rules for publicly visible names and types)
to reduce the possibility of such a conflict, but there is no further
developer responsibility to meet other requirements of other languages. If
Java doesn't have a similar set of rules available, then it's perhaps
unfortunate but the Java/Scala interaction issue itself doesn't merit an API
change.

For #2:

The syntax is already complicated enough between lexer and parser rule
references (though well-defined so it's a straightforward learning process).
I think this would only make it worse.

Sam

-----Original Message-----
From: [email protected] [mailto:[email protected]] On
Behalf Of Christian Reisinger
Sent: Monday, August 09, 2010 7:47 AM
To: [email protected]
Subject: [antlr-dev] ANTLR 4.0 suggestions

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.

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

_______________________________________________
antlr-dev mailing list
[email protected]
http://www.antlr.org/mailman/listinfo/antlr-dev

Reply via email to