Skip to content
GitHub

Guille @ EJCP'26

This week I went to Nantes to give a lecture on compilers.

The challenge: I only had one day.

The aggravant: A very heterogeneous public.

The decision: to lower a bit the bar and do some practical workshops, accessible to many of the students in a short time.

What did we talk about?

  • what's a compiler, what's an interpreter
  • there is no such a thing as an interpreted or compiled language!
  • examples of optimizing compiler pipelines, such as JSCore or V8
  • instruction set architectures and stack machines
  • compiler testing and its challenges
  • intro to fuzzing, random input generation
  • using grammars to generate inputs
  • the oracle problem
  • ideas of concrete compiler oracles: cross-platform and cross-optimization comparisons

The exercises/workshops

One of the things I tried as an exercises was to perform some code exploration using Godbolt -- Compiler explorer. Looking at what the generated code does gives lots of insights on what are the problems generating it, and can make students ask questions!

Looking at Java bytecode, several questions appeared:

  • Why there is no pop here?
  • Why there is a dup?
  • Why there are several instructions to push integer constants?
  • Why some instruction offsets are "missing" from the disassembling?

For the fuzzing exercises, we did a hands-on "fuzz and explore this buggy date parser" in Pharo. The idea behind the exercise is that a simple parser with a relatively small code to read is very approachable to newcomers. This helps understanding the bugs and how to make new strategies to find them in a very short time. And, students have fun bugs to work with!

What worked well? And What did not?

The group was great. Not great, fantastic, the participants were open minded, I was very happy with it. Maybe the rest of the positive points comes from this point, and not due to my influence :)

The guided exercises. The guided exercises worked pretty well. The participants found themselves in the exercises without too much effort. And thus, the questions were mostly technical and focused on the content, instead of the exercises statements.

Exploratory and open exercises. I think the exploratory nature of the exercises were pretty nice. In particular, I designed them to be a bit open, so that students could deviate if curious and explore outside of the proposed statement. That actually worked pretty well too!

Pharo was clearly not a barrier. On the second part, students caught Pharo pretty fast. I did only a ~5' intro on how to use the playgrond. Most of them reverse engineered the syntax, used prof stef, or eventually looked only if they needed.

Some technical hiccups. Of course, as always, some things with Pharo were not as smooth, but the ratio was pretty low. We also were using Pharo12 (because there's where the buggy parser is), which may aggravate some issues. Some things that happened:

  • There were students with old RSA SSH keys!! We just fell back to HTTPS. Now the thing is that it opens a debugger, so for somebody not very used to it...
  • There was a student having SSH connection timeouts to github... and yes, since libgit is running in the main thread in Pharo12, that gives a frozen UI until the connection decides to timeout...
  • One student using NixOS had some hiccups because there was a mismatch in the libgit versions... We manually cloned from the outside and then it worked pretty well.
  • The syntax we use in books to define methods does clearly not work. It's not easy to discover how to create methods without actually giving a course on how to use the IDE...
  • Saving the image is, of course, not a reflex for students!!

Now, I was too ambitious. I actually prepared more material that I could not cover. I had prepared some presentations on register machines, instruction encodings, basic code translation techniques, that were impossible due to time constraints...

The same happened with the workshops. I prepared 4 exercises, and we had a total of 3h for them! Now, I informally benchmarked the progress of students. Turns out that the people that were used to reading bytecode and machine code, managed to do ~3 out of 4 exercises in the given time. Those that were not on the domain did ~1.8 out of the 4 exercises.

Links

If you're interested, here are the links to the school, and the material I prepared:

The School's site

Link to the material