[comp.lang.c] Legal uses of lex & yacc

MCCABE@MTUS5.BITNET (Jim McCabe) (02/18/90)

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.  ;)


                                                Jim McCabe
                                                MCCABE @ MTUS5.BITNET

meissner@osf.org (Michael Meissner) (02/21/90)

In article <90049.104719MCCABE@MTUS5.BITNET> MCCABE@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.  ;)

I don't know about Berkeley Unix, but System V.2 changed the license
agreement such that the output of lex and yacc does not require a UNIX
license, and may be distributed freely.  To actually run lex and yacc,
still requires a UNIX licence.  I believe, but have no direct
knowledge that Berkeley Yacc's output can be used without an AT&T
derived licence.

Bison from the Free Software Foundation (bison is a yacc replacement)
does require that anything using bison, be subject to the same terms
that bison is (the copyleft) -- basically where the full source must
be available (not necessarily free), and that you can't place
redistribution rights on third parties who get either your source or
binaries.

I don't know what the terms for FLEX (the faster lex) are.

--
Michael Meissner	email: meissner@osf.org		phone: 617-621-8861
Open Software Foundation, 11 Cambridge Center, Cambridge, MA

Catproof is an oxymoron, Childproof is nearly so

kan@dg-rtp.dg.com (Victor Kan) (02/21/90)

In article <90049.104719MCCABE@MTUS5.BITNET> MCCABE@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!   |  *** %%%

jwl@ernie.Berkeley.EDU (James Wilbur Lewis) (02/21/90)

In article <271@xyzzy.UUCP> kan@tom.dg.com () writes:
-In article <90049.104719MCCABE@MTUS5.BITNET> MCCABE@MTUS5.BITNET (Jim McCabe) writes:
->Is it legal to
->use a yacc-generated compiler (and a lex-generated lexical analyzer)
->for part of a public-domain software package?  
-
-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).

I just looked; none of these files contain copyright notices. 

It'd be silly to copyright those files, because that would
render these tools useless for commercial software development!
You couldn't even distribute the binaries because they're derivative
works (right?)  

(The Bison skeleton is another story -- the reason it's copyrighted is not 
to *prevent* copying, but to *encourage* people to share their (and FSF's!)
code.)

-- Jim Lewis
   U.C. Berkeley

johnl@esegue.segue.boston.ma.us (John R. Levine) (02/22/90)

In article <271@xyzzy.UUCP> kan@tom.dg.com () writes:
>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!  ...

I wish people would check their "facts."  AT&T has for several years
explicitly permitted programs built with lex and yacc to be redistributed
without restriction.  The same goes for executables built with the C library.

For those who don't like yacc and lex, Bob Corbett's Berkeley Yacc is
entirely public domain.  Vern Paxton's flex is subject to the Berkeley
copyright (which allows unlimited redistribution so long as you include
Berkeley's copyright and disclaimer.)  The flex parser skeleton is public
domain.
-- 
John R. Levine, Segue Software, POB 349, Cambridge MA 02238, +1 617 864 9650
johnl@esegue.segue.boston.ma.us, {ima|lotus|spdcc}!esegue!johnl
"Now, we are all jelly doughnuts."

kan@dg-rtp.dg.com (Victor Kan) (02/22/90)

In article <34421@ucbvax.BERKELEY.EDU> jwl@ernie.Berkeley.EDU.UUCP (James Wilbur Lewis) writes:
>In article <271@xyzzy.UUCP> kan@tom.dg.com () writes:
>-In article <90049.104719MCCABE@MTUS5.BITNET> MCCABE@MTUS5.BITNET (Jim McCabe) writes:
>->Is it legal to
>->use a yacc-generated compiler (and a lex-generated lexical analyzer)
>->for part of a public-domain software package?  
>-
>-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).
>
>I just looked; none of these files contain copyright notices. 

Hmmm.  I just looked at another machine (i386 running 386/ix) and its
version of those files have no copyright notices in them.

When I first posted, I only looked on my workstation (m88k running DG/UX).
It's files do have copyright notices in them.

Since someone has responded to this query saying that AT&T has changed
the license for Lex and Yacc output, I assume that it would be OK
to distribute the output.  (I can't be sure, so don't rely on what I say :-)

>It'd be silly to copyright those files, because that would
>render these tools useless for commercial software development!
>You couldn't even distribute the binaries because they're derivative
>works (right?)  

No, it wouldn't render Lex and Yacc useless for commerical software
development.  Users with commercial Unix licenses are allowed to 
distribute their products via their licensing agreement.  That's what
licenses are for.  Users of those binaries will most likely be running
them on machines with a Unix licenses as well (unless they're running
Mach in BSD-emulation mode). 

I remember when it came time for Columbia Univ. to renew some of it's
SunOS licenses last year.  I assume that if a machine's Unix license 
expires, it becomes illegal for that machine to run anything 
compiled with any tools, libraries, header files, etc., which
do fall under the license agreement.

Presumably, people who generate software for machines using shared or
dynalink libraries are somewhat luckier than those generating pure 
executables because they don't have to include copyrighted 
libraries in their binaries.

This one I am sure of:  header files in /usr/include on SysV
contain AT&T proprietary source code copyright notices that prohibit
distribution of those header files.  A company can distribute software
compiled with those header files because their license with AT&T allows
them to do so.

>(The Bison skeleton is another story -- the reason it's copyrighted is not 
>to *prevent* copying, but to *encourage* people to share their (and FSF's!)
>code.)

True, but it prohibits you from releasing the generated C code into
the public domain, as the original poster implied.  

COPYLEFT != PD !!!!!

But let's not start the Nth Copyleft debate.

BTW, I love GNU stuff and use it all the time.  I'm not sure I like/dislike
the Copyleft, but I know I like the software.

Isn't there a copyright notice for the Trustees of UC in the /usr/include
header files on BSD Unix?

>-- Jim Lewis
>   U.C. Berkeley

| 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!   |  *** %%%

henry@utzoo.uucp (Henry Spencer) (02/23/90)

In article <292@xyzzy.UUCP> kan@tom.dg.com () writes:
>>I just looked; none of these files contain copyright notices. 
>
>Hmmm.  I just looked at another machine (i386 running 386/ix) and its
>version of those files have no copyright notices in them.

This is largely irrelevant.  Pieces of Unix are covered by nondisclosure
agreements that are part of the licenses.  Such agreements do not require
any form of notice in the files.  (In fact, some readings of the laws at
some times in some places have concluded that copyright notices imply
publication, which voids nondisclosure agreements!)  The license also
contains a clause obliging you to make all your users comply with it too,
as I recall.
-- 
"The N in NFS stands for Not, |     Henry Spencer at U of Toronto Zoology
or Need, or perhaps Nightmare"| uunet!attcan!utzoo!henry henry@zoo.toronto.edu