I don't about the "interpreter pattern" in OOP. Any good link? |
I found this for you on Wiki. Though it is best just to look in the GOF book.
In any case i wonder if a object hierarchy is a good solution to represent the AST...
I am not sure either. It has its advantages and its bad points. I think most problems are not about the AST per se. Most important thing is that if you don't think carefuly about the environment handling (and just use a table) you are likely to create a crippled language (no recursion, closures etc.)
I discussed a bit of this in my paper on application frameworks (currently, like my entire web presence, offline). In that context I discussed some work on what I termed SEPI = Simple Embeddable Parser and Interpretet. Only the interpreter part (in crippled form) was ever written. I was more interested in how to make the framework embeddable inside other applications (it was generic, allowing the client to override primitives etc.)
Btw: I think this question was raised on comp.compilers awhile ago.