Recent

Author Topic: Book recommendation on programming language concepts and design ?  (Read 5276 times)

dtoffe

  • Jr. Member
  • **
  • Posts: 55
Hi all,

    Back in the late eighties I used C. Ghezzi's "Programming Language Concepts", 1st edition ('85) as a textbook at uni. There is a '97 3rd edition available, but before commiting to it I decided to check if there are better / more recent and complete alternatives.
    I'm looking for a book which covers languages concepts in general, with an eye on language design decisions and how features are implemented by the compiler or interpreter, although I know compiler construction merits a book on its own.
    Thanks and sorry if this is considered off topic.

Daniel

440bx

  • Hero Member
  • *****
  • Posts: 3921
Re: Book recommendation on programming language concepts and design ?
« Reply #1 on: August 07, 2018, 11:50:26 pm »
I have no doubt you will get a lot of replies and every one is going to have their own opinion as to why the book they recommend is good.   Here are the few books which I consider superlative and why.

1. Oh Pascal by Doug Cooper

Aside from teaching Pascal, the author teaches the programmer that before writing a line of code, one should carefully think about how the program is to be implemented and the consequences of the choices made.  Too many programmers write code first and think later (and the latter is a "maybe".)  Once the program seems to work (strong emphasis on "seems"), they declare it done.  The result is usually better characterized as a bug nest than a program.

2. Brinch Hansen on Pascal Compilers by Per Brinch Hansen.

IMO, one of the best books ever written.  The book is about writing a simple (subset) of Pascal.  The compiler produces code for a virtual CPU.  He implements both, the compiler and the virtual/soft CPU.  There is a great deal to learn from that book.  As much about compilers/interpreters as how to write a program that is demonstrably correct and can be systematically tested to prove its correctness.  Brinch Hansen's books are superb but, that one is my favorite.

3. Algorithms by Robert Sedgewick (get the second edition, cheap and great)

The beauty of this book is that it contains most algorithms you'll need.  Each one is carefully analyzed and implemented.  That book is a programmer's second right hand.  Donald Knuth's books are great but they take a little more space than I can spare on my desk but, if you want to dig deep into the art of programming, his books are a treat.


4. Compiler Design in C by Allen Holub and Compilers: principles, techniques and tools by Alfred Aho (the "dragon" book)

Definitely both excellent books and good reading after Brinch Hansen's book on Pascal compilers.


5. Polishing Windows - Dave Jewel

Forgetting the Windows part.  What's good about that book is that it is in a way very similar to Doug Cooper's "Oh Pascal".  He gives a lot of recommendations that are about good programming and how to keep programs simple and correct.  One example of that is, how to design and code a program so that it doesn't have any global variables.   


6. Programming Pearls and More Programming Pearls by Jon Bentley.

It's not just about the programming pearls but, how they ended up being the pearls they are.   That's the best part of it.  The pearls are the cherries on the binary cake.

Have fun reading.

« Last Edit: August 07, 2018, 11:54:57 pm by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Book recommendation on programming language concepts and design ?
« Reply #2 on: August 08, 2018, 06:15:07 am »
Hi all,

    Back in the late eighties I used C. Ghezzi's "Programming Language Concepts", 1st edition ('85) as a textbook at uni. There is a '97 3rd edition available, but before commiting to it I decided to check if there are better / more recent and complete alternatives.
    I'm looking for a book which covers languages concepts in general, with an eye on language design decisions and how features are implemented by the compiler or interpreter, although I know compiler construction merits a book on its own.
    Thanks and sorry if this is considered off topic.

Daniel
as far as I know there are no texts about programming language design (the existance of c/c++ and its clones is a clear clear demonstration of this fact not to mention the brain fuck language). The base rules can be found in any compiler construction kit (which characters can be used and so on and so forth).  beyond that, the sky is the limit. 
« Last Edit: August 08, 2018, 07:49:12 am by taazz »
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Thaddy

  • Hero Member
  • *****
  • Posts: 14159
  • Probably until I exterminate Putin.
Re: Book recommendation on programming language concepts and design ?
« Reply #3 on: August 08, 2018, 08:42:15 am »
It depends on what you really want.
- Do you want to design a computer language?
- Do you want to know how to write a compiler?
The subject is rather broad: my personal library contains several ten's (less than 100 but over 80) books on the above subjects.

E.g. ad 2 there is a very good introductory course at tutorials point: https://www.tutorialspoint.com/compiler_design/index.htm

It references many sources too.
Note that books from 1997 - as you mentioned - are probably still valid! The concepts did not hugely change, but implementations did. All based on concepts that were already established in the '50's of the last century. (Not to mention Ada Lovelace and Babbage)
« Last Edit: August 08, 2018, 08:53:33 am by Thaddy »
Specialize a type, not a var.

taazz

  • Hero Member
  • *****
  • Posts: 5368
Re: Book recommendation on programming language concepts and design ?
« Reply #4 on: August 08, 2018, 09:46:39 am »
if we are going to stick to compiler design and ignore the language part of the question then a good starting point, although OP already mentioned that he is beyond the starting point, is crensaw's lets build a compiler article   
I have no inside on the various differences between the various books and if you do get anything out of reading multiple of them but the dragon book mentioned by 440bx is highly regarded in the field. 
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

dtoffe

  • Jr. Member
  • **
  • Posts: 55
Re: Book recommendation on programming language concepts and design ?
« Reply #5 on: August 14, 2018, 02:13:17 am »
    Thanks you all for your answers.

@440bx: The dragon book I already have, the first edition, and learned a lot from it. Your suggestions don't seem to contain the kind of subjects as found in Ghezzi's book that I proposed as an example. I'm looking at books like "Essentials of programming languages", 3rd edition by Friedman, or "Practical foundations for programming languages" 2nd Edition, by Harper, these are just examples. I have to admit both "Oh Pascal" and "Brinch Hansen on Pascal Compilers" have piqued my curiosity.

@taazz: A good search yields some results on programming languages design issues, and even patterns. Crenshaw's "Let’s Build a Compiler" I didn't knew, but Wirth's "Compiler Construction" is on my reading list.

@Thaddy: I'm not planning to design a new language or to build a compiler, but I want to enhance my knowledge of how both tasks are done. I just do not want to focus on one specific language or paradigm, but on how things are differently done in each. I know the subject is too broad and no book will have it all.

    Thanks again !!!

Daniel

440bx

  • Hero Member
  • *****
  • Posts: 3921
Re: Book recommendation on programming language concepts and design ?
« Reply #6 on: August 14, 2018, 02:59:38 am »
@440bx: /snip/  Your suggestions don't seem to contain the kind of subjects as found in Ghezzi's book that I proposed as an example.  I have to admit both "Oh Pascal" and "Brinch Hansen on Pascal Compilers" have piqued my curiosity.

Hello Daniel,

I have to admit  I have not read the books you mentioned as examples.  I am guessing you are looking for a book (or books) that dissect the semantic design of a computer language.  If that is correct, I have not seen one. All the books on compilers are much more about implementation than language design.

I would really like to find a thorough and formal analysis of the correlation between language design and the language's expressive capabilities. How one affects the other.  That would be a fascinating read.  I don't know of any book that comes even close to being that.

As far as Oh Pascal, it really is an introductory book on learning Pascal.  What makes the book special is the heavy dose of clean common sense the author filled the book with.  It really has the potential to make many programmers, better programmers regardless of their experience.

Brinch Hansen, IMO, is in a class by himself.  There is as much to learn about programming (and a little bit about language design) in "Brinch Hansen on Pascal Compilers" as there is on writing a compiler, probably more actually.  Dissect that book, including the programming, testing, methodology and there is plenty to learn there.  Downright superb.

If you find a good book on analysis of computer language design, don't hesitate to share ;)



(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

dtoffe

  • Jr. Member
  • **
  • Posts: 55
Re: Book recommendation on programming language concepts and design ?
« Reply #7 on: August 16, 2018, 02:22:30 am »
I have to admit  I have not read the books you mentioned as examples.  I am guessing you are looking for a book (or books) that dissect the semantic design of a computer language.  If that is correct, I have not seen one. All the books on compilers are much more about implementation than language design.

    As Thaddy said, the subject is rather broad. I want to read about syntactic and semantic elements, typing schemes, type checking, stack and heap usage, how do you implement generic types, how do you resolve method lookup in an inheritance tree, exception handling, concurrency, etc, in a wide variety of programming languages. Bonus for functional and logic paradigms, which Ghezzi covers, and possibly other subjects and paradigms as well.

I would really like to find a thorough and formal analysis of the correlation between language design and the language's expressive capabilities. How one affects the other.  That would be a fascinating read.  I don't know of any book that comes even close to being that.
.....
If you find a good book on analysis of computer language design, don't hesitate to share ;)

    My wild and possibly uneducated guess is that such a book would need to be almost pure math, I guess, neighboring computability theory and formal languages. I'm afraid I will not be able to know if it is good or not, shall I find it.

Daniel

dtoffe

  • Jr. Member
  • **
  • Posts: 55
Re: Book recommendation on programming language concepts and design ?
« Reply #8 on: August 16, 2018, 02:54:20 am »
I would really like to find a thorough and formal analysis of the correlation between language design and the language's expressive capabilities. How one affects the other.  That would be a fascinating read.  I don't know of any book that comes even close to being that.
.....
If you find a good book on analysis of computer language design, don't hesitate to share ;)

    https://www.sciencedirect.com/science/article/pii/016764239190036W

    Of course I could not follow all the rigurous logic, but the central idea is, if you remove all the syntactic sugar from a language, you start repeating patterns of boilerplate.

Quote
    This raises the question as to what advantages there are to programming in the more expressive language when equivalent programs in the simpler language already exist. By the definition of an expressible construct, programs in a less expressive language generally have a globally different structure from functionally equivalent programs in a more expressive language. But, is this really all we can say about programming in more expressive languages?
    By studying a number of examples, we have come to the conclusion that programs in less expressive languages exhibit repeated occurrences of programming patterns, and that this pattern-oriented style is detrimental to the programming process.

    Hope this helps,

Daniel

440bx

  • Hero Member
  • *****
  • Posts: 3921
Re: Book recommendation on programming language concepts and design ?
« Reply #9 on: August 16, 2018, 04:00:55 am »
    https://www.sciencedirect.com/science/article/pii/016764239190036W

    Of course I could not follow all the rigurous logic, but the central idea is, if you remove all the syntactic sugar from a language, you start repeating patterns of boilerplate.

    Hope this helps,

Daniel

Thank you for sharing that.  I gave it a quick reading and, as you pointed out, it isn't exactly the kind of thing you read while having breakfast.

...  typing schemes, type checking, stack and heap usage, how do you implement generic types, how do you resolve method lookup in an inheritance tree, /snip/ in a wide variety of programming languages.
Those things you usually learn by example.  The implementation will differ from one language to another but, the essence, is pretty much the same regardless of language.

exception handling, concurrency, etc, in a wide variety of programming languages.
Those two are a completely different ballgames because exception handling for instance, can be implemented in quite a few different ways.  A language's syntax will hide the differences in the implementation but, the implementation will have many subtle (and sometimes, not so subtle) consequences.  An example of that is, exception handling in Windows, it is completely different in 64bit than it is in 32bit.  The 32bit implementation uses the stack which means that exception handlers are vulnerable to stack corruption.  The table based system used in Win64 is impervious to stack corruption but requires the compiler to build, what in some cases, are extremely large tables (chrome_child.dll has almost one million entries in the exception handling table.)

Concurrency, that is something that, I personally believe has no place in a language.  Concurrency, and the facilities to make it happen are, IMO, an OS's concern.  A programming language should not try to be an OS, anymore than an OS should try to be a programming language.

Language design is a very interesting never ending subject.   I'll check out Ghezzi's book, you got me interested in it.  :)

Thank you for sharing, Daniel.





(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

alexone

  • New Member
  • *
  • Posts: 17
Re: Book recommendation on programming language concepts and design ?
« Reply #10 on: August 16, 2018, 04:06:35 am »
Almost any free tutorials or old books on programming will work. Stick with procedural languages first.. such as pascal, basic or c.
Learn the feel of programming and how to use tools that go with it. Once you get learn basics, for loops - do while loops -- expression syntax and most
important are the tools.. learn Objects and usage. Many free learning tools here on the web.

I base this on 20 years of coding in many different languages with 8086x assembler as my first professional language. Forgotten in today's languages
are mastery of the tools -- linkers, debuggers and your home in coding -- the editor..

 

TinyPortal © 2005-2018