below... (At the risk of a case of being in disagreement with someone I
rarely am).
On Sun, Mar 9, 2025 at 10:03 PM Douglas McIlroy <
douglas.mcilroy(a)dartmouth.edu> wrote:
Yacc certainly makes it easier to write parsers for big grammars, but
it's far from cheating. You need to know a lot more about parsing to use
Yacc than you need to roll your own.
I disagree here. I have wtchged too many young programmers that I realized
did not understand what yacc was doing and came to understanding that
never built a simple parse before.
I'm not asking them to rebuild a parser for Algol68 or C++ in a one
semester course. I asking that to you take something like Dennis Allisons
"tiny basic" assignment for his Stanfrodf students in the lat 1970s and ask
them to build that.
Peter Hibbard gave us a super small Algol-ish language, and we generated
code for the "CMU Mini" (which was basically Gordon Bell's the precursor
to
the PDP-8 (see ISP below) - in my time the "Dragon Book was not yet written
BTW. I really understood what Stev had accomplished.
The interesting thing is while I tend to use yacc for most parsers, I've
found myself building recursive descent parsers in a couple of cases where
it seems to make better sense.
Hand parsing of a tiny grammar is almost a necessary step on the way to
understanding Yacc. But I think hand-building the whole parser for a
compiler is unnecessary torture--like doing trigonometry with log tables.
Point table ... however a funny thing to consider. My father was a high
school math teacher for 40 years. He noted that the loss of slide rules and
trig tables made his "modern" (post-calculator) students not understand
interpolation.To me, learning to use mathematical tables is a skill that
never hurts. I don't even think of asking people "to walk uphill both ways
to school in the snow and rain instead of riding a heated, dry yellow
school bus." I am asking the student to learn foundational ideas and build
skills up top of core understanding.
ᐧ