Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

grammar error in function call when missing comma between parameters #46

Open
willqian opened this issue Oct 16, 2019 · 0 comments
Open

Comments

@willqian
Copy link

willqian commented Oct 16, 2019

update: pull request #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); }
++  }
    ...
}
willqian pushed a commit to willqian/c4-with-chinese-comments that referenced this issue Oct 16, 2019
willqian added a commit to willqian/c4-with-chinese-comments that referenced this issue Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant