[cfe-dev] Clarification for term "AST"

John McCall rjmccall at apple.com
Fri Feb 22 15:27:06 PST 2013


On Feb 22, 2013, at 12:09 PM, Markus Elfring <Markus.Elfring at web.de> wrote:
>> The problem as I see it is that building a "pure" AST of C++ (and C) is just impossible
> 
> I have got a different opinion. - Corresponding solutions will need more efforts
> for further separation of concerns, won't they?
> 
> 
>> because to know whether you have a variable declaration or a functional call
>> you require basic semantic analysis already.
> 
> I guess that you refer to ambiguities in the programming language(s) like they
> were also described by software researchers "Edward D. Willink" and "Adrian D.
> Thurston".
> 
> 
>> This is a defect of the specification of the grammar itself, and it will not be solved now
>> (it would require completely reworking the grammar which is obviously impractical given
>> the number of programs written).
> 
> I assume that there happened some discussions on this already.
> 
> 
>> Therefore, you'll always have "kind-of" a semantic tree,
> 
> I would like to suggest a different approach.
> 
> 
>> without a dedicated Abstract Syntax Tree level.
> 
> I guess that it is another software design challenge to ensure clear interfaces
> between the involved abstraction levels.

To be blunt, invasive refactors based on a non-contributor's sense of
abstractly good software-engineering practices are not welcome.
Understand the problems that our data structures are designed to solve
before trying to tell us the right way to do things.

John.



More information about the cfe-dev mailing list