Another Project Oberon RISC emulator
Hi all, I ported Peter De Wachter’s Project Oberon RISC emulator [1] to Go: https://github.com/fzipp/oberon <https://github.com/fzipp/oberon> There are two variants: 1) cmd/oberon-emu: A pure Go version which starts a server that uses WebSockets to communicate with a web browser HTML canvas as a display as well as for keyboard and mouse input. 2) cmd/oberon-emu-sdl: A version based on Cgo+SDL, which requires libsdl2 development files to build. I also ported Niklaus Wirth’s Project Oberon RISC compiler to Go: https://github.com/fzipp/oberon-compiler <https://github.com/fzipp/oberon-compiler> I did it for self-educational purposes, to read and understand Wirth's original source code carefully. Additionally, I found it useful to have a compiler that runs outside the target system, so I could develop code in an environment that is more familiar to me before transferring it to the target system. Best regards, Frederik [1] https://github.com/pdewacht/oberon-risc-emu
On the compiler: nice job! I feel that this is a bigger accomplishment, because the emulators are comparatively easier to understand, whereas the compiler implementation is quite dense (with "cross-cutting concerns") in non-obvious ways, and the Compiler Construction book is not always helpful--indeed, it sometimes provides false hope, since the implementation and techniques for the O0 compiler are not the same as those used for Wirth's "production" compiler. From your README:
This project is free and open source software licensed under the ISC License. <https://github.com/fzipp/oberon-compiler/blob/main/LICENSE>
Note that this is not the ISC license! The license linked from Wirth's homepage and the projectoberon.com site is a mishmash of the ISC License and the MIT License. I don't know where it comes from exactly (was the license text, incl. disclaimer, originally mashed up elsewhere and applied to another project, and then copied/applied to Project Oberon, or was the mashup original for Project Oberon itself?). However, in the absence of an answer, I have taken to calling it the "Project Oberon license".
The functionality is implemented in Go as methods on types (ors.Scanner, orp.Parser, orb.Base, org.Generator), not as free functions in "flat" packages with package scoped variables. This is a deviation from the original implementation, but it allows the creation of multiple compiler instances
I learned the same lesson early as a programmer on "real" software (instead of just homework assignments)--even when you think you really *do* only need a singleton, it's a good idea to go ahead create what C++, C#, and Java call "classes" that permit multiple instances of a given blueprint, and then only ever creating one instance. Even if it's true that you really don't need multiple instances, the cost of doing things this way and being wrong is so much lower (pretty much free) compared to starting out using a singleton, then realizing you're wrong and having to rework everything to allow multiple parallel instances. -- Colby Russell
Hi Colby,
Am 15.09.2021 um 21:42 schrieb Colby Russell <oberon@x.colbyrussell.com>:
On the compiler: nice job!
Thank you for the compliment and the other interesting feedback!
Note that this is not the ISC license! The license linked from Wirth's homepage and the projectoberon.com site is a mishmash of the ISC License and the MIT License. I don't know where it comes from exactly (was the license text, incl. disclaimer, originally mashed up elsewhere and applied to another project, and then copied/applied to Project Oberon, or was the mashup original for Project Oberon itself?). However, in the absence of an answer, I have taken to calling it the "Project Oberon license“.
Thanks, I have updated the README to call it the Project Oberon License as well. Best regards, Frederik
participants (2)
-
Colby Russell -
Frederik Zipp