unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Daniel Martín" <mardani29@yahoo.es>
To: Christian Johansson <christian@cvj.se>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
	 Eli Zaretskii <eliz@gnu.org>,
	 emacs-devel@gnu.org
Subject: Re: New package emacs-parser-generator
Date: Mon, 29 Nov 2021 00:46:09 +0100	[thread overview]
Message-ID: <m1sfvfc08u.fsf@yahoo.es> (raw)
In-Reply-To: <9CE08016-E517-4DD3-8A7B-B55277E28A08@cvj.se> (Christian Johansson's message of "Sun, 28 Nov 2021 14:45:40 +0100")

Christian Johansson <christian@cvj.se> writes:

> Well the GLR(k) algorithm might find a nondeterminstic route route in
> the grammar that a LR(k) do not find, if I want to know if a code is
> syntatically correct I would test it against the same type of parser
> the language uses, that is a deterministic parser
>
>> 
> An intuitive structure - Tree-sitter’s output is a concrete syntax
> tree; each node in the tree corresponds directly to a terminal or
> non-terminal symbol in the grammar. So in order to produce an
> easy-to-analyze tree, there should be a direct correspondence between
> the symbols in your grammar and the recognizable constructs in the
> language. This might seem obvious, but it is very different from the
> way that context-free grammars are often written in contexts like
> language specifications or Yacc/Bison parsers.
>
>> https://tree-sitter.github.io/tree-sitter/creating-parsers#the-grammar-dsl
>
> This is a big issue because each version of a language grammar would need to be converted into tred-sitter form
>
>
>
> But anyways I don't see the issue with pluralism in the parser
> generator space, why would one exclude the other?

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.

To people much more familiar with this topic, is this an
oversimplification that would led to the wrong abstraction?

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.



  reply	other threads:[~2021-11-28 23:46 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 [this message]
2021-11-29 12:30           ` Eli Zaretskii
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=m1sfvfc08u.fsf@yahoo.es \
    --to=mardani29@yahoo.es \
    --cc=christian@cvj.se \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --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).