[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [ELPA] New package: bnf-mode
From: |
Serghei Iakovlev |
Subject: |
Re: [ELPA] New package: bnf-mode |
Date: |
Sun, 05 May 2019 17:56:29 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) |
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
Stefan Monnier <address@hidden> 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
>
>
<#secure method=pgpmime mode=encrypt>
- [ELPA] New package: bnf-mode, Serghei, 2019/05/04
- Re: [ELPA] New package: bnf-mode, Stefan Monnier, 2019/05/04
- Message not available
- Re: [ELPA] New package: bnf-mode,
Serghei Iakovlev <=
- Re: [ELPA] New package: bnf-mode, Stefan Monnier, 2019/05/05
- Re: [ELPA] New package: bnf-mode, John Yates, 2019/05/05
- RE: [ELPA] New package: bnf-mode, Drew Adams, 2019/05/05
- RE: [ELPA] New package: bnf-mode, Drew Adams, 2019/05/05
- RE: [ELPA] New package: bnf-mode, Serghei Iakovlev, 2019/05/06
- Re: [ELPA] New package: bnf-mode, Stefan Monnier, 2019/05/06
- Re: [ELPA] New package: bnf-mode, Serghei Iakovlev, 2019/05/06
- Re: [ELPA] New package: bnf-mode, Stefan Monnier, 2019/05/06
- Re: [ELPA] New package: bnf-mode, Serghei Iakovlev, 2019/05/07
- Re: [ELPA] New package: bnf-mode, Stefan Monnier, 2019/05/07