From: Raphael Cauderlier <cauderlier@crans.org>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: 16416@debbugs.gnu.org
Subject: bug#16416: 24.3; [SMIE] Assertion failure in smie-prec2->grammar
Date: Tue, 14 Jan 2014 11:03:32 +0100 [thread overview]
Message-ID: <vt2lhyi3mob.fsf@zamok.crans.org> (raw)
In-Reply-To: <jwvha97qt3u.fsf-monnier+emacsbugs@gnu.org> (Stefan Monnier's message of "Mon, 13 Jan 2014 20:04:07 -0500")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> (smie-prec2->grammar (smie-bnf->prec2 '((name) (l ("a" name)))))
>> This raised the following error message:
>> (cl-assertion-failed (numberp (car cons)))
>
> Hmm..indeed. The assertion can be removed, but then we bump into
> another signal. The problem is that the grammar is simply "too
> trivial" and smie.el seems to bump into invalid assumptions in
> that case. As soon as you add some other terminal to the "l" rule, or
> the "name" rule, or you use "l" somewhere, the problem disappears.
>
> Intuitively this problem might manifest itself in a more realistic
> grammar,
I don't know if you would call it realistic but I actually got it with
the following grammar:
(smie-prec2->grammar
(smie-bnf->prec2
'((id)
(prelude ("#NAME" id))
(line ("#IMPORT" id)
(term ".")
(term ":=" term ".")
(rule)
(rule ".")
("#ASSERT" term "=~" term "."))
(rule ("[" context "]" term "-->" term))
(decl (id ":" term))
(context (decl "," context)
(decl))
(term (id)
("{" id "}")
(decl)
("_")
(term "->" term)
(decl "=>" term)))
'((assoc ":")
(assoc "->" "=>"))))
which I find a bit more complicated than the example grammar given in
the manual section `SMIE Grammar'.
I wrote this from Dedukti BNF grammar. Dedukti
(https://www.rocq.inria.fr/deducteam/Dedukti/index.html) is a simple
language for which I am writing a major mode
(https://github.com/rafoo/dedukti-mode/blob/master/dedukti-mode.el).
I then minimized the example before reporting, keeping only the `id'
empty rule and the first `line' rule.
> As soon as you add some other terminal to the "l" rule, or
> the "name" rule, or you use "l" somewhere, the problem disappears.
Thank you for your suggestion, I added "\n" at the end of, the first
`line' rule and the problem is solved for me; I can continue to play
with SMIE :)
> yet I don't quite see in which case, and for that reason
> I don't really see yet what would be the right fix. I'm tempted to
> think that the problem is partly to blame on smie-bnf->prec2 which
> generates a prec2 table where "a" is missing (except for the side info
> of :smie-open/close-alist).
Thank you for your investigation and thank you for SMIE; I am sure it
will help me a lot improving my major mode indentation!
--
Raphaël Cauderlier
next prev parent reply other threads:[~2014-01-14 10:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-11 17:55 bug#16416: 24.3; [SMIE] Assertion failure in smie-prec2->grammar Raphaël Cauderlier
2014-01-14 1:04 ` Stefan Monnier
2014-01-14 10:03 ` Raphael Cauderlier [this message]
2021-07-15 5:06 ` Lars Ingebrigtsen
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=vt2lhyi3mob.fsf@zamok.crans.org \
--to=cauderlier@crans.org \
--cc=16416@debbugs.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.