Re: [stack] Digest Number 635

Soren Renner — 2005-01-18 14:32:21

>
> Thanks for the reference to the Crenshaw book. I had not seen it
> before, but it looks quite nice. One or two centuries ago ( I cannot
> remember), when I started on Pascal, I learnt a lot from Wirth's
> PLZERO (PL0) compiler in his book "Algorithms + Data Structure =
> Programs" (the early version of that book). If you are learning
> about simple compilers, that would be a good one. You will also
> find several at different levels of difficulty on my Pascal page:
> "Symbolic Processing in Pascal". The lates ones cover about the
> same level as Crenshaw.
>
> I applaud your decision to heed Wirth's advice: If at all possible
> (especially if one has a choice about the syntax to be implemented),
> use recursive descent (LLR) parsing and translating. Once one has
> understood the basic idea, it is easy and does not require any
> special tools. Somebody wrote: "An experienced compiler writer
> can write recursive descent as fast as he can write a grammar."
> When I first read that I could not believe it, but I soon saw
> that it is true.


Also look at the various Oberon compilers. When I implemented a sort of Joy in Oberon, I used a recursive descent parser, and it was easy. (That's the only compiler I ever wrote.) I showed it to John Reppy at U. of Chicago and he said it didn't impres him, he had "seen a hundred implementations of Scheme"! But he liked my raytracer.