Hi Hannes,

I actually did not do any changes to the grammar, I wrote the grammar from
scratch. The reason I did so was to have a proof of concept of my
PetitParser extension for parsing indentation-sensitive grammars such as
Markdown or Python.

The most simplest example you can do is to evaluate following:

PPMiniCommonMark new parse: '
# Heading

- list item
- second list item
'
As a result, you will get HTML fragment, that corresponds to one heading
and list of items. All the supported CommonMark syntax is covered in the
tests, so what you don't see in the test, has to be implemented.

CommonMark is kind of beast to parse, I had to do one big extension to
parse it. It is to introduce the indentation stack (as described in
http://scg.unibe.ch/research/indentParsing). You can see the indentation
stack manipulation in PPMiniCommonMark rules such as: #prefix, #quoteBegin,
#quoteEnd, #itemBullet and #itemEnd.

Cheers,
Jan

On 3 May 2015 at 08:46, H. Hirzel <[email protected]> wrote:

> Thank you Jan, for your work in enhancing PetitParser for Markdown. I
> think I got what you did by loading PetitParser in Pharo 4.0.
>
> I found the examples PPMarkdownGrammarTest, category testing-documents.
>
> I also read http://scg.unibe.ch/research/indentParsing.
>
> Could you please elaborate a bit more about the changes you did to the
> grammar and give some more usage examples?
>
> Regards
>
> Hannes
>
> On 4/14/15, Jan Kurš <[email protected]> wrote:
> > Hey,
> >
> > I also created an indentation sensitive extension of PetitParser, I also
> > included some examples including Markdown. If you load PetitParser, you
> get
> > the Markdown example as well.
> >
> > There is a short introduction to the indentation:
> >
> > http://scg.unibe.ch/research/indentParsing
> >
> > Cheers Jan
> > On Apr 13, 2015 5:24 PM, "H. Hirzel" <[email protected]> wrote:
> >
> >> Are there any news on this?
> >>
> >> --Hannes
> >>
> >> On 12/28/14, Norbert Hartl <[email protected]> wrote:
> >> > I found markdown parsers in smalltalkhub and in the configuration
> >> browser.
> >> >
> >> > http://smalltalkhub.com/#!/~PharoExtras/PetitMarkdown/
> >> > <http://smalltalkhub.com/#!/~PharoExtras/PetitMarkdown/>
> >> >
> >> > and the one in the configuration browser
> >> >
> >> > PPMarkdown
> >> >
> >> > If I understand it correctly both are rooted into work Camillo did.
> The
> >> one
> >> > in PharoExtras looks newer to me. So I assume the best would be to
> copy
> >> the
> >> > ConfigurationOfPetitMarkdown from PharoExtras to MetacelloRepo and
> >> > remove
> >> > the ConfigurationOfPPMarkdown. Right? Or are there any objections?
> >> >
> >> > Norbert
> >>
> >>
> >
>
>

Reply via email to