fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

Paul Buetow

Coming from to to , I really like the 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 grammar for and , 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.

@drsensor @snonux It does already on the main git branch. Either you compile from source if you really need it or you wait for the next release :D

@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 ’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 en.wikipedia.org/wiki/Chomsky_ (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: github.com/tree-sitter-perl/tr

en.wikipedia.orgChomsky hierarchy - Wikipedia

@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.