Reading this C's BNF grammar I didn't understand which part this:
| postfix_exp '(' argument_exp_list ')'
| postfix_exp '(' ')'
does handle also a function call like id(exp, exp)
and id()
. Is this the single combination valid in C syntax or I'm missing something? if so, why not just:
| id '(' argument_exp_list ')'
| id '(' ')'
The BNF grammar id '(' argument_exp_list ')'
is actually equivalent to postfix_exp '(' argument_exp_list ')'
where postfix_exp
can be a primary_exp
as stated on its l-value.
postfix_exp : primary_exp
| postfix_exp '[' exp ']'
| postfix_exp '(' argument_exp_list ')'
| postfix_exp '(' ')'
| postfix_exp '.' id
| postfix_exp '->' id
| postfix_exp '++'
| postfix_exp '--'
where primary_exp
is:
primary_exp : id
| const
| string
| '(' exp ')'