Possible improvements include:
ast module, several classes need to be changed to be
“bindable”, i.e., to have new data and function members to set, store,
and retrieve their associated definition. Instead of changing several
classes in a very similar fashion, introduce a
class and derive from its instantiation.
How about using true hash tables (aka “unordered associative containers” in Boost parlance) instead of trees? You might also want to try Google’s Sparse Hash Tables.
Once TC-3 completed, you might consider the TC-E option now, see TC-E. It takes about 100 lines to make it.