Tree-sitter grammar length as a measure of language simplicity
I like simple programming languages, and it turns out a nice proxy for simplicity is the number of lines in a treesitter grammar:
| Lang | Grammar LOC | grammar.js |
|---|---|---|
| Clojure | 528 | tree-sitter-clojure |
| Lua | 634 | tree-sitter-lua |
| R | 786 | tree-sitter-r |
| Zig | 898 | tree-sitter-zig |
| Go | 983 | tree-sitter-go |
| Python | 1,229 | tree-sitter-python |
| C++ | 1,603 | tree-sitter-cpp |
| Rust | 1,693 | tree-sitter-rust |
Figures as of
2026-08-27
Lua and R are probably my 2 favourite languages. I have a love-hate relationship with Rust - and the hate tends to come down to issues caused by language complexity. I use Python a lot but I wish I didn't.
Perhaps the moral of the story is what I already knew - I should really try Zig.