From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Raphael Cauderlier Newsgroups: gmane.emacs.bugs Subject: bug#16416: 24.3; [SMIE] Assertion failure in smie-prec2->grammar Date: Tue, 14 Jan 2014 11:03:32 +0100 Message-ID: References: <87y52mo11v.fsf@mojito.crans.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1389693848 3648 80.91.229.3 (14 Jan 2014 10:04:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 14 Jan 2014 10:04:08 +0000 (UTC) Cc: 16416@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Jan 14 11:04:16 2014 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1W30r2-0004af-Cz for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Jan 2014 11:04:16 +0100 Original-Received: from localhost ([::1]:47311 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W30qz-0005TA-On for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Jan 2014 05:04:13 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39149) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W30qs-0005Sl-4X for bug-gnu-emacs@gnu.org; Tue, 14 Jan 2014 05:04:10 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W30qo-0007Sv-4s for bug-gnu-emacs@gnu.org; Tue, 14 Jan 2014 05:04:06 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35719) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W30qo-0007Sl-0z for bug-gnu-emacs@gnu.org; Tue, 14 Jan 2014 05:04:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1W30qn-0007bg-JZ for bug-gnu-emacs@gnu.org; Tue, 14 Jan 2014 05:04:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Raphael Cauderlier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Jan 2014 10:04:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 16416 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 16416-submit@debbugs.gnu.org id=B16416.138969381729205 (code B ref 16416); Tue, 14 Jan 2014 10:04:01 +0000 Original-Received: (at 16416) by debbugs.gnu.org; 14 Jan 2014 10:03:37 +0000 Original-Received: from localhost ([127.0.0.1]:49738 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W30qO-0007aw-OD for submit@debbugs.gnu.org; Tue, 14 Jan 2014 05:03:37 -0500 Original-Received: from redisdead.crans.org ([138.231.136.39]:56412) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1W30qM-0007ah-DR for 16416@debbugs.gnu.org; Tue, 14 Jan 2014 05:03:35 -0500 Original-Received: from zamok.crans.org.crans.org (zamok.crans.org [IPv6:2a01:240:fe3d:4:219:bbff:fe3c:4f76]) by redisdead.crans.org (Postfix) with ESMTP id 0834A2416; Tue, 14 Jan 2014 11:03:32 +0100 (CET) In-Reply-To: (Stefan Monnier's message of "Mon, 13 Jan 2014 20:04:07 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.4 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:83450 Archived-At: Stefan Monnier 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 ":=3D" term ".") (rule) (rule ".") ("#ASSERT" term "=3D~" term ".")) (rule ("[" context "]" term "-->" term)) (decl (id ":" term)) (context (decl "," context) (decl)) (term (id) ("{" id "}") (decl) ("_") (term "->" term) (decl "=3D>" term))) '((assoc ":") (assoc "->" "=3D>")))) 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! --=20 Rapha=C3=ABl Cauderlier