GNU bug report logs -
#64017
Wrong conversion from Emacs to Tree-sitter S-expression syntax
Previous Next
Full log
View this message in rfc822 format
16 juni 2023 kl. 00.08 skrev Yuan Fu <casouri <at> gmail.com>:
>> (By the way, why is the conversion written in C? Was Lisp too slow?)
>
> Because I wasn't sure if it’s ok for C functions to rely on Lisp functions, plus the function is simple enough. Right now if one doesn’t load treesit.el, all the C functions work fine.
All right, let's keep it there for now.
I fixed the string conversion bug in 8657afac77.
>> Ideally we should not need to expose the tree-sitter s-exp query syntax at all. Surely Emacs s-exps should be preferable in every case?
> It shouldn’t hurt to expose the tree-sitter sexp. Other editors mainly use the string syntax.
Most of them probably aren't written in Lisp. But fine, let's keep it as an alternative syntax.
> The difference between tree-sitter syntax and Elisp sexp syntax is petty small (anchor, predicates), so the text describing the tree-sitter syntax is basically describing Elisp sexp syntax.
Yes, so it seemed to me but reading the source code (lib/src/query.c) seems to indicate that what I thought were symbols -- *, +, ?, @thing, #thing -- appear to be special postfix and prefix operators. (Ironically, there doesn't seem to be a grammar for this language anywhere, or am I mistaken?)
Thus a structurally correct Lispish translation of
(teet "toot"* (#equal "fie" @fum))
should arguable be something like
(teet (* "toot") ((# equal) "fie" (@ fum)))
rather than the current
(teet "toot" :* (:equal "fie @fum))
but I'm not demanding that it all be changed at this stage.
> With that said if someone makes it describe Elisp sexp syntax first, I wouldn’t mind.
I'll have a look. Wouldn't it be reasonable to use the Elisp syntax, briefly state how it corresponds to the 'native' syntax, and refer to the official tree-sitter documentation for details about the latter?
This bug report was last modified 2 years and 34 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.