grammar error in function call when missing comma between parameters
Author: willqianCreated Oct 16, 2019Updated Oct 16, 2019
update: pull request https://github.com/rswier/c4/pull/47
missing comma when calling test(1 2), and compile ok
int test(int a, int b)
{
return a + b;
}
int main()
{
int result;
result = test(1 2);
return 0;
}patch
else if (tk == Id) {
...
-- while (tk != ')') { expr(Assign); *++e = PSH; ++t; if (tk == ',') next(); }
++ while (tk != ')') {
++ expr(Assign); *++e = PSH; ++t;
++ if (tk == ',') { next(); if(tk == ')') { printf("%d: error unexpected comma in function call\n", line); exit(-1); }}
++ else if(tk != ')') { printf("%d: error missing comma in function call\n", line); exit(-1); }
++ }
...
}Source: rswier/c4