Is there an objective measure of a programming language's complexity in terms of syntax and semantics, not how complex the language is to use ?
I've read many subjective comments but little rigorous analysis.
Is there an objective measure of a programming language's complexity in terms of syntax and semantics, not how complex the language is to use ?
I've read many subjective comments but little rigorous analysis.
How complex the language is to use is completely subjective.
On the other hand, questions about how complex the language semantics are, can be answered, but only when compared with other languages. These are not necessarily useful, however. For example, I would give Smalltalk a semantic complexity of 1 and C++ a complexity of 9. However, I will bet anything that the browser you are reading this in is written in C++, not Smalltalk.
If there is such an objective measure, it is probably very nearly useless for evaluating the utility or cost of using a given language for a given purpose. It'd help you rule out whitespace or brainfuck, but that can be done just as easily without expending resources on such an objective measure—by subjectively observing source code and realizing you'd never want to do serious work with it.
Most languages are going to have a lot of positives and negatives that you'd need to weigh against the goal you're trying to achieve and the conditions that need to be met.
The best measure I've seen of a language is the probability that a random string will be a valid program. Perl is a language that ranks high on this scale, Ada ranks rather low.
What this metric means is another issue entirely.
As a general rule, the more dynamic and abstracted the syntax or semantics or implementation are, the more complex the language (not to use as you stated).
Hence, Java is a more complex language than C, because:
I would argue Python simpler than Java on this basis, because it's object model, whilst complex, is simple in terms of reduction into a simpler form. The ease in which a given syntax can be translated into a simpler form from a time and calculation perspective might also be an angle.
A language such as lisp on the other hand, some would argue is complex to use but very simple. The same goes for things like Haskell.
You could measure complexity in one of the following ways, but non are complete:
There are tons of ways. You could measure computational complexity of the compilation process for a given syntax.
Not all of these examples are true. Some object models are very complex, but very fast because they use a fast foundation. Self might be an example.
The easiest two entirely objective things to look at would be the amount of languaged defined symbols and keywords/reserved words, and the amount of productions in its BNF.
Another thing you could look at, for those languages that have them, is the relative sizes of their standards documents. Some would argue that not all standard documents are written at the same level, though.
I think if you look in the area of proof-of-correctness you'll find more detailed analysis of semantic complexity. Systems like CSP (and to a lesser extent, Lambda Calculus) are designed to be tractable via analysis. The closer a language is to being an expression of the underlying formal system, the simpler it is from a semantic standpoint.
The counter-example would be something like the C programming language. It's not possible to figure out what a C program actually does, without knowing what OS and hardware it'll be run on.