Fixpoint types and recursion schemes. If you define your AST as fixpoint type, you get fold and unfold operations for free.