[Mesa-dev] [PATCH 4/6] glsl: Reference data structure ctors in grammar

Dan McCabe zen3d.linux at gmail.com
Fri Jun 24 13:06:39 PDT 2011


On 06/20/2011 03:34 PM, Ian Romanick wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 06/17/2011 05:43 PM, Dan McCabe wrote:
>> We now tie the grammar to the ctors of the ASTs they reference.
>>
>> This requires that we actually have definitions of the ctors.
>>
>> In addition, we also need to define "print" and "hir" methods for the AST
>> classes. At this stage of the development, we simply stub out the "print"
>> and "hir" methods and flesh them out later.
>>
>> Also, since actual class instances get returned by the productions in the
>> grammar, we also need to designate the type of the productions that
>> reference those instances.
>> +	   void *ctx = state;
>> +	   $$ = new(ctx) ast_switch_statement($3, $5);
> In this instance (and the similar ones below), I'd just do 'new(state)'.
>   After most of the parser was written we started always calling the
> memory context mem_ctx.
Will do. It wasn't clear to me what the rhyme or reason was behind using 
state vs. ctx. Apparently, my usage matched that rationale.


More information about the mesa-dev mailing list