[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter api
From: |
Stephen Leake |
Subject: |
Re: Tree-sitter api |
Date: |
Sat, 18 Sep 2021 05:33:44 -0700 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (windows-nt) |
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Yuan Fu <casouri@gmail.com>
>>
>> We have documentation for all the tree-sitter features provided by
>> Emacs and a bit more, but I don’t think it is possible to document
>> the language definitions. We can think of language definitions as
>> BNF grammars for each language, how do you document that?
>
> Why do we need to document the language definitions? When a Lisp
> programmer defines font-lock and indentation for a programming
> language in the current Emacs, do they necessarily need to consult the
> language grammar?
Yes!
If you want to indent a statment in a language, you need to know the
syntax of that statement; you can't define indent for a "generic if
statement). Consider Ada and C:
Ada:
if <expression> then
<statement_list>
else
<statement_list>
end if;
C:
if (<expression>)
<block>
else
<block>
The language details matter.
--
-- Stephe
- Re: Tree-sitter api, (continued)
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/15
- Re: Tree-sitter api, Stefan Monnier, 2021/09/15
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/15
- Re: Tree-sitter api, Yuan Fu, 2021/09/16
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/17
- Re: Tree-sitter api, Yuan Fu, 2021/09/17
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/17
- Re: Tree-sitter api, Yuan Fu, 2021/09/17
- Re: Tree-sitter api, Tuấn-Anh Nguyễn, 2021/09/17
- Re: Tree-sitter api, Yuan Fu, 2021/09/18
- Re: Tree-sitter api,
Stephen Leake <=
- Re: Tree-sitter api, Yuan Fu, 2021/09/20
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/20
- Re: Tree-sitter api, John Yates, 2021/09/20
- Re: Tree-sitter api, Yuan Fu, 2021/09/21
- Re: Tree-sitter api, Yuan Fu, 2021/09/27
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/27
- Re: Tree-sitter api, Stefan Monnier, 2021/09/27
- Re: Tree-sitter api, Yuan Fu, 2021/09/28
- Re: Tree-sitter api, Eli Zaretskii, 2021/09/28
- Re: Tree-sitter api, Yuan Fu, 2021/09/28