Is linguistics a superset of programming language theory?
There's a programming language theory? I mean don't get me wrong
- There's a Wikipedia page
- A number of books on it
- And even a course or two you'll be taking if you're Majoring in CS,
yet I don't think all programmers would necessarily accept it as a full-fledged discipline.
Rather I think we as programmers would consider constructing and analyzing programming languages to be a design problem, which relies on many fields within the greater domains of computation, logic and even linguistics.
What delineates the difference between the study of language and the study of programming languages?
Linguists are interested in languages humans use to communicate with one another, whether it be the syntax, semantics, phonology, orthographic representations, psychological and sociological factors which it is dictated by, to name just a few aspects to consider.
As for programming languages, you don't see anyone called a computer-linguist, this is what I meant when I said that I don't think a single discipline for designing programming languages is widely recognized. You can however be a computer scientist, who can specialize in many fields, one such being designing or analyzing programming languages.
The goal of designing a programming language is to find a nice way to communicate operations and instructions for a computer to perform.* The goal of analysis is to compare the capabilities and design choices of different languages, not to be confused with implementation performance.**
Ok then, assuming you're a computer scientist (or even a hobbyist, you don't really need any qualification for this) working on designing a programming language. You may do this informally based on features in previous languages you're familiar with. Or you may choose to do this formally, usually if you're going to try and introduce a new paradigm, by consulting mathematical literature on
- formal semantics
- previous material by other computer scientists
- or theories and grammar-types proposed by linguists.
Your next question is especially related to this:
Programming languages define syntax and semantics of code. Does this mean programming languages are a subset of languages?
Not all programming languages are required to do this actually, check out Deadfish which practically has no (or absolutely-free) syntax: https://esolangs.org/wiki/Deadfish or Plankalkül : https://en.wikipedia.org/wiki/Plankalkül
But as you probably have seen, unlike these two obscure languages, the more popular languages at least somewhat resemble human-to-human languages on a surface level. To put things into perspective, we need to talk about the crux which binds programming and modern linguistics: The Chomsky Hierarchy.
[Image Source: https://upload.wikimedia.org/wikipedia/commons/thumb/9/9a/Chomsky-hierarchy.svg/400px-Chomsky-hierarchy.svg.png]
Also known as the Chomsky–Schützenberger hierarchy, it establishes a set of rules which can be used to generate various types of grammars. In particular Context-Free-Grammars are of interest, for allowing recursive grammar rules. This would go on to inspire Backus-Naur form, which would be influential in the design of new languages for a few generations.
Since it's a bit off-topic I'll just link 2 stack exchange questions if you'd like to learn more.
Today's programming languages don't make as much as an effort to ensure "context-free grammar" rules, since grammatically correct statements might lead to logical issues. But the point still remains, human-to-human languages are good teachers when it comes to studying what features might make a good language. And so, the computer scientist will turn to linguistics for inspiration from time to time.
In conclusion, whether there is a programming language theory is debatable, what is certain though is that any theory involving the design of programming languages is very intertwined with linguistics.
*Although I should note that communicating with computers using human-to-human languages is also a topic of interest, though it's mostly restricted to the field of Human-Computer Interaction.
**For instance Python is sometimes called a "slow-language" but this is related to the standard CPython implementation. PyPy, an unofficial implementation is able to run much faster. This isn't due to "information density" or anything, but the interpreter or compiler which evaluates the language in the background.