From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Serghei Iakovlev Newsgroups: gmane.emacs.devel Subject: Fwd: [ELPA] New package: bnf-mode Date: Sun, 5 May 2019 17:49:04 +0300 Message-ID: References: <23ebbedf-5474-bbbd-47d2-3404f47f7a23@gmail.com> <87h8a93qqu.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="0000000000008049720588251682" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="142125"; mail-complaints-to="usenet@blaine.gmane.org" To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 05 16:50:16 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hNISz-000aqV-Jv for ged-emacs-devel@m.gmane.org; Sun, 05 May 2019 16:50:13 +0200 Original-Received: from localhost ([127.0.0.1]:42066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNISy-0001Ze-GZ for ged-emacs-devel@m.gmane.org; Sun, 05 May 2019 10:50:12 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:38604) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hNIS8-0001ZM-GK for emacs-devel@gnu.org; Sun, 05 May 2019 10:49:21 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hNIS7-0006qi-19 for emacs-devel@gnu.org; Sun, 05 May 2019 10:49:20 -0400 Original-Received: from mail-lj1-x22b.google.com ([2a00:1450:4864:20::22b]:38175) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hNIS6-0006pu-M5 for emacs-devel@gnu.org; Sun, 05 May 2019 10:49:18 -0400 Original-Received: by mail-lj1-x22b.google.com with SMTP id e18so8971808lja.5 for ; Sun, 05 May 2019 07:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=PJgpS4O7/xDLaFXzglCsochfa3SJAb8FWT71bZX94rk=; b=sLgUQPQk3gnYQdhUNHq1ujMWpFlhqs46y/HypCnfAxzr6rolMN2julb7XkJTeArwC5 hYChIpmVnrbjJpW5zfdpwWOpOzMgatTVAS/1XTwbadDUm4VUAQsW8FYiW4Bb6ZsAMLun vN54DfL7E8OYLhXPxpEPDJFT4O/TQ2+Q7vNxIsmHjX3M1rBUuGfy4siAYhHT09+Gp/8j g9HRoS3e5CPgU4lU2LbzPWgRI+czZvzKrnjhyXy2NkR0nz3U53ai7xr4e67xorzs4gLF 3WYmB9DsH83qkSUNN59z015ryUe+5wkxJe3tqlslZS+xhywQ+WcRhquU87wqjYhNFXoZ PHpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=PJgpS4O7/xDLaFXzglCsochfa3SJAb8FWT71bZX94rk=; b=TiqWhyy68mW254AoFIF2b6V/mBYG8eV91iIywz7GnnbdRUSPwV7zw68NAvWURz1415 BKQvSBlE1Wa3EjABEB4Xt3gXsgUrPgSjOKIoPQUDzKXuOPy5eXYRTyOp9FmYEYfpRPua 7K54wXb0bin58OE5pUWDaTqh63ISSPN9WVBsZF1ncMcz40tH6uDjE/xP2e7zI0k2ngR5 Y6ASSRBpUgfIlzFwcSZn3sia5N3pW96/8XvJi7FYYhQeR+BAdqEzD3Zr2+ZXMWbNJbCy zQpKXjb8Dji9++pZgLSccnr0oNJ3CW1gYNU7NOicJgQ4oMI/xljImQIm1O3/yqFdRQQ3 9q7g== X-Gm-Message-State: APjAAAX74Z/fZ5G+4/89ZVN/ouVtH3MrBN+AL05Dl7ML/ZeteALCBX0p aH+XuwZG5tCKgSZ50PmUksglZwJM528hi7EOw7UYn2n47L0= X-Google-Smtp-Source: APXvYqws7scBFft5uSsae0/PBdJKyw29qM/DhClOasHFwJhJ8UApxf+hObCiVJrzG08CDZW3dvp/xtS3Ev28ioJeoMU= X-Received: by 2002:a2e:9188:: with SMTP id f8mr8292497ljg.100.1557067756225; Sun, 05 May 2019 07:49:16 -0700 (PDT) In-Reply-To: <87h8a93qqu.fsf@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:236174 Archived-At: --0000000000008049720588251682 Content-Type: text/plain; charset="UTF-8" ---------- Forwarded message --------- From: Serghei Iakovlev Date: Sun, May 5, 2019 at 5:44 PM Subject: Re: [ELPA] New package: bnf-mode To: Stefan Monnier Stefan Monnier writes: Hello Stefan, Thank you for the review. I've removed wrongly used (and documented) `syntax-propertize-function' funcall. Thank you for clarifying it out. As for the question: BNF is a notation technique for context free grammars, often used to describe the syntax of languages used in computing, such as programming languages, document formats, instruction sets and communication protocols. And I have to say than Bison is not BNF. Probable you're meant yacc, which is from 197x. However BNF is designed (in 1959) to create formal grammars in a formal language, what is not a subject area for yacc or bison. Yes, yacc, antlr, bison, META II, etc. All they use a dialect slightly reminiscent of BNF, but the do not use pure BNF grammar. In addition, they don't use a formal language. I've updated the code in the repository but still not sure what exactly should I attach on this reply. Best regards, Serghey >> I created a major mode for editing BNF grammars [1] and would like to >> add this package to the ELPA [2]. Currently it provides basic syntax >> and font-locking for BNF files. BNF notation is supported exactly >> form as it was first announced in the ALGOL 60 report. EBNF and ABNF >> are not supported but in my plans for the near future. > > In what kind of circumstances would this be used? > I've seen BNF-like syntax used by various tools (like bison and > friends, for example), but never with this particular syntax. > > ;; Basically `syntax-propertize-function' is a construct which belongs > ;; to `font-lock'. > > No. It's used by font-lock (as well as various other things), but it > does not belong to it. > > ;; But correct indentation depends on > ;; syntax properties of the text, and that should ideally be > ;; independent of font-lock being activated or not. > > Which is why syntax-propertize was created (as opposed to the previous > font-lock-syntactic-keywords, which *did* belong to font-lock and > suffered from the problem you describe). > > ;; For `bnf-mode', this means that with `font-lock' disabled, we wont > ;; have our syntax properties set correctly, and indentation will > ;; suffer. > > That's not true. > > ;; To patch our way around this, we issue a `syntax-propertize' call > ;; manually, `font-lock' enabled or not. > (with-silent-modifications > (when bnf-mode-algol-comments-style > (funcall syntax-propertize-function (point-min) (point-max)))) > > Don't do that: syntax-propertize-function will be called when needed > (e.g. by indent-according-to-mode). > > > Stefan > > <#secure method=pgpmime mode=encrypt> --0000000000008049720588251682 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


---------- Forwarded message ---------
From: Serghei Iakovlev <= sadhooklay@gmail.com>=
Date: Sun, May 5, 2019 at 5:44 PM
Subject: Re: [ELPA] New package: b= nf-mode
To: Stefan Monnier <monnier@iro.umontreal.ca>


Stefan Monnier <monnier@iro.umon= treal.ca> writes:

Hello Stefan,

Thank you for the review.=C2=A0 I've removed wrongly used (and document= ed)
`syntax-propertize-function' funcall.=C2=A0 Thank you for clarifying it=
out.=C2=A0 As for the question: BNF is a notation technique for context
free grammars, often used to describe the syntax of languages used
in computing, such as programming languages, document formats,
instruction sets and communication protocols.

And I have to say than Bison is not BNF.=C2=A0 Probable you're meant ya= cc,
which is from 197x.=C2=A0 However BNF is designed (in 1959) to create
formal grammars in a formal language, what is not a subject area for
yacc or bison.=C2=A0 Yes, yacc, antlr, bison, META II, etc.=C2=A0 All they = use
a dialect slightly reminiscent of BNF, but the do not use pure BNF
grammar.=C2=A0 In addition, they don't use a formal language.

I've updated the code in the repository but still not sure what
exactly should I attach on this reply.

Best regards,
Serghey

>> I created a major mode for editing BNF grammars [1] and would like= to
>> add this package to the ELPA [2].=C2=A0 Currently it provides basi= c syntax
>> and font-locking for BNF files.=C2=A0 BNF notation is supported ex= actly
>> form as it was first announced in the ALGOL 60 report.=C2=A0 EBNF = and ABNF
>> are not supported but in my plans for the near future.
>
> In what kind of circumstances would this be used?
> I've seen BNF-like syntax used by various tools (like bison and > friends, for example), but never with this particular syntax.
>
>=C2=A0 =C2=A0 =C2=A0;; Basically `syntax-propertize-function' is a = construct which belongs
>=C2=A0 =C2=A0 =C2=A0;; to `font-lock'.
>
> No.=C2=A0 It's used by font-lock (as well as various other things)= , but it
> does not belong to it.
>
>=C2=A0 =C2=A0 =C2=A0;; But correct indentation depends on
>=C2=A0 =C2=A0 =C2=A0;; syntax properties of the text, and that should i= deally be
>=C2=A0 =C2=A0 =C2=A0;; independent of font-lock being activated or not.=
>
> Which is why syntax-propertize was created (as opposed to the previous=
> font-lock-syntactic-keywords, which *did* belong to font-lock and
> suffered from the problem you describe).
>
>=C2=A0 =C2=A0 =C2=A0;; For `bnf-mode', this means that with `font-l= ock' disabled, we wont
>=C2=A0 =C2=A0 =C2=A0;; have our syntax properties set correctly, and in= dentation will
>=C2=A0 =C2=A0 =C2=A0;; suffer.
>
> That's not true.
>
>=C2=A0 =C2=A0 =C2=A0;; To patch our way around this, we issue a `syntax= -propertize' call
>=C2=A0 =C2=A0 =C2=A0;; manually, `font-lock' enabled or not.
>=C2=A0 =C2=A0 =C2=A0(with-silent-modifications
>=C2=A0 =C2=A0 =C2=A0 =C2=A0(when bnf-mode-algol-comments-style
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(funcall syntax-propertize-function (= point-min) (point-max))))
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
> Don't do that: syntax-propertize-function will be called when need= ed
> (e.g. by indent-according-to-mode).
>
>
>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0Stefan
>
>
<#secure method=3Dpgpmime mode=3Dencrypt>
--0000000000008049720588251682--