This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: GCC C FRONT END EXPLANATION
hey, could you guys explain me something?
in c-parser.c
in c_parser_direct_declarator, when a function name is being parsed, this if:
if (c_parser_next_token_is (parser, CPP_OPEN_PAREN))
is true, and inside this if:
c_parser_consume_token (parser);
attrs = c_parser_attributes (parser);
so it consumes the token "(", and then calls c_parser_attributes to
check the parameters of the function
but in c_parser_attributes this is made in the beggining of the loop:
c_parser_consume_token (parser);
if (!c_parser_require (parser, CPP_OPEN_PAREN, "expected %<(%>"))
{
parser->lex_untranslated_string = false;
return attrs;
}
I don't understand, after the consumed token "(" there will be a
variable type right?
why it consumed the token without checking it?
and why does it require the token "(" ? aren't we inside the function
parameters list?
that's all for a while
thanks
2009/3/20 Dave Korn <dave.korn.cygwin@googlemail.com>:
> Guilherme Puglia wrote:
>
>> But thanks to everybody.
>> I'll read the gcc docs in the source code!
>
>
> ?The C parser starts in gcc/c-parser.c. ?There are a bunch of lexing routines
> at the top, then you'll see a whole bunch of c_parser_XXXXX routines which
> handle the individual grammar constructs. ?Each one has a commnent at the top
> describing the syntax elements it parses and referring to the paragraph of the
> C standard where they're defined. ?(If you don't have a copy of the C standard
> handy, google "n1256.pdf"). ?Good luck!
>
> ? ?cheers,
> ? ? ?DaveK
>
>