Coming from #Nvi to #Vim to #NeoVim, I really like the #Helix editor now. Go and Bash and Ruby and Perl programming works great. Puppet and Raku and notes taking (spell checking) need some more tweaking, still. I wonder how difficult it would be to write my own #treesitter grammar for #RakuLang and #Puppet, so I get syntax highlighting in Helix? Probably the best way is to try it out...
@snonux Doesn't NeoVim use tree-sitter too?
Side note: currently helix doesn't support multiple language-server on single file. The workaround is to use efm-langserver.
@drsensor Theres a TreeSitter Plugin vor NeoVim, yes! Have to see what is bundled with it, maybe there is something I can use, but I think there wont be anything for Raku or Puppet, as otherwise I would have found it already (i think)! But I believe normal syntax highlighting doesnt use TreeSitter in NeoVim.
@snonux Yes, we need a #TreeSitter grammar for #rakulang. That would open up a lot more possibilities.
Unfortunately, Raku's grammar is complicated, so translating that into a TreeSitter grammar would be an involved effort.
In a way, it's good that we have a readable grammar to refer to, at least.
@samebchase I don't know enough about Tree sitter, but i'd hope that it would be possible to only highlight for certain keywords or strings or variables. So the whole language doesn't need to be in the grammar for a naive syntax highlighting.
@snonux oh nice that would be a good first step to get syntax highlighting working on Helix.
@samebchase @snonux could we have the opposite of guifa’s Polyglot::Regexen and transform #RakuLang’s grammars into ecma regex? Would that make sense?
@smokemachine @snonux yes, if it that is possible to do, it would be ideal. Otherwise it becomes a manual error prone job.
@samebchase maybe it would also be possible to that call a Raku process that would parse the code?
@smokemachine @samebchase Tree sitter is not only using regexes, but also a DSL inside of JavaScript to build up the grammar. Like the Raku syntax is also specified by a DSL grammar. So only a sub-part of tree sitter grammars are actually regexes. In theory, it should be possible to convert a part of the Raku grammar into a TreeSitter grammar.
@smokemachine @samebchase To get a Raku TreeSitter grammar: Maybe use RakuAST and then traverse the Raku grammar within Raku and generate a TreeSitter grammar out of it on the fly? Would be some work, of course. I am not committing to it (probably lacking Raku skills here anyway), only thinking/dreaming :-) @lizmat would that be theoretically possible?
@snonux @smokemachine @samebchase
Could you provide me with a gist of a TreeSitter grammar? Then maybe I'll be able to answer your question
@lizmat @smokemachine @samebchase In theory, if both, Raku grammar and TreeSitter grammars fall into the same chomsky type https://en.wikipedia.org/wiki/Chomsky_hierarchy (context free, context sensitive,...?), then it should be (theoretically) possible to convert. As a gist, I think it is not so straight forward (not expecting you to read through the TreeSitter docs now :-) Perl example: https://github.com/tree-sitter-perl/tree-sitter-perl/blob/master/grammar.js
@smokemachine @samebchase @snonux
Only for a very limited subset of Raku's grammar capabilities, probably?
@samebchase @snonux I've been working on implementing Perl's one in tree-sitter. Tree-sitter itself is missing a *lot* of features that would make this non-painful, or even possible in some places. Most notably, things like understanding conditional rules, or list-associative operators.
I have a long ongoing task to try to talk to some tree-sitter devs about that.