Christian Reisinger | 9 Aug 2010 14:46
Picon
Favicon

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

(Continue reading)

Johannes Luber | 10 Aug 2010 15:21
Picon
Picon

Re: ANTLR 4.0 suggestions

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 " <at> " to indicate an identifier which can be otherwise
any possible keyword (e.g. " <at> goto"). IMO, all languages designed for interaction should include
something like that.

Johannes

> 
(Continue reading)

Sam Harwell | 10 Aug 2010 15:47

Re: ANTLR 4.0 suggestions

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: antlr-dev-bounces@...
[mailto:antlr-dev-bounces@...] On
(Continue reading)

Henry Tan | 10 Aug 2010 22:15
Picon

Antlr generator in exe

I am looking for antlr generator in executable to avoid dependency on the Java runtime.
 
 
My question is, do we always have the exe version on every new antlr update or is it mostly done on a voluntarily basis?
 
Thanks
 
HTan
 
<div>
<div>I am looking for antlr generator in executable to avoid dependency on the Java runtime.</div>
<div>&nbsp;</div>
<div>I see the one in <a href="http://antlr.org/download/ANTLR-3.1-2009-06-28.7z">http://antlr.org/download/ANTLR-3.1-2009-06-28.7z</a>.</div>
<div>&nbsp;</div>
<div>My question is, do we always have the exe version on every new antlr update or is it mostly done on a voluntarily basis?</div>
<div>&nbsp;</div>
<div>Thanks</div>
<div>&nbsp;</div>
<div>HTan</div>
<div>&nbsp;</div>
</div>
Gerald Rosenberg | 11 Aug 2010 20:53

Version 4 development branch?

Is the v4 development branch visible somewhere?  Could not find under fisheye.

Thanks,
Gerald
<div>
    Is the v4 development branch visible somewhere?&nbsp; Could not find
    under fisheye.<br><br>
    Thanks,<br>
    Gerald<br>
</div>
Terence Parr | 11 Aug 2010 22:15
Gravatar

Re: Version 4 development branch?

Hi Gerald,Let me add the permissions for you. wait, what's your login for perforce? I don't see you. oh,
fisheye. I haven't pushed it to that. they need to set something up for me but I didn't want it visible to the
general population. do you want me to set you up account for perforce? I keep meaning to do my own simple
mirror of the repository...

T
On Aug 11, 2010, at 11:53 AM, Gerald Rosenberg wrote:

> Is the v4 development branch visible somewhere?  Could not find under fisheye.
> 
> Thanks,
> Gerald
> _______________________________________________
> antlr-dev mailing list
> antlr-dev@...
> http://www.antlr.org/mailman/listinfo/antlr-dev

Gerald Rosenberg | 12 Aug 2010 01:04

Re: Version 4 development branch?

Hi Ter,

Don't think I have a Perforce or Jira login.  No need to push the branch to fisheye just for me.  A login that will allow me to monitor development on Perforce would be fine (if a non-email user name is needed, use "gbrose85").

Thanks,
Gerald

------ Original Message (Wednesday, August 11, 2010 1:15:57 PM) From: Terence Parr ------
Subject: Re: [antlr-dev] Version 4 development branch?
Hi Gerald,Let me add the permissions for you. wait, what's your login for perforce? I don't see you. oh, fisheye. I haven't pushed it to that. they need to set something up for me but I didn't want it visible to the general population. do you want me to set you up account for perforce? I keep meaning to do my own simple mirror of the repository... T On Aug 11, 2010, at 11:53 AM, Gerald Rosenberg wrote:
Is the v4 development branch visible somewhere? Could not find under fisheye. Thanks, Gerald _______________________________________________ antlr-dev mailing list antlr-dev-ErkRXerACLvYtjvyW6yDsg@public.gmane.org http://www.antlr.org/mailman/listinfo/antlr-dev
<div>
    <span>Hi Ter,<br><br>
      Don't think I have a Perforce or Jira login.&nbsp; No need to push the
      branch to fisheye just for me.&nbsp; A login that will allow me to
      monitor development on Perforce would be fine (if a non-email user
      name is needed, use "gbrose85").<br><br>
      Thanks,<br>
      Gerald<br><br>
      ------&nbsp;Original&nbsp;Message&nbsp;(Wednesday, August 11, 2010 1:15:57
      PM)&nbsp;From:&nbsp;Terence Parr&nbsp;------<br>
      Subject:&nbsp;Re: [antlr-dev] Version 4 development branch?<br></span>
    <blockquote cite="mid:9E93AF15-C32C-4179-90D2-D430EA5E9FBB@..." type="cite">
      Hi Gerald,Let me add the permissions for you. wait, what's your login for perforce? I don't see you. oh, fisheye. I haven't pushed it to that. they need to set something up for me but I didn't want it visible to the general population. do you want me to set you up account for perforce? I keep meaning to do my own simple mirror of the repository...

T
On Aug 11, 2010, at 11:53 AM, Gerald Rosenberg wrote:

      <blockquote type="cite">
        Is the v4 development branch visible somewhere?  Could not find under fisheye.

Thanks,
Gerald
_______________________________________________
antlr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:antlr-dev@...">antlr-dev@...</a>
<a class="moz-txt-link-freetext" href="http://www.antlr.org/mailman/listinfo/antlr-dev">http://www.antlr.org/mailman/listinfo/antlr-dev</a>

      </blockquote>

    </blockquote>
  </div>
Gary | 26 Aug 2010 08:35

3.1 build fails

Is it known that 3.1 does not build?

,----
| [myjavac] C:\src\antlr-3.1\codegen\ANTLRLexer.java:61: duplicate class: org.antlr.tool.ANTLRLexer
| [myjavac] public class ANTLRLexer extends antlr.CharScanner implements ANTLRTokenTypes, TokenStream
| [myjavac]        ^
`----

Why does this happen with an official source distribution?

Johannes Luber | 26 Aug 2010 09:33
Picon
Picon

Re: 3.1 build fails

> Is it known that 3.1 does not build?

I had no problems to build my own 3.1 distribution, so if it fails 1. either a packaging error occurred or 2.
you made a mistake in following the steps. Considering that you are the first one complaining in a long
time, I'm inclined to guess it is the latter.
> 
> ,----
> | [myjavac] C:\src\antlr-3.1\codegen\ANTLRLexer.java:61: duplicate class:
> org.antlr.tool.ANTLRLexer
> | [myjavac] public class ANTLRLexer extends antlr.CharScanner implements
> ANTLRTokenTypes, TokenStream
> | [myjavac]        ^
> `----
> 
> Why does this happen with an official source distribution?

Describe the steps you did, especially any possible deviation. The error sounds like Java tries to load the
same class twice, but without more information I can only guess a Java class path issue.

Johannes
> 
> _______________________________________________
> antlr-dev mailing list
> antlr-dev <at> antlr.org
> 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
antlr-dev <at> antlr.org
http://www.antlr.org/mailman/listinfo/antlr-dev
Jim Idle | 26 Aug 2010 17:15

Re: 3.1 build fails

You don't supply enough information for me to tell you. 

Are you following the BUILD.txt instructions? Why 3.1 and not 3.2 or even
3.1.3? Why so scathing in your excoriation of something we give away for
free and of a source tree that has been there for quite some time? It might
possibly be broken, but it might possibly be something you are not doing or
doing wrong. 

If I were you I would first remove all .class files from the tree and try
again. A duplicate class file likely means the same .class exists in two
places in the compile path.

Jim

> -----Original Message-----
> From: antlr-dev-bounces@... [mailto:antlr-dev-bounces@...]
> On Behalf Of Gary
> Sent: Wednesday, August 25, 2010 11:36 PM
> To: antlr-dev@...
> Subject: [antlr-dev] 3.1 build fails
> 
> Is it known that 3.1 does not build?
> 
> ,----
> | [myjavac] C:\src\antlr-3.1\codegen\ANTLRLexer.java:61: duplicate
> | class: org.antlr.tool.ANTLRLexer [myjavac] public class ANTLRLexer
extends
> antlr.CharScanner implements ANTLRTokenTypes, TokenStream
> | [myjavac]        ^
> `----
> 
> Why does this happen with an official source distribution?
> 
> _______________________________________________
> antlr-dev mailing list
> antlr-dev@...
> http://www.antlr.org/mailman/listinfo/antlr-dev


Gmane