doesn't that make you wonder?

Tao Klerks tao at
Thu Oct 20 15:16:09 EDT 2011

OK, so just one follow-up, for my understanding if nothing else:

If a PEG is a grammar, and you need to "hook in" to it to get it to do
useful things like converting markdown to html, then why would you need to
change that PEG (definition/grammar) to USE it to do some other thing, like
produce some way to highlight some text in an OSX app? Wouldn't you just
change the "hooks"? Did you really have to change the PEG, or did you just
change the functions/events/[insert C-appropriate or PEG-appropriate
keywords here. "Actions" maybe?] that hook into it? Is the problem that the
two are interspersed in the current implementation/file? Sorry, I've only
very briefly looked at the "markdown_parser.leg" files in peg-markdown and
peg-multimarkdown, haven't yet had the chance to dive in and actually try to
understand them - I was assuming the PEG itself is entirely defined between
those strange looking "%}" and "%%" delimiters in the file.

Sorry I'm harping on about this, but I'm trying to understand whether/how a
completely new program, in a completely different environment, could
correctly parse the input (let's forget about generating the output -
obviously that portion will depend on the language/environment/framework)
WITHOUT writing a new PEG or equivalent and hoping it's defining the same
AST. I'm hoping (wishfully maybe) that it can simply be copy/pasted, and
then another framework build around it for the "Actions".

From: markdown-discuss-bounces at
[mailto:markdown-discuss-bounces at] On Behalf Of Fletcher T.
Sent: Thursday, October 20, 2011 2:35 PM
To: Discussion related to Markdown.
Subject: Re: doesn't that make you wonder?


Composer uses the same syntax as MMD 3, and uses MMD 3 itself to handle
previews/exports. The PEG has to be modified because we are highlighting,
not parsing. PEGs are not drop-in magic bundles that do everything for you.
They define how to parse the input text. It's up to the programmer to do
something useful with that parsing. But think of Composer as an
implementation of MMD 3, not as something distinct in this sense.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Markdown-Discuss mailing list