emacs-devel
[Top][All Lists]
Advanced

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

Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock


From: Lynn Winebarger
Subject: Re: Why tree-sitter instead of Semantic? (was Re: CC Mode with font-lock-maximum-decoration 2)
Date: Tue, 16 Aug 2022 12:33:57 -0400

On Tue, Aug 16, 2022 at 7:42 AM Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Lynn Winebarger <owinebar@gmail.com>
> > Date: Tue, 16 Aug 2022 05:06:58 -0400
> > Cc: Jostein Kjønigsen <jostein@secure.kjonigsen.net>,
> >       Eli Zaretskii <eliz@gnu.org>, jostein@kjonigsen.net, Alan Mackenzie 
> > <acm@muc.de>,
> >       emacs-devel <emacs-devel@gnu.org>, Yuan Fu <casouri@gmail.com>
> >
> > On Sat, Aug 13, 2022 at 9:23 PM Po Lu <luangruo@yahoo.com> wrote:
> > >
> > > Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> > >
> > > That's not true.  If you enable Semantic and EDE, and add system
> > > includes (with semantic-add-system-include), and wait for the initial
> > > parse to finish after visiting a file in a project, it becomes
> > > immediately useful for editing C code.  It's actually what I use for my
> > > day job.
> >
> > I think what Jostein means is - how would you know you need to take
> > all those steps?
>
> As usual: by reading the fine documentation.  Amazingly enough,
> Semantic does have an Info manual, which comes with Emacs, and those
> steps are documented there.
>
> More generally: Semantic's problems, issues, and disadvantages aside,
> let's not pretend that Emacs maintainers are incompetent.  When the
> decision was made to add parts of Semantic to Emacs core, back in
> Emacs 23 days, a lot of effort went into its proper integration,
> including making its documentation available.  So if someone asks
> him/herself how do I use this stuff, I expect that someone to make the
> minimal effort of reading the available documentation and trying to
> follow it.  If that doesn't work, then yes, by all means do complain.

I'm only saying there's a disconnect between Jostein's report and Po's
response.  It's probably a UI issue.  There's a checkbox in a dropdown
menu that says "Source Code Parsers (Semantic)".  That probably
suggests to the casual user that all they have to do is check the box
to get the full benefit.  Or that if they need to do more
configuration, clicking the box will lead to a process to do the
configuration.  Whether that's a reasonable expectation on the user's
part, I couldn't say.

That said, as a developer there are some missing pieces in the
Semantics docs.  For one, some of the texi files - particularly the
ones for the grammar framework and language dev, did not make it into
the emacs source tree, though there are still dangling references to
those documents.  I went to the last (circa 2014) version of CEDET
from sourceforge and grabbed the corresponding docs from there.
I will say one of my disappointments with the Semantic grammar
framework (once I grabbed those grammar-fw and langdev docs) is that
the lexers rely on the syntax tables to identify blocks.
Unfortunately, that is one of the limitations I had hoped to overcome
by using Semantic.  For example,
*  "${" and "{" could both open a block closed by "}"
*  if/fi, case/esac, etc, or possibly all keyword blocks are closed by "end"
*  "variadic" structures like try/catch+/finally?
It's not clear from the doc just how much this reliance on the syntax
table based block identification is baked into the lexer/parser
generation.

Lynn



reply via email to

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