How to Measure Programming Language Complexity

Richard Kenneth Eng
2 min readJan 5, 2018

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.

  1. F# — 69 + 8 from OCaml + 26 future = 103
  2. C# — 79 + 23 contextual = 102
  3. C++ — 93
  4. Swift — 93
  5. Kotlin — 30 + 17 soft + 29 modifiers + 2 special = 78
  6. PHP — 67
  7. Nim — 66
  8. JavaScript (or ECMAScript)—64 (or 34 + 7 future = 41)
  9. Dart — 56
  10. Haskell — 55
  11. Rust — 35 + 17 future = 52
  12. Java — 50
  13. Perl — 40
  14. Scala — 40
  15. Ruby — 39
  16. Julia — 38
  17. Objective-C — 37
  18. Scheme — 37
  19. Python — 33
  20. C — 32
  21. Go (or Golang )— 25
  22. Lua — 21
  23. Elixir — 18
  24. 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).

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

Responses (8)

Write a response