[cfe-dev] Cleaning up the representation of Decls in the AST

Zhongxing Xu xuzhongxing at gmail.com
Fri Sep 12 07:10:05 PDT 2008


2008/9/12 Argiris Kirtzidis <akyrtzi at gmail.com>

> Zhongxing Xu wrote:
>
>> I agree with Ted that we should separate syntax thing from semantics thing
>> in the AST.
>>
>> struct s;
>> struct s a;
>> struct s { int d; } x;
>>
>> These 'struct s' have different meanings: type declaration, type
>> specifier, type definition.
>> But syntactically they are all RecordDecl.
>>
>
> Strictly syntactically speaking, and by standard terminology, here's what
> the above constructs are:
>
> struct s;       ->   type-specifier ';'
> struct s a;    ->   type-specifier 'a' ';'
> struct s { int d; } x;    ->  type-specifier 'x' ';'
>
> Isn't it more faithful to the syntax to consider "struct s { int d; }" as
> part of the type-specifier for 'x' ?
>
>
These reflected the parsing steps faithfully. But it is not necessary to
retain parsing information entirely in the AST.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20080912/e4f03e1d/attachment.html>


More information about the cfe-dev mailing list