The new PCFG G is thus a grammar that can be used to parse the terminals v i and generate derivations that are rooted at the start symbol of the AG.
we transform the task of sampling d i and o i to the task of generating a parse for v i using G , which can be efficiently solved by using an variant of the Inside algorithm for PCFGs (Lari and Young, 1990;Johnson et al., 2007;Goodman, 1998;Finkel et al., 2006).