doesn't that make you wonder?

John MacFarlane jgm at
Thu Oct 20 13:31:28 EDT 2011

+++ Tao Klerks [Oct 20 11 12:52 ]:

> OK, I interpret this (besides the quite-reasonable "why should I care?"

> vibe), combined with previous references to the PEG grammar(s) implicit

> in MultiMarkdown and peg-markdown's implementations, as "a formal

> specification already exists".



> That sounds fine - I'd love to use peg-(multi)markdown in my programs,

> but I see two practical problems for that right now:


> · A C library, while portable to any processor architecture, if

> not portable to any development environment, and certainly not

> future-proof. I, personally, would like to be able to rely on the exact

> same syntax not only across the OSs that Fletcher mentions, but also in

> C# code (that can be sandboxed safely - no P/Invoke calls to unsafe

> code) and also in browsers. There are numerous other environments

> (Java, etc) where a similar "safe code" requirement precludes the use

> of a C library (at least in browser and other high-sandboxing

> environments).


> · The PEG grammars(s) may be formal reproducible reusable

> specifications, but my understanding is that they are not so meaningful

> without a definition of what they map to. If my brief reading on this

> is correct, a PEG grammar allows you to define behaviours to be

> executed upon encountering certain source structures; those behaviours

> implement a conversion to HTML, or latex, or whatever, but are implicit

> in the Program, not the Specification/Grammar



> So if we take the current PEG-based implementations as a starting

> point, what would it take to produce a specification that formally

> establishes not only the source structures to be matched, but also the

> behaviour/conversions to be implemented against them? Is this just a

> question of detailed documentation and an open test-suite?



> Another applicable question is: are PEG grammars easily usable in other

> environments? A brief search suggests so (js:

> [1]

> ssion-grammar-peg-libraries-for-javascript-or-php, C#:

> [2] not

> GPL-compatible, sadly…); does anyone know how fesible it is to take the

> existing PEG grammar(s) and reuse them in other languages?

Translation of peg-markdown to Go:

Java markdown parser based on peg-markdown:

And of course a PEG could provide a reference specification even for
implementations that use other parsing methods.


More information about the Markdown-Discuss mailing list