ANTLR4 licensing question

500 views
Skip to first unread message

Dov Rosenberg

unread,
Jul 27, 2015, 6:03:46 PM7/27/15
to antlr-discussion
My company is interested in using ANTLR4 within our commercial product. ANTLR is licensed under a BSD license. We are not modifying ANTLR in anyway - we are just using the generated files from ANTLR (listeners, visitors, etc). Here are my questions - I am interested in your opinions:
  • If I use a grammar that is GPL licensed and dont make any changes to it - how is the ANTLR generated code licensed?
  • If I make changes to GPL licensed grammar (or any other licensed grammar) - either to correct a bug or add new features or functionality - do I need to contribute my changes back to the community based on the terms of the grammar license? or is my version of the code considered a derivative work?
Inquiring minds want to know

Thanks in advance

Dov Rosenberg

Gerald Rosenberg

unread,
Jul 29, 2015, 3:31:30 PM7/29/15
to antlr-discussion, dovrose...@gmail.com
Tech opinions on the interpretation and application of the GPL are obviously not going to give you anything that can be relied upon. Given that there are essentially no judicial interpretations to provide guidance, even fully researched legal opinions are going to present many caveats.

The embedding of Members, Action and Semantic Predicate code from the grammar into the generated code at least gives the appearance that any such production will be a derivative work.

In addition, the current Oracle v Google litigation raises the question of whether an API is copyrightable - and by implication whether code written to use a copyrighted API is then legally a derivative work.  Given that a grammar literally defines the API represented by the generated code, any code written to use that particular lexer/parser might be considered a derivative work if an API is copyrightable.

Depending on how that case resolves, the interpretation of the GPL could shift quite dramatically.  But, oddly enough, without making the interpretation of the GPL any more certain in other situations.

Don't construe my answer as legal advice to any end other than you need to retain an attorney to give you advice that you can properly rely on. 

Norman Dunbar

unread,
Jul 29, 2015, 3:49:42 PM7/29/15
to antlr-di...@googlegroups.com, Gerald Rosenberg, dovrose...@gmail.com
Excuse me of I'm completely wrong here, but isn't ANTLR4 licensed under the MIT license? Not the GPL?

I know that my tnsnames (for Oracle ) stuff is under MIT because that's what everything else is!

At least, as much as I remember it is!


Cheers,
Norm.
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

Terence Parr

unread,
Jul 29, 2015, 3:58:13 PM7/29/15
to antlr-di...@googlegroups.com, Gerald Rosenberg, dovrose...@gmail.com
Antlr is bsd 

Sent from my iPhone
--
You received this message because you are subscribed to the Google Groups "antlr-discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to antlr-discussi...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dov Rosenberg

unread,
Jul 29, 2015, 4:10:10 PM7/29/15
to antlr-discussion, gbrose...@gmail.com, pa...@cs.usfca.edu
I think there are a couple of fundamental issues that need to be resolved:
  1. If an organization uses an open source grammar to generate ANTLR code and needs to change the grammar to either fix a bug or add new functionality. What is the process for making those changes? Under what circumstances would a commercial organization need to donate their updates back to the community?
  2. What is the effective license of the ANTLR generated code? ANTLR is based on BSD license which basically says we can redistribute ANTLR code even if we make changes to it as long as we include the original license (BSD). The generated code is NOT covered by a license that I can find
It would be great if the ANTLR org site could STRONGLY recommend a specific licensing agreement that makes it really easy for commercial organizations to use the open source grammars. I would recommend either the MIT or BSD licenses. Ideally - before a grammar would be added to the list of available grammars - the licensing would be required to be one of the acceptable licenses for a commercial project. The ANTLR tool should explicitly state that the code generated by ANTLR is NOT controlled by a specific license

Bence Erős

unread,
Jul 29, 2015, 4:26:06 PM7/29/15
to antlr-di...@googlegroups.com
Hello Dov,

see my answers below

2015-07-29 22:10 GMT+02:00 Dov Rosenberg <dovrose...@gmail.com>:
I think there are a couple of fundamental issues that need to be resolved:
  1. If an organization uses an open source grammar to generate ANTLR code and needs to change the grammar to either fix a bug or add new functionality. What is the process for making those changes? Under what circumstances would a commercial organization need to donate their updates back to the community?
The grammars-v4 repo does not have any common licensing, so every grammar file has different license within the repo. For example it is BSD for the XML grammar and LGPL for visual basic. The rules of sharing your changes are specific to the given grammar, there is no common rule. From the technical aspect, sharing your changes with the community means forking the grammars-v4 repo on github, pushing your changes into it (and sending a pull request to the original repo).
 
  1. What is the effective license of the ANTLR generated code? ANTLR is based on BSD license which basically says we can redistribute ANTLR code even if we make changes to it as long as we include the original license (BSD). The generated code is NOT covered by a license that I can find
Yes, the license of ANTLR covers strictly only the parser generator. It affects neither the grammar files nor the generated code.



--
Bence Erős
CyclonePHP
core developer

Terence Parr

unread,
Jul 29, 2015, 5:18:17 PM7/29/15
to antlr-di...@googlegroups.com, dovrose...@gmail.com
BTW, I should mention that Gerald is an excellent IP lawyer in case anybody needs one. He’s done work for me as well as a friend I sent his way.

Ter

Gerald Rosenberg

unread,
Jul 29, 2015, 5:19:06 PM7/29/15
to antlr-discussion, pa...@cs.usfca.edu, dovrose...@gmail.com
The grammars-v4 README is quite clear:

Beware of the licenses on the individual grammars. THERE IS NO COMMON LICENSE! When in doubt or you don't know what you're doing, please use the BSD or MIT license.

The purpose of the repository is to gather and make available exemplary grammars for the community.  To make that as easy as possible, the choice of license is left to the contributor(s).  Would not be surprised to learn that a contributed grammar was GPL licensed specifically to prevent a commercial competitor from using the grammar outright.

As far as Antlr, as a project, is concerned, it is all BSD.  If a user injects a GPL licensed grammar into the mix, then the user must deal with the viral nature of the GPL.  Really isn't anything Antlr can do about that.

Terence Parr

unread,
Jul 29, 2015, 5:23:14 PM7/29/15
to antlr-di...@googlegroups.com, dovrose...@gmail.com
hi gang. Eclipse.org has officially vetted my license and contributors agreement and found it to be clean for inclusion of ANTLR/ST into eclipse stuff.

I can easily add a license that says generated code is also BSD or perhaps considered a derivative work of the grammar license. The latter is probably more proper but is comment by me sufficient for commercial entity? It sounds like were getting back into lawyer opinion territory. Gerald indicated that there wasn’t a great deal the judicial precedents in the area. The one we do have, Oracle versus Google, which I was an expert witness for (related patent), shows that you can copyright an API.  I should say it was decided by a jury that you could not copyright an API but it was reversed on appeal.

Gerald: any thoughts as to what I should do regarding generated code?

Ter

Gerald Rosenberg

unread,
Jul 29, 2015, 6:32:15 PM7/29/15
to antlr-discussion, dovrose...@gmail.com, pa...@cs.usfca.edu
Ter:

Speaking only in very general terms (certainly not to provide legal advise by way of this list), Antlr is no different from any other OSS project. These projects are not in a position to control or indemnify the use of their software package post distribution.  Consequently, these projects cannot and do not advise on the suitability of their products (or third-party grammars) in a manner, commercial or otherwise, beyond their control.  This is entirely standard in the industry, particularly in light of the Bison licensing kerfuffle*.

If a commercial entity wishes certainty relative to the use of a GPL licensed work, no amount of lawyering alone will be sufficient.  In many, if not most cases, the best path is to negotiate a commercial license directly with the GPL license holder. 

Alternately, and this particularly pertains to Antlr grammars, the best path to certainty is to drop the GPL work entirely and do an independent implementation.

-----

* Because Bison copies a part of itself (independent of the grammar) into the generated code, the production would always be GPL.  The Bison license was changed to provide a release for the code copied from the generator into the production.  The release, however, does not concern any aspect of the grammar used for code generation -- if the grammar is GPL, then the production will also be GPL (according to Stallman).

Bison does not provide any license concerning the grammar that is fed to it; not even a license that warns that it provides no license.




On Wednesday, July 29, 2015 at 2:23:14 PM UTC-7, the_antlr_guy wrote:
hi gang. Eclipse.org has officially vetted my license and contributors agreement and found it to be clean for inclusion of ANTLR/ST into eclipse stuff.

I can easily add a license that says generated code is also BSD or perhaps considered a derivative work of the grammar license. The latter is probably more proper but is comment by me sufficient for commercial entity?

Terence Parr

unread,
Jul 29, 2015, 8:49:34 PM7/29/15
to Gerald Rosenberg, antlr-discussion, dovrose...@gmail.com
yeah, GPL is trouble. Thanks for the (nonlegal) advice!
T
Reply all
Reply to author
Forward
0 new messages