Write the Grammar That Fits

This is not the usual kind of computer science you might have learned in a compiler course, because it's the other way around: you have the text first, and then you write the grammar that fits the text, not the other way around.

For example, we write the grammar that fits the text in the form of the following Elm source code .

grammarString : String grammarString = """ start <- <char+> {action} char <- [a-z] """

This is a string containing a PEG (Parsing Expression Grammar) rule. It defines a simple grammar with two rules: start and char.

`start` expects one or more lowercase letters (specified by `<char+>`) and applies an action `{action}`.

`char` matches a single lowercase letter.

~

See AboutUs Getting Started blog post announcing the open-sourcing of this technology. github

To get started with Elm PEG Parser, you first need to define a PEG Grammar using the Grammar type.

PEGN: Parsing Expression Grammar Notation site by Robert S. Muhlestein

MainSpec.elm test case code

and Render Them as Anchors [⇒ MiniLatex: a Parser-Renderer for … ⇐ Render Wiki Link]

We intend to 'abuse' the multiComment parser page (Context: Whitespace) to Parse Wiki-Style Links.

DOT FROM lambda-browsing