AST nodes and their string representation are not in a 1-to-1 relationship: you may have different AST nodes (i.e. pointers to different objects) whose string representation is identical. So I can't just have a set of AST objects, which wouldn't eliminate duplicates.