[While walking 5 miles through the snow …]

On Mar 9, 2025, at 9:03 PM, Douglas McIlroy <douglas.mcilroy@dartmouth.edu> wrote:

> everyone should write for their first compiler in Pascal for a
> simple language and no cheating using YACC.  You need to write the whole
> thing if you want to understand how parsing really works.

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. 

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.

Doug

In 1971 compiler construction course at UT-Austin, we had to use CDC Fortran to build a compiler for a subset of Algol 60. Undergraduates used punch cards and RJE to the 6600/6400 shared by all but the privleged few.

Charlie

--
voice: +1.512.784.7526       e-mail: sauer@technologists.com           
fax: +1.512.346.5240         web: https://technologists.com/sauer/
Facebook/Google/LinkedIn/mas.to: CharlesHSauer