bsongen: Pointer support

Code gen is slightly ugly, but it does the right thing.
Merge branch 'bson'