generators.BSTGrammar("Grammar for L2"):
( { S0, S1, S2, S3 },
  { a:0, b:0, c:1, h:2, v:2 },
  { 1, 2},
  2,
  {
    table "next" {
      table "next.next" {
        S0 -> c[S1<1 1>],
        S1 -> c[S2<1 1>],
        S2 -> c[S3<1 1>]
      }
    },
    table "0" {
      table "0.0" {
        S1 -> h[S1<1 1>,S1<1 1>] weight 4,
        S1 -> v[S1<1 1>,S1<1 1>] weight 4,
        S1 -> S1<1 1>
      }
    },
    table "1" {
      table "1.h" {
        S2 -> h[S2<1 1>,S2<1 2>]
      } weight 4,
      table "1.v" {
        S2 -> v[S2<1 1>,S2<1 2>]
      } weight 4,
      table "1.n" {
        S2 -> S2<1 1>
      }
    },
    table "h" {
      table "h.h" {
        S3 -> h[S3<1 1>,S3<2 2>]
      }
    },
    table "v" {
      table "v.v" {
        S3 -> v[S3<1 1>,S3<2 2>]
      }
    },
    table "a" {
      table "a.a" {
        S3 -> a
      }
    },
    table "b" {
      table "b.b" {
        S3 -> b
      }
    }
  },
  S0<1 1>,
  "next" "0"+ "0"+ "next"  "1"+ "1"+ "next"  ("h","v","a","b")+ ("h","v","a","b")+
  % Formally superfluous repetitions in regular expressions
  % used to achieve better distribution of results when using
  % "random tables"
 )  