
How to Measure Programming Language Complexity
Here’s a useful metric for programming language complexity: the number of keywords or reserved words in the language. This corresponds roughly to the number of language features and, hence, the size of the language.
- F# — 69 + 8 from OCaml + 26 future = 103
- C# — 79 + 23 contextual = 102
- C++ — 93
- Swift — 93
- Kotlin — 30 + 17 soft + 29 modifiers + 2 special = 78
- PHP — 67
- Nim — 66
- JavaScript (or ECMAScript)—64 (or 34 + 7 future = 41)
- Dart — 56
- Haskell — 55
- Rust — 35 + 17 future = 52
- Java — 50
- Perl — 40
- Scala — 40
- Ruby — 39
- Julia — 38
- Objective-C — 37
- Scheme — 37
- Python — 33
- C — 32
- Go (or Golang )— 25
- Lua — 21
- Elixir — 18
- Smalltalk — 6
Note that for JavaScript, if you’re working with legacy code, you may have to deal with the larger language (64 keywords).
The metric isn’t perfect but it provides a reasonable indicator of complexity. Obviously, C++ and Swift are very large and complex languages. F# has the potential to be the most complex language on the list.
JavaScript is considerably more complex than Java, and ECMAScript is certainly more complex than Python.
Smalltalk. What can I say? Languages don’t get any simpler than this one (except for Forth).