1. 11
  1. 4

    Does anyone know what part of the book is about language design? I feel I know enough about compiler construction, but I’d like to read more about language design. So far I feel language design is 100% art and 0% science, but I’d be delighted to discover that I’m wrong.

    1. 5

      I skimmed over a few chapters (e.g. on semantic analysis) and I don’t think it’s about language design, at least not more than any other compiler book.

      I think language design is mostly art but there some things people can agree on (although they’ve probably not been written down):

      • syntax and semantics should correspond, e.g. similar things should look similar; different things should look different
      • familiar syntax does matter, because applications these days are composed of many languages. e.g. you can be a purist and say = means equality, but if == and === mean equality in the 10 other languages I program in, I will be annoyed with your language
      • There’s no substitute for writing tons of programs. Or conversely a language designed by someone who has only written a few programs will almost certainly be bad / limited

      A pretty good paper:

      Seven Deadly Sins of Introductory Language Design https://users.monash.edu/~damian/papers/PDF/SevenDeadlySins.pdf (although I would say there is a bias toward languages for undergrads in academia, for obvious reasons)

      Programming Language Explorations is a good book that may spark thoughts on language design. Chapter 14 has an explicit list of language design questions


      I recommended it 3 years ago: https://old.reddit.com/r/ProgrammingLanguages/comments/d0o85t/nice_book_for_language_designers_programming/

      1. 3

        I feel that there is a lot of math & science available to be applied to language design. I’ve been doing a deep dive into this. I don’t really see much, if any, of this math and science reflected in the textbook’s table of contents.

        It looks to me that this book is stuck in an era where C and Pascal were at the leading edge of programming language design, and where syntax design is the main area where you apply math and science (formal methods) for language design. Eg, creating a BNF grammar for the syntax. I personally feel that syntax design is relatively shallow and trivial, and that the most important areas of language design, where math and formal methods should also be used, are elsewhere.

        I don’t have a book or website that adequately summarizes this. It’s just that I’ve read hundreds of academic papers on programming language design, full of math, and have been working to pull out the parts that are relevant to my design goals. It’s hard to summarize.