What relations and differences are between formal semantics for linguistics and for programming languages? I browsed the table of content of Cann's Formal Semantics, which   reminds me  of the things that I saw in programming language books.
Cann's book is for linguistics, and am I right that it is helpful for computational linguistics and natural language processing, another active research area of computer science? (Side note: it also seems to me that the approaches to NLP have been predominantly based on statistics and machine learning in applications (and maybe also research), which I think is completely unrelated to formal semantics?)
Do formal semantics of linguistics and semantics of programming languages (and the ways of study each of the two) have more common ground than differences?  What are their common ground and what are their differences?  Are books on one helpful to study in the other?
Thanks.
This question is very open-ended and therefore difficult to answer, but I think the short answer is &quot;yes&quot;, there is much common ground, the two areas have in fact benefited from interaction in the past, and they have much to gain from further interaction.
Two classical examples of this (respectively from the 1950s and '70s) are Lambek grammar and Montague grammar, which model different aspects of natural language using sequent calculus and lambda calculus (which have become cornerstones of programming language theory, with connections to category theory and type theory).
In relatively more recent history, personally I found Ken Shan's dissertation Linguistic side effects (2005) an inspiring exploration of the thesis that natural languages and programming languages have more common ground than differences.  To quote a bit from the introduction:

This dissertation is about computational linguistics, in two senses. First,we apply insights from computer science, especially programming-language semantics, to the science of natural languages. Second, we apply insights from linguistics, especially natural-language semantics, to the engineering of programming languages. The phrase “computational linguistics” has a popular third sense, which is natural-language processing: teaching computers to listen to, speak, read, and write natural language. That is not our aim, even though the research described here indirectly helps it—by enhancing our understanding of natural and programming languages.

Chris Barker has also written extensively about the concept of continuation from programming languages semantics and how it may be used to illuminate the nature of quantification in natural language, and the two have recently collaborated on a book which explores this topic further.