Is there a simple explanation of Wirth's source code or even a version with a little more commenting so that I can figure out how it works?
Wirths pl/0 compiler is here: http://www.moorecad.com/standardpascal/plzero.pas
My main goal is to modify it to work with integer arrays similarly to Oberon but to touch the code as little as possible
Oberon referenced here: http://www.ethoberon.ethz.ch/WirthPubl/CBEAll.pdf
The code is described in detail in Wirth's book, Algorithms + Data Structures = Programs. I'm looking at the 1976 edition, which contains about 70 pages about the program.
As far as I can tell, the 1976 version of the book is not online, but he later ported the code to Modula-2 and then Oberon. The Oberon edition is available as a free PDF, but the PL/0 chapter was removed and expanded into a second book (also free online), Compiler Construction.
This expanded book uses a more robust language called Oberon-0, which includes arrays, records, types, etc. He discusses in detail how to implement each of these things.
The entire compiler is different, since it's written in Oberon and targets a different machine, but all of Wirth's compilers share the same basic structure, so you should be able to map ideas between them.
Alternatively, he also wrote another expanded compiler in pascal (the "p4" reference implementation for ISO pascal. That compiler has been extensively studied and documented in the book Pascal Implementation, now transformed into a nice website with hypertext cross references to the source.
Finally, there is also a python port of the PL/0 compiler by Samuel G Williams. My fork of his PL/0 Languages Tools includes a couple additional back-ends, as well as a copy of Wirth's original code (the program you linked), modified slightly to run under Free Pascal.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With