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