emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Call for volunteers: add tree-sitter support to major modes


From: Po Lu
Subject: Re: Call for volunteers: add tree-sitter support to major modes
Date: Tue, 18 Oct 2022 11:24:01 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Alan Mackenzie <acm@muc.de> writes:

> Generally, that the replacement of CC Mode's engine with tree-sitter is
> a good idea; CC Mode as it currently is is too much work to maintain,
> and in the long run is unsustainable.
>
> At the same time, I have no idea how good tree-sitter's grammars for CC
> Mode's modes are.  If I understand rightly, a call to TS requires start
> and end buffer positions to be calculated by Emacs rather than TS
> itself.  This might reduce some of the expected speed gain.
>
> I would like to keep all of CC Mode's user features in the new mode, if
> at all possible.  I don't know how easy it will be, for example, to keep
> CC Mode's indentation styles working in the new mode.
>
> I can't honestly see myself as able to integrate tree-sitter into CC
> Mode in the short time before the planned pre-test of Emacs 29.  I think
> we should take up the offer made by João Paulo Labegalini de Carvalho
> <jaopaulolc@gmail.com> on 2020-10-11 to work on C Mode and possibly C++
> Mode.
>
> I'm afraid I've only read a small part of this thread on emacs-devel, so
> there's likely quite a bit of relevant stuff I've missed.

Could someone please tell me how well tree-sitter supports pre-standard
C with liberal (and sometimes non-standard) use of the C language?  I'm
talking about code that looks like this:

MACRO_USED_TO_DEFINE_SPECIAL_FUNCTIONS (function_name, cells, transform)
     some_kind_of_ptr cells;
     another_kind_of_ptr *transform;
{
  extern maybe_tls (int) errno;
  extern caddr_t bar (_P (another_kind_of_ptr, ...));
  int rc;

  BEGIN_A_KIND_OF_SECTION ({
      ENTRY (dx, dy, shx, shy)
        float dx, dy, shx, shy;

      if (!bar (other_function (dx, dy, shx, shy),
                etc, etc, etc))
        die ("bar", sys_errlist[errno]);
    }, register float, section_name);

  rc = more_code_here (&section_name_desc, etc);
  return rc;
}

I don't doubt that tree-sitter is good at parsing newer languages like
Typescript, but does it support C all that well?


reply via email to

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