unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Serghei Iakovlev <sadhooklay@gmail.com>
To: emacs-devel@gnu.org
Subject: Fwd: [ELPA] New package: bnf-mode
Date: Sun, 5 May 2019 17:49:04 +0300	[thread overview]
Message-ID: <CAErF=1AescVBufJ9jrr2QCmUjzXAavwgrvehHkfb0c9gWzMMcg@mail.gmail.com> (raw)
In-Reply-To: <87h8a93qqu.fsf@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 2908 bytes --]

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


Stefan Monnier <monnier@iro.umontreal.ca> 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>

[-- Attachment #2: Type: text/html, Size: 3888 bytes --]

  parent reply	other threads:[~2019-05-05 14:49 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-04 15:51 [ELPA] New package: bnf-mode Serghei
2019-05-04 18:35 ` Stefan Monnier
     [not found]   ` <87h8a93qqu.fsf@gmail.com>
2019-05-05 14:49     ` Serghei Iakovlev [this message]
2019-05-05 14:56   ` Serghei Iakovlev
2019-05-05 16:07     ` Stefan Monnier
2019-05-05 22:31       ` John Yates
2019-05-06  0:47         ` Drew Adams
2019-05-06  0:48         ` Drew Adams
2019-05-06  5:54           ` Serghei Iakovlev
2019-05-06 12:31             ` Stefan Monnier
2019-05-06 18:57               ` Serghei Iakovlev
2019-05-07  0:59                 ` Stefan Monnier
2019-05-07 17:36                   ` Serghei Iakovlev
2019-05-07 17:58                     ` Stefan Monnier
2019-05-07 18:54                       ` Serghei Iakovlev
2019-05-07 19:01                         ` Stefan Monnier
2019-05-09  4:06               ` Serghei Iakovlev
2019-05-05 15:01   ` Serghei Iakovlev

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='CAErF=1AescVBufJ9jrr2QCmUjzXAavwgrvehHkfb0c9gWzMMcg@mail.gmail.com' \
    --to=sadhooklay@gmail.com \
    --cc=emacs-devel@gnu.org \
    /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).