unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Eli Zaretskii <eliz@gnu.org>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: christian@cvj.se, monnier@iro.umontreal.ca, emacs-devel@gnu.org
Subject: Re: New package emacs-parser-generator
Date: Mon, 29 Nov 2021 14:30:56 +0200	[thread overview]
Message-ID: <838rx7w3cv.fsf@gnu.org> (raw)
In-Reply-To: <m1sfvfc08u.fsf@yahoo.es> (message from Daniel Martín on Mon, 29 Nov 2021 00:46:09 +0100)

> From: Daniel Martín <mardani29@yahoo.es>
> Cc: Stefan Monnier <monnier@iro.umontreal.ca>,  Eli Zaretskii
>  <eliz@gnu.org>,  emacs-devel@gnu.org
> Date: Mon, 29 Nov 2021 00:46:09 +0100
> 
> I think the main question is not about this library vs. Tree-sitter.  We
> can have both.  But IMO we should spend some time investigating if a
> common API is possible and makes sense.  To the untrained eye, both
> libraries solve the problem of generating parsers for languages, and the
> use cases seem to be more or less the same, so maybe there's an
> opportunity to abstract what's common:
> 
> - Create a parser from a grammar (the way grammars are defined differs).
> - Parse a region of text and generate a syntax tree.
> - Query the syntax tree.
> - etc.

I'm not sure this is the correct approach to the issue.  We should
instead to ask ourselves: "what information would Emacs want from a
parser for use in features like indentation, syntax highlight,
refactoring, etc.", and devise the APIs that would be convenient and
would make sense for those Emacs jobs.  The kind of information and
data that a parser can provide should be considered in the light of
those Emacs requirements, and then we have a better chance of coming
up with common APIs.

> One thing I saw in the in-progress Tree-sitter ELisp API is that it
> feels a bit too coupled to Tree-sitter.  I think in the long run it's
> better for Emacs to have an abstract API similar to the package you
> propose here, where Tree-sitter could be one possible alternative
> implementation.

That's true and agreed, but until someone comes up with at least one
more parser and proposes a common API, discussing this will tend to be
academic, I think.



  reply	other threads:[~2021-11-29 12:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-27 21:40 New package emacs-parser-generator Christian Johansson
2021-11-28  7:01 ` Eli Zaretskii
2021-11-28  7:22   ` Christian Johansson
2021-11-28 13:24     ` Stefan Monnier
2021-11-28 13:45       ` Christian Johansson
2021-11-28 23:46         ` Daniel Martín
2021-11-29 12:30           ` Eli Zaretskii [this message]
2021-11-29 13:09             ` Christian Johansson
2021-11-29 19:22               ` Yuan Fu
2021-12-01  7:52                 ` Christian Johansson
2021-12-01  8:39                   ` Yuan Fu
2021-12-01  8:51                     ` Christian Johansson
2021-12-01 13:45                       ` Stefan Monnier
2021-12-01 14:10                         ` Christian Johansson
2021-12-01 19:25                       ` Yuan Fu
2021-12-01 19:44                         ` Christian Johansson

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=838rx7w3cv.fsf@gnu.org \
    --to=eliz@gnu.org \
    --cc=christian@cvj.se \
    --cc=emacs-devel@gnu.org \
    --cc=mardani29@yahoo.es \
    --cc=monnier@iro.umontreal.ca \
    /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).