Seek recomended reading for a compiler project, Oberon on PIC (Aubrey McIntosh)
1 Dec 2004 23:16:39 -0500

          From comp.compilers

Related articles
Seek recomended reading for a compiler project, Oberon on PIC (2004-12-01)
Re: Seek recomended reading for a compiler project, Oberon on PIC (=?ISO-8859-1?Q?J=FCrgen_Kahrs?=) (2004-12-05)
| List of all articles for this month |

From: (Aubrey McIntosh)
Newsgroups: comp.compilers
Date: 1 Dec 2004 23:16:39 -0500
Keywords: question, architecture
Posted-Date: 01 Dec 2004 23:16:39 EST

Please recommend a bibliography. I want to do some background reading
relevant to implementing an Algol family language on a Harvard
architecture machine. The language is Oberon, and the machine is a
PIC 16F877 microprocessor. The cross-compile operating system is
Bluebottle, and a 30 Mb bootable-from-CD image (intel binaries and
source) is located at for your exploration
and enjoyment. Oberon is a member of the Algol -> Pascal -> Modula ->
Modula-2 -> Oberon -> Oberon-2 -> {Component Pascal, Active Oberon}
family sequence.

The PIC is stark compared to workstation compiler environments. See All the registers are
memory mapped, except the return stack, which is inaccessible. The
peripheral control is also memory mapped, and the registers, devices,
and RAM fragment a common address space of about 256 bytes.
Read/Modify/Write instructions produce incorrect results under
identified conditions. Program code is in 8 Kilo words of ROM.
Addressing is segmented (8 bits plus bank registers & oddly placed
control bits)

On the bright side, it is possible to construct an indirect jump,
useful for procedure variables, case tables. There is 1 indirect
read/write register, which can be exploited at some expense as a
procedure frame pointer. Arithmetic instructions use the accumulator
and a memory location. A flag determines whether the destination is
the same memory location, or into the accumulator. There is 1
external interrupt, 1 execution debugging interrupt, and the
cold-start vector.

One interesting feature is that the ROM can be written under program
control. One project envisioned subsequent to the compiler is a
Network based loader onboard the PIC.

There are compilers for Oberon on several target CPUs available in
source form. I have previously broused the compiler sources for
several different CPUs, and an early compiler is discussed in the
textbook "Project Oberon" by Wirth and Gutknecht. There is at least 1
implementation on the Motorola 68HC11, which is small but still von

There is at least 1 attributed grammar for Oberon (under Coco), but
most compilers are hand crafted. I am fluent in using Coco, and
fluent in Oberon and the available libraries.

I have a math bachelors, and some decades of hobbiest level
programming, and 21 graduate hours in computer science. I can read
and assimilate moderately quickly (a textbook in 2-3 weeks) but I
can't construct a list of currently recommended prerequisites and
reading for a compiler course. I anticipate that I will have a block
of time to work on this project either this spring or summer.

I haven't had a linguistics course, but the language is already
designed and crafted for ease of compilation. I don't think that much
of my work will be on the "front end." Though I really should read up
on linguistics, I'm not designing a language, and I don't have the
sense that this is where I should direct my next effort.

Since what I want is to be sure I'm not missing something important,
it is a little difficult to specify what I want. However, the reading
probably has the "look and feel" of literature on register allocation
or register spillage or call frame efficiency. I do want both
textbook and journal article references, and anything important on
Harvard architecture.

I am designing a curriculum for a third semester lab course in
undergraduate analytical chemistry, named "Instrument Design." I have
produced (envisioned, drawn, prototyped by manufacturer, assembled,
tested, iterated; sold on eBay) a circuit board with timers, A/D
converters, LEDs, a buss, and in-circuit programming to go with this
course. This is my first (and only) independent hardware project (Woo
hoo!!) and so the board referenced above represents the quality that I
can turn out when I embark into a completely new arena. Thus I'm not
completely intimidated by a lack of compiler writing experience.

The syllabus on the course was written before the hardware design or
firmware existed. This syllabus and the board are influenced by my
experience teaching and I expect them to be significantly more useful
in the teaching lab than existing commercial products. They have
"peer to peer" and diagnostic elements, and also encourage the
student to view design as a cycle and not a once-through operation.
This syllabus is available on page 8&9 at Specimen firmware for
the syllabus is now almost completed in assembly code. The item
"packet communications" in the syllabus is expressed as a network time
protocol (ntp) client (receive only, so far), and is working :-)

I want to move this course from an assembly language to a high level
language basis, using Oberon. I also want to keep my preparation
stringent enough so that I ultimately can offer intelligent discussion
about a compiler design course.

I can allocate a block of time Spring, Summer, or Fall 2005. I am
corresponding with one specific group for a visiting position, and
want to do a lot of reading before I travel there.

I also want to put the course in front of a class. It is ready to
offer for Spring 2005, just a few months away, as an assembly based
microprocessor course or as the originally intended instrument design
course. (I do have a lot of lecture preparation to do, and it is late
to select a textbook for a PIC-centric course for spring, but that is
just part of the standard drill.)

If you know of a department that needs an instructor for the
microprocessor course or has some interest in exploring the instrument
design course, and there is another appointment available in computer
science or chemistry, please refer them to

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.