It is possible to retain the current design while improving the Tree-Sitter grammar. Fixing minor bugs and leveraging it scope from maybe 70% to 90% (just a guess).
It is a language design decision. Ruby, for example, has a minimal ts grammar. Haskell also features layers of code de-sugaring.
Just looking at the colors in your screenshot, it is possible to see the same color in curve: and amp:, even when they have different semantics. The same happens when a method using the syntax method: is treated as an operator.
In sclang all binary operators are evaluated left-to-right (so 2 + 3 * 4 = (2 + 3) * 4), and the only ātighterā binding is that message sends (method chains) group before binary operators.
To actually take advantage of a TS grammar, we need to think about those things. Regular expressions are good enough for syntax highlighting.
In other words, Tree-sitter is a next-generation GPS system designed for cities with regular grid patterns. SuperCollider is more like Venice - beautiful and functional, but following its own logic that doesnāt map neatly onto standards. The developers need to decide how to design something that does not force SuperCollider into a strange worldview but adapt Tree-Sitter tech to grow in line with SuperColliderās nature.
My intuition is that a ālayered semanticsā approach would be appropriate, while using ts grammar just for syntax highlighting is not a big step forward.
Instead, find the use-cases that TS grammar can excel, while keeping it as simple and maintainable as possible:
a) identifying syntactic structures quickly and accurately - but donāt ask it to understand SuperColliderās semantic peculiarities. In other words, the ts grammar should be deliberately dumb about semantics, focusing only on structural patterns.
b) Contexts: special meanings in different places (like inside a SynthDef, a Pattern, JITLib, a DSL, etc).
c) The best design decisions will be those that embrace this uniqueness, where different people can work on various parts of a design while modernizing SC.