start ::= <<set_budget[A,2]>><<set_budget[B,2]>><<x>><<x>><<x>>

// Pass a type variable as the `name` argument of `take_budget`.  This works as
// long as the constructor of `T` is known before `take_budget` is expanded.
for[T] x ::= <<choose[T]>><<take_budget[T,1]>>

choose[A] ::= A
choose[B] ::= B

// output 0: AAB
// output 1: ABA
// output 2: ABB
// output 3: BAA
// output 4: BAB
// output 5: BBA
