How to keep AST for feature access?

Posted by greenoldman on Programmers See other posts from Programmers or by greenoldman
Published on 2014-06-10T19:30:23Z Indexed on 2014/06/10 21:46 UTC
Read the original article Hit count: 326

Filed under:
|

Consider such code (let's say it is C++)

Foo::Bar.get().X

How one should keep the AST for this -- as "tree" with root at left Foo(Bar(get(X)), or with root at right (((Foo)Bar)get)X? Or maybe as a flat structure (list)?

The first one seems more convenient when resolving names, the second when working with it as expression.

I set tag parsing but I am asking from semantic analysis POV really (there is no such tag).

© Programmers or respective owner

Related posts about compilers

Related posts about parsing