I'm trying to build a parser from a generic grammar   

But first I'm asked to change the grammar from this (A is the start symbol):

```
(A,[(A,[C;B;C]);
    (A,[C]);
    (B,[A]);
    (C,[B])])

```

To something that looks like this:  

```
   (A,
   function
   | A -> [[C;B;C];[C]]
   | B -> [[C]]
   | C -> [[B]])

```

how do I generate a pattern matcher from the information in the list?   

A pattern matcher (function | pattern | ... | pattern) is defined by the programmer, how to create one on the fly with information from a list that has this structure (A,[[C;B;C];[C]])::rest ?

If you want to look a bigger grammar that makes more sense look at [this question](https://stackoverflow.com/questions/1584247/parsing-grammars-using-ocaml).