W3C home > Mailing lists > Public > public-markdown@w3.org > December 2012

Re: Markdown grammar definition language

From: Chris Maloney <voldrani@gmail.com>
Date: Thu, 20 Dec 2012 16:21:29 -0500
Message-ID: <CABE9g5PE2c7RCU0zgk9cfoM1avv=egoj3a4EQQ-E2OnAHiRJiw@mail.gmail.com>
To: Dave Pawson <dave.pawson@gmail.com>
Cc: public-markdown@w3.org, "Ian B. Jacobs" <ij@w3.org>
Hi,

Maybe I'm missing something.  I've never worked with PEG, but I have worked
with context-free grammars, and I read the same post you linked to,
http://www.cforcoding.com/2010/01/markdown-and-introduction-to-parsing.html.
 Just from that, I get the feeling that the author is correct that PEGs are
more suited to the task of parsing Markdown.  And there's also the fact
that John MacFarlane has already produced two (here is one:
https://github.com/jgm/peg-markdown/blob/master/markdown_parser.leg).

As for tools that generate parsers from PEGs, it seems that there are many.
 Here's the one used by peg-markdown:  http://piumarta.com/software/peg/,
and this page lists lots more:  http://bford.info/packrat/.

Cheers!
Chris


On Thu, Dec 20, 2012 at 2:42 AM, Dave Pawson <dave.pawson@gmail.com> wrote:

> Your comment re joining copied to W3C Chris
>
> On 19 December 2012 20:06, Chris Maloney <voldrani@gmail.com> wrote:
>
> > My opinion is that just because John MacFarlane found two edge cases that
> > PEG couldn't handle, doesn't mean that you should throw the baby out with
> > the bathwater.  PEG + English is probably the best way to go.  Clearly
> PEG
> > is a better choice than EBNF, and *much* better than plain English (which
> > would be very difficult to get free of ambiguities), or a reference
> > implementation (which would be opaque to humans and difficult to
> maintain).
> >
> > Maybe there is a way to define a PEG+ variant to handle the edge cases.
>
>
> 1. For the core profile we should be able to avoid edge cases.
>
> Try writing PEG for a para, no inlines, terminated with \n\n Chris, if
> that's
> something you could do.
>
> Question. With EBNF we can generate a parser directly. Is that the
> case with PEG?
>
> regards
>
>
> --
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.
> http://www.dpawson.co.uk
>
>
Received on Thursday, 20 December 2012 21:21:57 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 20 December 2012 21:21:58 GMT