unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stephen Leake <stephen_leake@stephe-leake.org>
To: Andrei Kuznetsov <r12451428287@163.com>
Cc: Ergus <spacibba@aol.com>, emacs-devel@gnu.org
Subject: Re: [SPAM UNSURE] Re: [SPAM UNSURE] Maybe we're taking a wrong approach towards tree-sitter
Date: Thu, 29 Jul 2021 16:25:40 -0700	[thread overview]
Message-ID: <86o8akog7f.fsf@stephe-leake.org> (raw)
In-Reply-To: <877dhawpr7.fsf@163.com> (Andrei Kuznetsov's message of "Wed, 28 Jul 2021 21:07:40 +0800")

Andrei Kuznetsov <r12451428287@163.com> writes:

> Ergus <spacibba@aol.com> writes:
>
>> 1) Performance (discussed in the previous thread):
>
> FWIW I have been experimenting with an increcemental GLR parser
> generator in Emacs Lisp.  

The "generator" and the "runtime" are two separate programs, with
separate functions, used at different times.

The generator takes the javascript language grammar file and translates
it (thru lots of hairy computations) into code that builds a parse table
and other data structures. The tree-sitter generator outputs that code
in C; it might be possible to adapt it to output in elisp (the wisitoken
generator used to output elisp, but i gave that up when I implemented
error recover in Ada; elisp is way to slow for that).

The "runtime" uses the parse table to parse text at runtime, in response
to user actions on the buffer. To be useful in an interactive editing
context, it must have robust error recovery. What is your error recovery
algorithm?

> While I have not put in the effort to couple it with font-lock and
> such, from anecdotal examination it does not perform badly with a
> naive C grammar. 

Are you talking about the generator or runtime here?

> The initial parse does take several seconds on large files, 

That's the runtime. Actual time for xdisp.c, preferably compared with a
tree-sitter parse run on the same machine, would be helpful.

How long does the generator take?

> but afterwards I did not notice a significant drop in editor
> responsiveness.

This seems to imply that the runtime supports incremental parse, so it
does not reparse the whole buffer each time; is that true?

>> 2) Not reinvent the wheel.
>
> While tree-sitter may be nice and all, it doesn't seem to offer the
> usual extensibility expected from Emacs.

It's all open-source, but it is very complicated and may be beyond many
people's ability to change correctly.

It requires running a C compiler to change it, but so do other parts of
Emacs (for example, the json parser).

So what is it missing?

-- 
-- Stephe



  parent reply	other threads:[~2021-07-29 23:25 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-28  1:57 Maybe we're taking a wrong approach towards tree-sitter Andrei Kuznetsov
2021-07-28  3:53 ` [SPAM UNSURE] " Stephen Leake
2021-07-28  8:23   ` Manuel Giraud
2021-07-28 11:48     ` Andrei Kuznetsov
2021-07-28 13:04       ` Eli Zaretskii
2021-07-28 13:14         ` Andrei Kuznetsov
2021-07-28 13:27           ` Eli Zaretskii
2021-07-28 13:31             ` Andrei Kuznetsov
2021-07-28 14:24             ` Dmitry Gutov
2021-07-28 14:36               ` Dmitry Gutov
2021-07-28 14:51               ` Daniele Nicolodi
2021-07-28 16:10               ` Eli Zaretskii
2021-07-28 16:24                 ` Perry E. Metzger
2021-07-28 16:29                   ` Eli Zaretskii
2021-07-29 23:12         ` Stephen Leake
2021-07-29 23:21           ` Yuan Fu
2021-07-30 18:38             ` Stephen Leake
2021-07-30  0:41           ` Andrei Kuznetsov
2021-07-30 12:06             ` Arthur Miller
2021-07-30 12:52               ` Óscar Fuentes
2021-07-30 13:30                 ` Arthur Miller
2021-07-30 13:57                   ` Ergus
2021-07-30 14:52                     ` Arthur Miller
2021-07-30 13:59                   ` Eli Zaretskii
2021-07-30 15:45                     ` Arthur Miller
2021-07-30 13:32               ` Ergus
2021-07-30 15:07                 ` Arthur Miller
2021-08-02 22:13               ` Perry E. Metzger
2021-07-30 18:42             ` Stephen Leake
2021-07-30  6:05           ` Eli Zaretskii
2021-07-31 12:12             ` Stephen Leake
2021-07-31 13:07               ` Eli Zaretskii
2021-07-31 16:55                 ` Stephen Leake
2021-07-31 17:12                   ` Eli Zaretskii
2021-07-28 11:43   ` Andrei Kuznetsov
2021-07-28 11:50     ` Eli Zaretskii
2021-07-28 12:06       ` Andrei Kuznetsov
2021-07-28 13:05         ` Eli Zaretskii
2021-07-28 13:16           ` Andrei Kuznetsov
2021-07-28 12:36     ` Ergus
2021-07-28 13:07       ` Andrei Kuznetsov
2021-07-28 13:16         ` Eli Zaretskii
2021-07-28 13:27           ` Andrei Kuznetsov
2021-07-28 13:32             ` Eli Zaretskii
2021-07-28 13:38               ` Andrei Kuznetsov
2021-07-28 14:41                 ` Manuel Giraud
2021-07-28 15:15                   ` Perry E. Metzger
2021-07-28 16:10                   ` Eli Zaretskii
2021-07-29 23:25         ` Stephen Leake [this message]
2021-07-30  0:54           ` [SPAM UNSURE] " Andrei Kuznetsov
2021-07-30  3:02             ` Andrei Kuznetsov
2021-07-30 18:48             ` Stephen Leake
2021-07-28 15:12     ` Perry E. Metzger
2021-07-29 23:28       ` Stephen Leake
2021-07-30  0:19         ` Perry E. Metzger
2021-07-30 18:44           ` [SPAM UNSURE] " Stephen Leake
2021-07-29  4:35     ` Richard Stallman
2021-07-28 15:09 ` Perry E. Metzger
2021-07-29 23:35   ` Stephen Leake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86o8akog7f.fsf@stephe-leake.org \
    --to=stephen_leake@stephe-leake.org \
    --cc=emacs-devel@gnu.org \
    --cc=r12451428287@163.com \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).