The code is a derived work of the grammar. (but not of ANTLR)
- The Grammar file is a description of how to parse the language, written in EBNF.
- The source code generated by ANTLR etc is a description of how to parse the language, written in Java (etc).
- The source code was derived from the Grammar, using ANTLR.
- It is thus a derived work, of the Grammar (but not of ANTLR).
It would make very poor sense for ANTLR to try to claim that anything made using it was a derived work. Like painting is not a derived work from a paint brush, or a letter a derived work of the word processor. I won't go into that further, (I think that further details should go in another similar question with different emphasis)
The GPL uses the term "work based on" rather the derivative work, but I believe though are synonymous
Thus derivative works must be licensed.
Consider translating between two main stream programming languages.
(EBNF is essentially a programming language, as is Java.)
The translated source code is clearly a derived from the original.
To give a concrete example:
- I have some source code, written in Dart I used dart2js to convert it to Javascript for execution in the browser.
- My Dart source code, is analogous to your Grammar file
- dart2js is analogous to ANTLR -- changing one language to another
- the Javascript output which I incorporate into my overall webapp is the Source Code, which you incorperate into your project
- If I released the Dart code under the GPL, and then someone else run dart2js on it and said it was a original work; well they would be incorrect, and obviously so. (NB: I have not released the linked code under GPL or any other license)
- The source code is not a derived work of
Consider also the non-software examples:
I have written a play. I producted a Play script in English, and it was translated to Russian.
- The play script, is a set of instruction on how to produce the play. How to move on stage, what to say when to say it etc.
- The English playscript is your Grammar File.
- The Translator is your ANTLR
- The Russian playscript is your Source Code produced.
- The Russian playscript is a derived work from my English original.
Or I have a music score (sheet music) it describes a song in musical notation.
- I have my band play the song, and I record it into a MP3.
- I now have a description of the song, in MP3 form
- That recording is a derived work
- Or, say I used OCR tool to convert it to MusicXML
- The sheet music (score) is exactly analogous to your EBNF grammar
- The OCR tool is analogous to ANTLR
- The MusicXML file generated is analogous to your generated class files
- The MusicXML was derived from the score
Taking one work, and using it as the bases for another work is creating a derived work.
It doesn't matter if it looks different, it is still derived.
Your modified grammar would still have to be licensed under the GPL if released (it is obviously derived, as given by the words "modified"),
as would any code generated from it, thus your whole project would have to be under the GPL.
The short of it is: The Grammar is under a viral license, therefore anything derived from it is under that license (otherwise what would be the point in licensing it under a license that does not allow relicensing?). Producing source code is producing a work based on the grammar (like any translation). Thus the source must be under the viral licence
(But, I'm not a lawyer and I am not your lawyer)