---------- Forwarded message ---------
From: Serghei Iakovlev <address@hidden>
Date: Sun, May 5, 2019 at 5:44 PM
Subject: Re: [ELPA] New package: bnf-mode
To: Stefan Monnier <address@hidden
Stefan Monnier <address@hidden
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.
>> I created a major mode for editing BNF grammars  and would like to
>> add this package to the ELPA . 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.
> (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).
<#secure method=pgpmime mode=encrypt>