[Oberon] Modified Oberon-07 compiler adding the numeric CASE statement

Chris Burrows chris at cfbsoftware.com
Fri Jun 15 14:34:49 CEST 2018

> -----Original Message-----
> From: Oberon [mailto:oberon-bounces at lists.inf.ethz.ch] On Behalf Of
> Andreas Pirklbauer
> Sent: Friday, 15 June 2018 12:05 AM
> To: ETH Oberon and related systems
> Subject: [Oberon] Modified Oberon-07 compiler adding the numeric CASE
> statement
>     > Make that at least five. The following Oberon-07 compilers
> implement
>     > CHAR and INTEGER CASE statements as well:
>     >
>     > Congdm's Patchouli Compiler - Windows Oberon-07 for Intel
> (AMD64) architecture
>     >     https://github.com/congdm/Patchouli-Compiler
>     >
>     > Karl Landstr m's OBNC:
>     >    http://www.miasap.se/obnc/
> Interesting. Although .. these are not particularly well suited for
> *direct* comparison (e.g. of size of generated code size, jump table
> implementation, overhead of any selection in a CASE statement,
> implementation effort..) with implementations on RISC - Patchouli
> generates ARM code, while OBNC outputs C code.
> PS: I like the Patchouli implementation (previously called Aya) and
> may use some ARM-sepcific insights from that piece of work for an ARM
> implementation of the original Oberon-07 compiler (cross-compiler on
> RISC).

Is there more than one Patchouli Compiler? The one I referenced above targets Intel (AMD64) architecture. I have used it to create executables that run on Intel Windows 10. It doesn't generate ARM code.

If you want some ARM specific insights for an ARM implementation refer to Section 15 'The CASE statement' in the Niklaus Wirth's document 'An Oberon Compiler for the ARM Processor' which you can download from:


Some historical information:

The 2008 ARM7-architecture version of Astrobe (called Armaide until ARM asked us to change its name) was derived from that compiler. The key ARM7 instruction that makes it efficient is an indexed jump instruction very similar to the one we have implemented in RISC5:


i.e. PC := PC + ([R11] * 4)

Keep in mind when you read the document that at that time the CASE statement defined in the Oberon-07 report was INTEGER only so it was reasonable to assume that CASE occurrences would often start from zero. CHAR (single-character strings) CASE statements did not become part of the Oberon-07 language until 2011 as announced here:


Subsequently we introduced the optimisation to reduce the jump table size for MinCase > 0 as it was less likely that CASE statements would reference the low-end of the ASCII character set.

Chris Burrows
CFB Software

More information about the Oberon mailing list