71 points · by giancarlostoro · 6y ago · 19 comments
It is an honor to see my grammars still being discussed.
These days I work at Amazon, but I can be found on LinkedIn. If contacted with a comment about the grammars (as opposed to a spam missive from a head hunter), I'll typically respond.
What I really need to (finally) do someday is publish my hacks that I added to byacc to increase usability (I think I called it jryacc).
I've always felt that yacc's "error reports" are kindred to having a compiler error listing limited to:
"you have 7 severe errors, 3 errors, and 23 warnings,"
and a reference:
"to understand the issues, please read the machine code."
:-)With yacc, verbose output suggests (at best) that you read the "state transition diagrams" <ugh> to make sense of "n shift reduce, and m reduce-reduce conflicts."
jryacc provided the shortest sequence of terminals to reach any state, identifies any non-terminal that is both left and right recursive (a common malady in grammar construction, which ensures ambiguity), the shortest sequence of terminals to construct each non-terminal, etc.
...oh... and not to fear... I have copies of the grammars and files mentioned... so hopefully they won't be too lost too soon.
Thanks again for the interesting comments.
Jim
# 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 */Thanks,
Jim
My comment was mostly a reaction to this section of the blog post:
> I could only find a single mirror where I could download [the archives c++grammar1.1.tar.Z and c++grammar2.0.tar.Z].
If you happen to have the spare time to set up a public repo (GitHub or whatever), I think it would be great. It would surely help with long-term availability of the files, and people would have a somehow "canonical" link they can reference when they want to cite your work.
From past experience I find "C/C++" a very grating term. Back when I was reading comp.lang.c, "C/C++" was used in questions by particular brands of people, who tried to compile C++ with a C compiler, or compile C with a C++ compiler, or use C++ features in what they thought was C, or in general were confused about the fact that there is no single language called "C/C++", but rather two separate, incompatible languages called "C" and "C++". Anyway, wouldn't it be good to not add to the (potential) confusion?