Parsing Expression Grammar

In computer science, a parsing expression grammar, or PEG, is a type of analytic formal grammar, i.e. it describes a formal language in terms of a set of rules for recognizing strings in the language. The formalism was introduced by Bryan Ford in 2004 and is closely related to the family of top-down parsing languages introduced in the early 1970s. Syntactically, PEGs also look similar to context-free grammars (CFGs), but they have a different interpretation: the choice operator selects the first match in PEG, while it is ambiguous in CFG. This is closer to how string recognition tends to be done in practice, e.g. by a recursive descent parser.

Unlike CFGs, PEGs cannot be ambiguous; if a string parses, it has exactly one valid parse tree. This makes PEGs well-suited to parsing computer languages, but not natural languages.

Read more about Parsing Expression Grammar:  Implementing Parsers From Parsing Expression Grammars, Advantages

Famous quotes containing the words expression and/or grammar:

    Great speeches have always had great soundbites. The problem now is that the young technicians who put together speeches are paying attention only to the soundbite, not to the text as a whole, not realizing that all great soundbites happen by accident, which is to say, all great soundbites are yielded up inevitably, as part of the natural expression of the text. They are part of the tapestry, they aren’t a little flower somebody sewed on.
    Peggy Noonan (b. 1950)

    Literary gentlemen, editors, and critics think that they know how to write, because they have studied grammar and rhetoric; but they are egregiously mistaken. The art of composition is as simple as the discharge of a bullet from a rifle, and its masterpieces imply an infinitely greater force behind them.
    Henry David Thoreau (1817–1862)