D2 Grammar

mpt mpt at iki.fi
Mon Jan 12 10:39:43 PST 2009


Paolo Invernizzi wrote:
> In the documentation, the grammar for Declarator is:
> 
> Declarator:
>         BasicType2 Declarator DeclaratorSuffixesopt
>         BasicType2 Identifier DeclaratorSuffixesopt
> 
> How is possible to parse something like " int i,j; "?
> What are the parser reduction steps?
> 
> Thanks in advance!
> Paolo
> 

Why not take a peek at the source :p? parse.c has the method
parseDeclarator. Like any recursive descent parser, it just checks the
next token and then chooses what to parse next. You have to kind of
unwind the grammar a bit to get all possible tokens that can appear next.




More information about the Digitalmars-d mailing list