emacs-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]