Writing a Language Parser
in 15min (or less)
Xavier Coulon - Red Hat
twitter.com/xcoulon
medium.com/xcoulon
Slide 2
Slide 2 text
About me
Working at Red Hat for 8+ years
Working on OpenShift.io and its successor (we are hiring!)
On my free time, coding on a library to convert Asciidoc to HTML
Slide 3
Slide 3 text
Asciidoc Markup Language
Similar to Markdown
Lot of features
Very well suited for documentation
Slide 4
Slide 4 text
Asciidoc Markup Language Example
*Bold text*
_Italic text_
`Monospace text`
Slide 5
Slide 5 text
Asciidoc Markup Language Example
*Bold text* \*\w+[\s+\w+]*\*
_Italic text_ _\w+[\s+\w+]*_
`Monospace text` \x60\w+[\s+\w+]*\x60
Slide 6
Slide 6 text
Asciidoc Markup Language Example
Some *bold and _italic and `monospace text`_*
Slide 7
Slide 7 text
Photo by Aarón Blanco Tejedor on Unsplash
Slide 8
Slide 8 text
Parsing Expression Grammar
Slide 9
Slide 9 text
PEG to the Rescue
Parsing Expression Grammars:
- Describe a language, using rules to recognize strings
- Use the first matching rule recursively until the end of document is reached,
or tries with the next rule