Representing an Abstract Syntax Tree in C
问题 I'm implementing a compiler for a simple toy language in C. I have a working scanner and parser, and a reasonable background on the conceptual function/construction of an AST. My question is related to the specific way to represent an AST in C. I've come across three styles pretty frequently in different texts/resources online: One struct per type of node. This has a base node "class"(struct) that is the first field in all the child structs. The base node contains an enum that stores the type