Representing an Abstract Syntax Tree in C

You can make any of these work.

I prefer the union layout, because then all nodes have “the same” layout.

[You may find it useful to have a “child sublist” option, e.g., and arbitarily big, dynamic array of children, instead of having left- or right-leaning lists.]

You are going to find that this issue isn’t the one that makes building your compiler hard. Rather, it is having symbol tables, performing various kinds of analyses, choosing a machine-level IR, building a code generator, and doing code optimizations. Then you’re going to encounter real users and you’ll discover what you really did wrong :-}

I’d pick one and run with it, so that you have a chance to get near the other issues.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)