6

I decided to write a compiler as a learning experiment. I first started by following some random tutorials here and there and built something that I called by naive implementation. (Since there's a lot of guessing that went into it).

I then decided to buy a book that treated the subject (https://www.amazon.ca/dp/0470177071). The book provides a very "step by step" way of building such software.

In order to learn from it, and to not do a direct rewrite of what is written in it (because it pretty much gives you an implementation), I decided to read the intro parts, and then try to build something from there, and if I was stuck / couldn't go forward I would read the suggested code and then implement it. Throughout the code, I comment on why some parts interact with other parts, I reference my "naive implementation" and compare the two solutions.

It happens that the compiler showed in the book and the compiler I wanted to build treated the same language. (I didn't know this at the moment of purchase). Which makes it a little harder to make it very different.

Beside the general framework (packages layout, interfaces), my code is pretty much different that the one provided in the book, but many ressemblances can be found, and obviously some parts are almost identical.

My question

I was thinking of open sourcing the result of the code I have written, and explaining that it is sort of my journey through the book. I wanted to licence it as MIT, but since it is derived work from the book, is it OK to do so?

1 Answer 1

4

For clarity, let me focus only on the parts that you did copy or derive from the book (as in copy-then-modify). Parts of code that are your own original creation are yours and you can therefore license these under any terms you please including the MIT.

When you copy code from a book, what you copy is subject to a license whether explicit or not. And you cannot reuse significant elements from a book without the proper permission from the author or publisher (e.g. whoever owns the rights). In this case, Ronald Mak has a web site where the source code of this books is also available for download.

Most of the files have a copyright from Ronald Mak and one seems to have been written while he was working at NASA Ames Research Center. There are no specific rights granted in the code, documentation or on the web site beside this statement found in the code: For instructional purposes only. No warranties.

Short of other rights granted by the author, you cannot do much with this code (or its printed version) and certainly you are not allowed to include significant chunks of it and relicense this using an MIT license: you do not have a license in the first place that allows you to do this. If I were you I would contact Mr. Mak to ask for a permission (if he actually own this and not his publisher.)

3
  • This isn't quite as cut and dry as you make it sound. It sounds like the vast majority of the work is definitively OPs code, and they can license that as they please. The tough spot is any code that was directly copied. Your answer only applies to those (seemingly small) portions. It would be nice if you clarified that.
    – RubberDuck
    Jan 15, 2017 at 17:43
  • I thought my answer is clear that it is about the parts that are copied? Jan 15, 2017 at 19:34
  • @PhilippeOmbredanne I also first read it as only applying to the copied parts, because I already knew that was the rule. However in rereading it after RubberDuck's comment, I see how that point might be missed by someone naive about this. Maybe a small edit to emphasize that point would help.
    – MAP
    Jan 17, 2017 at 2:52

Your Answer

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

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