[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] A tree-sitter code parser for SC



Hello all

Just wanted to let you know I started work on a grammar for SuperCollider mapping out the language for use with the tree-sitter code parser (https://tree-sitter.github.io).

It's in an early experimental stage but most of the language has been mapped in the grammar (phew!) so it can handle simple code examples now. I mostly made this to be used in neovim where I do all my coding (and have become addicted to using tree-sitter for c++ and lua projects) but it should be possible to implement in scide aswell if interested.

There are basically three features in tree-sitter that inspired me to do this:

- Scoped syntax highlighting - this makes it possible to easily see if a variable is local, an environment variable, class variable, builtin or an argument and thus makes code a heck of a lot easier to read and understand.

- Very precise syntax error messages. Because tree-sitter structures code in node trees, once the whole grammar is done, it should be easy to very to get super precise syntax errors. As it is now, if you omit a ; it tells you exactly where in the code in expected it to be (because that one node in the tree failed to parse)

- It's fast

You can see a screenshot, some examples and follow/help with the progress here for now:

https://github.com/madskjeldgaard/tree-sitter-supercollider

Best!


_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/