all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Serghei Iakovlev <sadhooklay@gmail.com>
To: emacs-devel@gnu.org
Subject: Re: [ELPA] New package: bnf-mode
Date: Sun, 05 May 2019 18:01:52 +0300	[thread overview]
Message-ID: <8736lt3py7.fsf@gmail.com> (raw)
In-Reply-To: <jwv5zqq13bn.fsf-monnier+emacs@gnu.org> (Stefan Monnier's message of "Sat, 04 May 2019 14:35:21 -0400")

I apologize for the possible duplication of this reply.  I sent it by
mistake to my personal Stefan address.

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,
Serghei

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



      parent reply	other threads:[~2019-05-05 15:01 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     ` Fwd: " Serghei Iakovlev
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 [this message]

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=8736lt3py7.fsf@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 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.