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

Viewed 55188

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?

4 Answers

Most installations of yacc and its clones or replacements (like btyacc, hyacc, bison) have test suites. The grammars in those test suites together make up a list of examples. I assume the same is true for LL parser generators; but I don't know much about them. Since ANTLR was mentioned, then I might also point out that a quick search will reveal the following large example repository under ANTLR https://github.com/antlr/grammars-v4 So, I guess that counts as an answer, too.

Related