Legal uses of lex & yacc

Victor Kan kan at dg-rtp.dg.com
Wed Feb 21 12:24:21 AEST 1990


In article <90049.104719MCCABE at MTUS5.BITNET> MCCABE at MTUS5.BITNET (Jim McCabe) writes:
>I've recently become familiar with lex and yacc, and am wondering about
>the legal status of the code generated by these programs.  Is it legal to
>use a yacc-generated compiler (and a lex-generated lexical analyzer)
>for part of a public-domain software package?  For example, if I used lex
>and yacc in a language interpreter I wrote, would it be permissable to
>distribute my program freely over networks and such?  In the Sun lex and
>yacc manuals, they never mention this at all, so I'm worried.  ;)

It all depends on how you distribute your program.  If you release the 
source code as PD before you pass it through Lex and Yacc, there's probably
nothing anyone can do to stop you.  People who want to use your software
can just use their licensed copies of Lex and Yacc.  Or they may
use Bison or Bob Corbett's Berkeley Yacc.  There may be a PD Lex 
out there, or someone my convert your Lex code to Flex.

But if you intend to distribute only C code, i.e. after you've run
your work through the "Official" Lex and Yacc, you can be prosecuted
for copyright infringement!  That's because Lex and Yacc include
copyrighted data files into their analyzers and parsers 
(/usr/lib/lex/n[cr]form and /usr/lib/yaccpar, respectively).

If you pass the Yacc grammar through Bison for distribution, your
parser, and perhaps your entire program will fall under the 
Free Software Foundation's COPYLEFT.

For true PD status, you'd have to use Bob Corbett's Berkeley Yacc
which has been made PD by the author, I believe.

The same thing goes for your Lex code.

>                                                Jim McCabe
>                                                MCCABE @ MTUS5.BITNET


| Victor Kan               | I speak only for myself.               |  ***
| Data General Corporation | Edito cum Emacs, ergo sum.             | ****
| 62 T.W. Alexander Drive  | Columbia Lions Win, 9 October 1988 for | **** %%%%
| RTP, NC  27709           | a record of 1-44.  Way to go, Lions!   |  *** %%%



More information about the Comp.lang.c mailing list