Define a PEG Grammar

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

type alias Grammar = List ( String, Rule )

Represents a PEG grammar as a list of rules, each consisting of a name and a corresponding Rule value. The Rule value should be a valid PEG grammar rule that can be parsed by the fromString function. See fromString code for an example of how to create a Grammar from a string representation of a PEG grammar.

Once you have defined your grammar, you can use the parse function to parse input text using the grammar.

~

Parsing expression grammar (PEG) in Elm. github , package