HNHacker News
TopNewBestAskShowJobs

lboasso

168 karma · joined July 24, 2014

submissionscomments
lboasso··on Compiler Construction: The Art of Niklaus Wirth (2000) [pdf]
I own a copy of "The School of Niklaus Wirth" :) I really appreciate the pragmatism of Wirth's designs and his quest for simplicity.
lboasso··on Compiler Construction: The Art of Niklaus Wirth (2000) [pdf]
I wrote a simple self-hosting compiler to showcase Niklaus Wirth's approach to writing compilers: https://github.com/lboasso/oberonc

Single pass compilers have their advantages.

lboasso··on Go and Versioning: Minimal Version Selection
It makes sense now, Thanks!
lboasso··on Go and Versioning: Minimal Version Selection
> Note that F 1.1 requires G 1.1, but G 1.1 also requires F 1.1. Declaring this kind of cycle can be important when singleton functionality moves from one module to another. Our algorithms must not assume the module requirement graph is acyclic.

I thought we cannot have cycles in Go packages. The Go spec says "The importing of packages, by construction, guarantees that there can be no cyclic initialization dependencies." What am I missing?

lboasso··on C++ Coroutine Theory (2017)
I should have linked the other paper by Ierusalimschy, "Revisiting Coroutines". wahern linked it in his reply. They are both good reads to better understand coroutines.
lboasso··on C++ Coroutine Theory (2017)
A good start could be "Coroutines in Lua" [1]. It explains well the terminology and makes comparisons between designs in different languages.

[1] http://www.inf.puc-rio.br/~roberto/docs/corosblp.pdf

lboasso··on Writing a C Compiler, Part 2
Thanks, my hope is that the Oberon language will not be forgotten.

The Oberon0 language, described in the compiler book, is just a toy to illustrate basic compiler techniques. The full Oberon language is a simple but powerful language, that inspired Go.

lboasso··on Writing a C Compiler, Part 2
I agree, Niklaus Wirth's compiler book is a good introduction to the topic.

To showcase Wirth's approach, I wrote a self hosted Oberon compiler for the JVM: https://github.com/lboasso/oberonc

The compiler can also be used to compile and run the source code of Oberon0 provided in the book, all you need is a JVM installed.

lboasso··on Oberon – The Overlooked Jewel [pdf]
The DEFINITION is an extension of my compiler. It sets the compiler in a different mode, accepting only declarations in the source file. You approach would work, but I prefer a new keyword showing the intent of the source file. DEFINITION is for declarations only, to allow Java-Oberon interoperability.
lboasso··on Oberon – The Overlooked Jewel [pdf]
The 2013 edition of that book (updated with the latest source code) is available at Wirth's website: http://people.inf.ethz.ch/wirth/ProjectOberon/index.html
lboasso··on Oberon – The Overlooked Jewel [pdf]
Yes a custom foreign function interface is needed. In my compiler I did the bare minimum to bootstrap the compiler. Currently you can create a definition module that makes the bridge between the Java and Oberon worlds.

For example the Oberon definition below:

    DEFINITION MathUtil;
      PROCEDURE ln(x : REAL) : REAL;
    END MathUtil.
exposes the Java MathUtil.ln() static method:

    public class MathUtil {
      public static float ln(float x) {
        return (float) java.lang.Math.log(x);
      }
    }
    
A client module can use now the Java implementation of ln:

    MODULE Client;
      IMPORT MathUtil;
      VAR x: REAL;

    BEGIN
      x: = MathUtil.ln(2.0);
    MathUtil.ln()
    END Client;
For a complete example see https://github.com/lboasso/oberonc/tree/master/examples/fern
lboasso··on Oberon – The Overlooked Jewel [pdf]
If you just want to play with the Oberon-07 language (the one used to implement the whole system), there are several compilers available for different platforms. You can find a list here: http://oberon07.com/compilers.xhtml

This includes my own Oberon-07 compiler targeting the JVM: https://github.com/lboasso/oberonc

lboasso··on Oberon – The Overlooked Jewel [pdf]
The Oberon language was instrumental for the creation of the Oberon operating system. Writh makes this clear in several articles. For example http://people.inf.ethz.ch/wirth/ProjectOberon/PO.System.pdf in the "History and motivation" chapter or in the paper "A plea for lean software" [http://neacsu.net/prog/A%20Plea%20for%20Lean%20Software.pdf]
lboasso··on Oberon – The Overlooked Jewel [pdf]
Wirth wrote many articles about the design of his programming languages, a nice starting point for Oberon/Modula-2 is: http://people.inf.ethz.ch/wirth/Articles/Modula-Oberon-June....
lboasso··on Oberon – The Overlooked Jewel [pdf]
Thanks to Robert Griesemer (Phd student of Prof. Wirth), the Go programming language includes some design lessons taken from the Oberon language
lboasso··on Oberon – The Overlooked Jewel [pdf]
For those interested, you can find the latest Oberon system by Prof. Wirth here: http://people.inf.ethz.ch/wirth/ProjectOberon/

You can run Project Oberon with this emulator (pre-built binaries available): https://github.com/pdewacht/oberon-risc-emu

lboasso··on Writing a basic x86-64 JIT compiler from scratch in stock Python
I think Wirth's compiler book is more approachable for a beginner. Once you are done with that book you can also read "Project Oberon" from the same author. This way you can understand the implementation of a full graphical OS written from scratch for a custom made RISC processor implemented on a FPGA. The book and source code are available at: http://www-oldurls.inf.ethz.ch/personal/wirth/ProjectOberon/
lboasso··on Writing a basic x86-64 JIT compiler from scratch in stock Python
I would recommend "Compiler Construction" by Niklaus Wirth. This small book (< 200 pages) will teach you the basics and show you how to build a single-pass compiler for a subset of Oberon (a Pascal successor).

The book is freely available here: http://people.inf.ethz.ch/wirth/CompilerConstruction/index.h...

For a more comprehensive example, you can have a look at my compiler for the full Oberon language targeting the JVM. It is based on the principles of that book: https://github.com/lboasso/oberonc

lboasso··on Show HN: A single pass, self-hosting compiler for the Oberon-07 language (JVM)
Niklaus Wirth is an amazing engineer/computer scientist, unfortunately he is often unknown by new generations (especially later achievements, like Oberon). I was inspired by his work and never ending quest for simple and effective solutions.

If enough people are interested in this project, I am planning to write a blog post series dissecting and explaining the code base (given the small size it should be feasible). Another idea is to port the whole Project Oberon to the JVM like this project https://github.com/schierlm/OberonEmulator, with the difference that the code will run at full speed since there is no emulation involved.

lboasso··on Gosu – A pragmatic language for the JVM
Gosu is more than 10 years old. For some historical background/design decisions please have a look at this article: http://www.drdobbs.com/open-source/language-of-the-month-gos...
lboasso··on Gosu – A pragmatic language for the JVM
Sorry, it does not, unfortunately. We are working on IDEA 13 support but for now our plug-in supports only IDEA 12.
lboasso··on Gosu – A pragmatic language for the JVM
You can have a look at the pom.xml[1] of SparkGS [2](a micro web framework using Gosu). It uses maven, so a 'mvn package' should generate the jars for you.

[1] https://github.com/sparkgs/sparkgs/blob/master/pom.xml [2] http://sparkgs.github.io/

lboasso··on Gosu – A pragmatic language for the JVM
So by default the type inferred is ArrayList, if you want a different type you just specify it.

ex. var strings = { "red", "green", "blue" } //ArrayList

var strings2 : LinkedList<String> = { "red", "green", "blue" }

lboasso··on Gosu – A pragmatic language for the JVM
Exactly if you want to return just an expression you can avoid them, otherwise if you use statements in the body of the lambda you need curly braces.
lboasso··on Gosu – A pragmatic language for the JVM
Java 8 lambdas are not real lambdas, they capture only effectively final local variables. In Gosu you can modify the value of a captured variable.
lboasso··on Gosu – A pragmatic language for the JVM
Mainly because of the Open Type System: http://devblog.guidewire.com/2010/11/18/gosus-secret-sauce-t...
← PreviousPage 2 of 2