views:

110

answers:

1

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?

A: 

A wild guess: To make it simpler to write programs that produce machine-generated C.

caf