If I used a GPL 3.0 licensed program like jacc to generate a parser generator which I incorporate into an MIT licensed program, do I have to release my program as GPL?

Note that the grammar definition used comes from an MIT licensed project, but the generated parser necessarily also includes code snippets which originate in the GPL licensed parser generator.

  • Do you need to link against a library that comes with that parser? Apr 8, 2019 at 1:40
  • 1
    @AlexisWilke - no, the generator generates a standalone source file with no external dependencies.
    – BeeOnRope
    Apr 8, 2019 at 3:54
  • 1
    Great then you're good. The output of a GPL tool is not itself covered by the GPL. Apr 8, 2019 at 4:13
  • 1
  • 2
    @AlexisWilke: Parser generators are a bit special, because it is fairly common that portions of the parser generator itself also end up in the output. In that case, the output file is a derived work of both the input and the parser generator and the license of both needs to be taken into consideration. Apr 8, 2019 at 16:05

2 Answers 2


A program like a parser generator or a compiler is quite useless unless you can use it's output as you please. For example, the GNU parser generator bison adds the following note to generated code:

/* As a special exception, you may create a larger work that contains
   part or all of the Bison parser skeleton and distribute that work
   under terms of your choice, so long as that work isn't itself a
   parser generator using the skeleton or a modified version thereof
   as a parser skeleton.  Alternatively, if you modify or redistribute
   the parser skeleton itself, you may (at your option) remove this
   special exception, which will cause the skeleton and the resulting
   Bison output files to be licensed under the GNU General Public
   License without this special exception.

   This special exception was added by the Free Software Foundation in
   version 2.2 of Bison.  */

Simply put - the copyright law does not allow you to change the license of work that belongs to someone else.

The best would be not to mix up code with different licenses to begin with.

If you absolutely have to do this then at least keep them in separate files because you can license files separately.

If you can't do that, then legally you can't do it.

It's also not legal if you mix up MIT code with GPL code and license all of it under GPL, because you just infringed the MIT copyright. Neither can you license it all under MIT because you would infringe the GPL copyright. Simple.

  • 1
    Keep in mind that I'm asking about a specific case of using a generated parser with GPL code (but not including the generator code itself) in an MIT project, so it is not a simple case of inclusion. One might similarly ask if code compiled with a GPL compiler itself falls under the GPL, etc.
    – BeeOnRope
    Apr 18, 2019 at 23:08
  • @BeeOnRope If there is no generator code included, then GPL does not affect you. But in your question you mentioned something about "also includes code snippets which originate in the GPL" or did I misunderstood something? Generally speaking I personally don't know any case where compiler license (any) would have affected code being compiled. But I'm no expert on compilers, maybe compiling compilers is different...
    – Smart455
    Apr 19, 2019 at 9:42
  • well I wrote that before checking carefully the parser generated code, but I still think it is more or less accurate: certainly some lines of code come from templates built into the generator, but in this particular case (jacc) there don't seem to be substantial multi-line chunks of code included verbatim.
    – BeeOnRope
    Apr 19, 2019 at 16:34
  • @BeeOnRope Even one line of code can be copyrighted and copyleft relies on it. GPL is protectionist license and FSF/Gnu will go out of their way to protect their corporate interests and their ecosystem. Since your case could be argued both ways, it isn't 100% legally safe and that's why I wouldn't recommend you to do this. Maybe no-one notices and you might get away with it, but as I said, that's not my recommendation.
    – Smart455
    Apr 19, 2019 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.