A type system for reflective program generators