Skip to content
PhilippeSigaud edited this page Apr 8, 2012 · 21 revisions

Grammar Examples

To show how to create a grammar and to see what Pegged can manager, I added a /examples/ directory containing, as of this writing, the following grammars.

Simple grammars:

These grammars have about a dozen rules (say, from 5 to 20 rules):

Medium-size Grammars:

About 20 - 100 rules:

Large grammars:

I'll call large grammars that have hundreds of rules:

To Be Added:

  • A C grammar. The ISO standard gives one.

  • A more complete XML grammar (the standard grammar is an 80-rules medium-size grammar)

  • The Javascript grammar, probably (I'm not so sure about

  • printf/writef format grammar: a nice example of a small DSL.

Clone this wiki locally