[Tinyos-help] How to use "pstate" in nesC compiler

Sean Walton swalton at cs.utah.edu
Tue Dec 5 11:47:34 PST 2006


David Gay wrote:
> On 12/5/06, Sean Walton <swalton at cs.utah.edu> wrote:
>> I'm stumped.  I trying to figure out what pstate is and how to use it.
>> Can anyone help?
>
> It's the parser state, as the name of its type ("parse_state") might
> have suggested. It's all in one structure to make it simple to make
> the parser reentrant (note that the parse function saves and restores
> pstate).
>
> As to the details of its contents, you'll need to look at the parser
> rules. Documentation on gcc internals (pre version 4) may or may not
> explain some of the weirdnesses there... (there's some amount of
> parser hackery in gcc's C grammar...).
>
> David Gay
Thanks for the reply.
I have added new production to the grammar to enable "intertype 
declarations" (ITD).  One ITD involves adding a new variable to a 
component.  I have tried to hook my grammar up to existing productions:

    anesc_intertype:
            { testAspect = TRUE; } ANESC_INTERTYPE { inAspectITD = TRUE;
    } anesc_declaration
                { inAspectITD = FALSE; $$ = $4; }
        ;

    anesc_declaration:
            fndef
        |    just_datadef
        ;

I then test this with:

    intertype int CommandAttrM.commandCounter;

During the run (nesc compile), I get:

    ** **i**i**n**t**e**r**t**y**p**e** **i**n**t**
    *[kind=674273160]Error: [28793f10] 674273160
    Assertion failed: (0), function parse_declarator, file semantics.c,
    line 763.

The first list is debugging code I inserted which first displays the 
char-by-char input stream and the "kind" value.  Clearly, the 
"spec->kind" is bogus.  In fact, I discovered it to be uninitialized, 
and testing it as a char* I get:

    gdb> p (char*)spec->kind
    $1 = 0x28309788 "aspects/TestAspectM.anc"

Conclusion: somehow, I believe that I am not setting up the "pstate" 
correctly.  Do you have any ideas what I need to do?
-Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20061205/7391cdd4/attachment.html


More information about the Tinyos-help mailing list