News for hackers. Stuff that matters.
Re:RFC 7764 – Guidance on Markdown by the_duke on Wednesday December 14, 2016 @01:10PM (#13178198)
You may want to work on specifying a formal grammar in EBNF or similiar.

Great for library / parser implementers and it helps discover ambiguities.

Re:RFC 7764 – Guidance on Markdown by akavel on Wednesday December 14, 2016 @06:42PM (#13180856)
http://vfmd.org has an exhaustive and unambiguous formal spec for (a variant of) Markdown. As a bonus, it's easy to understand, nicely extensible, and has an example implementation. The only drawback I'm aware of is that it seems routinely ignored by nearly everyone. I wonder why?
Re:RFC 7764 – Guidance on Markdown by legulere on Thursday December 15, 2016 @03:13AM (#13183218)
While the spec is way more formal, it's still not in a form that easily lends for a proof that it's unambiguous.
Re:RFC 7764 – Guidance on Markdown by wolfgke on Thursday December 15, 2016 @06:39AM (#13183898)
I have not looked into the details of the grammar, but proving that a grammar is unambiguous is typically done by proving that it is in, say, LL(1) or LR(1) (or some related family). This approach towards unambiguity has the additional advantage that it is easy to derive a parsing algporithm directly from the grammar that has nice theoretical properties (e.g. linear parsing time in the input length; where the hidden constant depends on the grammar).
Re:RFC 7764 – Guidance on Markdown by legulere on Thursday December 15, 2016 @07:04AM (#13183999)
There is no grammar, it's a description how to parse markdown using regexes.
Re:RFC 7764 – Guidance on Markdown by taylorfausak on Wednesday December 14, 2016 @02:23PM (#13178874)
From John MacFarlane, the author of the CommonMark spec:

> If anyone wants to contribute a BNF, please do! But I'm very skeptical that it can be done, due to the many quirks of the syntax.

https://github.com/jgm/CommonMark/issues/113#issuecomment-60...

Re:RFC 7764 – Guidance on Markdown by dozzie on Wednesday December 14, 2016 @04:26PM (#13179803)
So it's basically as useless for general processing as Markdown, because you won't have a grammar from which you can generate parser, hence all the parsers will be handcoded with various quirks differing from one to another and none of which will produce a parse tree.
Re:RFC 7764 – Guidance on Markdown by mrottenkolber on Wednesday December 14, 2016 @06:04PM (#13180578)
I'm baffled. Without a formal grammar CommonMark is useless. Who implements a parser without a formal grammar?
Re:RFC 7764 – Guidance on Markdown by the_duke on Wednesday December 14, 2016 @11:37PM (#13182449)
If the syntax has so many issues that you can't specify a formal grammar, there's a problem with the spec.
Re:RFC 7764 – Guidance on Markdown by marcosdumay on Wednesday December 14, 2016 @04:27PM (#13179808)
If it's hard to write a BNF, it's also hard to write a parser.
Re:RFC 7764 – Guidance on Markdown by gsnedders on Wednesday December 14, 2016 @06:15PM (#13180663)
BNF doesn't make something unambiguous.

I mean, Foo = "hello" / "hello" is totally acceptable, and if you have any indirection like Foo = XXX / YYY with XXX, YYY = "hello" you can then attach different semantics to XXX and YYY despite it being ambiguous. Add in more levels of indirection, and you have a lower chance of it being trivially obvious.

Re:RFC 7764 – Guidance on Markdown by legulere on Thursday December 15, 2016 @03:28AM (#13183242)
But there exist tools to help you decide wether a grammar is unambiguous when you have a formal grammar: https://en.wikipedia.org/wiki/Ambiguous_grammar#Recognizing_...