parsinggrammarlalrlr-grammarll-grammar

Examples of LL(1), LR(1), LR(0), LALR(1) grammars?


Is there a good resource online with a collection of grammars for some of the major parsing algorithms (LL(1), LR(1), LR(0), LALR(1))? I've found many individual grammars that fall into these families, but I know of no good resource where someone has written up a large set of example grammars.

Does anyone know of such a resource?


Solution

  • Parsing Techniques - A Practical Guide has several examples (i.e. probably half a dozen or so per type) of almost every type of grammar. You can purchase the 2nd edition book, although the 1st edition is available for free on the author's website in PDF form (near bottom of link).

    The author also has some test grammars that he bundles with his code examples from the second edition, which can be found here.

    Note: all of these grammars are small (less than a couple dozen rules), because of this obviously being a published book.