[antlr-interest] adding "version" option to ANTLR grammars

Gary R. Van Sickle g.r.vansickle at att.net
Sun Feb 1 22:44:18 PST 2009


> From:  Sam Harwell
> 
> (I'm only offering an independent opinion on this - 
> definitely not trying to insult anyone.)
> 
> This option feels "gimmicky" to me. It doesn't address the 
> asynchronous nature of core/target updates, target-to-target 
> incompatibilities, and doesn't identify breaking changes in 
> the Tool between versions.

It certainly could/could/does:

options
{
	written_to_antlr_version="3.1.2";
	language=C;
	written_to_runtime_version="1.2.3";
}

All bases covered, no?

> I don't think it adds anything 
> that a comment at the top doesn't already give.

A comment at the top makes enforcing any restrictions, or indeed doing
anything at all at "ANTLR-time" related to the version of either the ANTLR
tool or the runtime in use, impossible.  And I can guarantee you that the
number of any such comments, regardless of their utiliy, in the wild will be
able to be counted on one hand.  People simply don't do this sort of thing
unless forced.

> This is what the Breaking Changes section of release notes is for. :)
> 

Unfortunately, tools aren't able to read release notes yet, nor are they in
general able to divine the version of a language the original source was
written to.  Until they somehow magically grow both these abilities,
everybody wins if such information is explicitly communicated by the writer
to the tool.

> Sam
> 

-- 
Gary R. Van Sickle
 
> -----Original Message-----
> From: antlr-interest-bounces at antlr.org
> [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Terence Parr
> Sent: Monday, January 19, 2009 5:45 PM
> To: Johannes Luber
> Cc: antlr-interest Interest
> Subject: Re: [antlr-interest] adding "version" option to 
> ANTLR grammars
> 
> That is an interesting idea. I am cc'ing the  interest list. 
> sorry for the long delay.
> 
> I take it that you are suggesting the following
> 
> grammar T;
> options {
> 	language = ...;
> 	version = "3.1.1";
> }
> 
> Ter
> On Nov 29, 2008, at 1:42 PM, Johannes Luber wrote:
> 
> > Hi!
> >
> > Thinking about the upcoming dialects of ANTLR grammars (one 
> for each 
> > version, which aren't totally upwardscompatible), I had this idea.
> > Would
> > it make sense to make an option named "version" mandatory, which 
> > simply records the used ANTLR version for writing. It's mandatory 
> > because people don't seem ever to write a comment explaining the 
> > requirements (myself included ;). It makes easier for people to 
> > diagnose problems with a third-party grammar.
> >
> > Johannes
> 
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
> 
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org/mailman/options/antlr-interest/your-email
-address



More information about the antlr-interest mailing list