3 ms·
This email it links to is a fun read about ambiguities in parsing C: https://pdos.csail.mit.edu/archive/l/c/roskind.html https://pdos.csail.mit.edu/archive/l/c/
by jey 6y ago
This email it links to is a fun read about ambiguities in parsing C: https://pdos.csail.mit.edu/archive/l/c/roskind.html https://pdos.csail.mit.edu/archive/l/c/roskind.html
# Getting back to your example, since you copied the grammar from the ANSI
# Standard, your grammar is probably wrong. To expose the problem, try
# parsing:
#
# typedef int A, B(A); /* my bet is you get a syntax error*/
#
# When correctly parsed, the above is equivalent to:
#
# typedef int A;
# typedef int B(A);
#
# or simply:
#
# typedef int A;
# typedef int B(int); /* B's type is function taking an int
# returning and int */