compiler

Unnamed Compiled Systems Language Project
git clone http://frotz.net/git/compiler.git
Log | Files | Refs

resources-and-inspiration.md (3737B)


      1 
      2 # Resources and Inspiration
      3 
      4 ### [Project Oberon](http://www.projectoberon.com/)
      5 
      6 Project Oberon is a very impressive 12kloc single threaded, single user operating
      7 system, filesystem, GUI, compiler (3kloc), drawing tool, and various other little
      8 tools, all running on each an [emulator](https://github.com/pdewacht/oberon-risc-emu)
      9 for or an FPGA implementation (1kloc of verilog) of a 32 bit RISC processor.
     10 
     11 The Project Oberon book (PDFs available from the site above) is a wonderful overview
     12 of all the parts of the system, including all kinds of clever little design tidbits
     13 like:
     14 
     15 > Sector pointers are represented by sector numbers of type INTEGER. Actually,
     16 > we use the numbers multiplied by 29. This implies that any single-bit error
     17 > leads to a number which is not a multiple of 29, and hence can easily be
     18 > detected. Thereby the crucial sector addresses are software parity checked
     19 > and are safe (against single-bit errors) even on computers without hardware
     20 > parity check. The check is performed by procedures Kernel.GetSector and
     21 > Kernel.PutSector.
     22 
     23 I had been slowly getting my compiler project underway when I stumbled over
     24 Project Oberon again and it reminded me that you really don't need *all that much*
     25 code to get some impressively useful results.
     26 
     27 The Oberon language itself is quite nice, though it does feel a bit antiquated
     28 and shouty, probably largely due to the all-caps BASIC/PASCAL style syntax
     29 compared to more popular modern braces-centric languages. You can see some
     30 significant influences to Go though without looking all that hard.
     31 
     32 > "Oberon is an understudied gem. It had a huge influence on Go via Robert 
     33 > Griesemer. Some notes from one of his talks: [link to slide 14](https://talks.golang.org/2015/gophercon-goevolution.slide#14")
     34 > - David Crawshaw
     35 
     36 
     37 ### Some Oberon & Project Oberon Resources
     38 
     39 The Project Oberon Book (PDF):\
     40 [Part One](http://www.inf.ethz.ch/personal/wirth/ProjectOberon/PO.System.pdf),
     41 [Part Two](http://www.inf.ethz.ch/personal/wirth/ProjectOberon/PO.Applications.pdf),
     42 and [Part Three](http://www.inf.ethz.ch/personal/wirth/ProjectOberon/PO.Computer.pdf)
     43 
     44 [Project Oberon RISC5 Reference](project-oberon-risc5-architecture.txt)\
     45 Project Oberon's various descriptions of its RISC5 Architecture are not entirely
     46 in agreement (likely due to evolution over time, the odd typo, source/docs out
     47 of sync). I threw together this reference doc, which I believe is correct vs the
     48 latest version.
     49 
     50 [The Programming Language Oberon](https://inf.ethz.ch/personal/wirth/Oberon/Oberon07.Report.pdf)\
     51 (The Oberon-07 Report, 2016, PDF)\
     52 A 17 page description of the language.
     53 
     54 [Programming in Oberon](https://inf.ethz.ch/personal/wirth/Oberon/PIO.pdf)\
     55 (A Tutorial, 2016, PDF)
     56 
     57 
     58 ### Prof. Wirth's [Compiler Construction](https://inf.ethz.ch/personal/wirth/CompilerConstruction/) Book
     59 
     60 Prof. Wirth also has a wonderful and concise compiler book, Compiler Construction
     61 (PDFs + Source Code), which walks one through the creation of a subset-of-Oberon
     62 compiler.
     63 
     64 I've taken the liberty of combining the two PDFs into one and adding an functional
     65 index/outline for easier navigation through this delightful read:
     66 http://frotz.net/misc/Compiler.Construction.Wirth.2017.pdf
     67 
     68 I had the lexer working and the parser already underway, but the approach to
     69 straight line code generation I've started working with is very much influenced
     70 by this book and the Project Oberon compiler.
     71 
     72 
     73 ### [The Selfie Project](http://selfie.cs.uni-salzburg.at)
     74 
     75 A related project of interest is "selfie", a 12kloc 64bit RISCV (formerly MIPS)
     76 subset emulator, hypervisor, C subset compiler, etc. They don't go up the stack
     77 to a full OS+GUI but rather look down the stack, toward emulation, virtual
     78 machines, etc. 
     79