ANTLR C grammar, optional init_declarator_list?

Posted by eisbaw on Stack Overflow See other posts from Stack Overflow or by eisbaw
Published on 2010-03-17T16:41:34Z Indexed on 2010/03/17 21:11 UTC
Read the original article Hit count: 164

Filed under:
|
|

Hello,

In the ANSI C grammar for ANTLR v3 ( http://antlr.org/grammar/1153358328744/C.g ), how can init_declarator_list be optional in rule declaration ?

Instead of:

| declaration_specifiers init_declarator_list? ';'

-I would say:

| declaration_specifiers init_declarator_list ';'

What part of the C standard allows statements like:

int;

EDIT:

I just tried, it is allowed! Okay then, why is it allowed?

© Stack Overflow or respective owner

Related posts about c

    Related posts about syntax