AST to WebAssembly: writing a code generator at Compose Melbourne 2018
Compose Melbourne 2018 will be held at the end of this month. I will be speaking there about a typical mystical part of compiler implementation: code generation. I will be showing a code generator from a simple AST to WebAssembly and discussing other topics in code generation (not all relevant to WebAssembly).
Ever wonder how your compiler translates your program into machine code but worried that this was some eldritch knowledge, lurking in the depths of compilers where undergraduates fear to tread? Well it’s not, and although it’s a deep topic, the basics are fairly basic.
The WebAssembly MVP is now available in almost all browsers (except IE) providing a fast virtual machine right in your browser. Opening up the web for strong & statically typed functional programming languages*. This presentation will show a simple and elegant code generator that generates WebAssembly from an abstract syntax tree (AST) for a ML-like language. Furthermore the basic algorithm is so straightforward you’ll be filing PRs against your favourite compiler next week!*
*: Almost: The WebAssembly MVP leaves a couple of really awesome features unimplemented, but it won’t be long and these problems will be solved too. We just want to make sure you’re ready.
The presentation will also discuss other architectures including x86_64 and LLVM
Disclaimer: I am friends with the organisers, I like to promote the conference to help my friends, but also because it’s great to have such a solid FP conference in my city! Some sponsors are also friends of mine. Selection of presentations is done partly annonamously and an effort is made to avoid bias, I do not suspect any nepatism.
x86: An Evolution of Kludges
I presented this talk at the Melbourne Haskell User Group last week. It was fun to prepare and deliver. I am not able to publish slides at this stage, not unless/until I present the topic again and polish the slides.
There’s a very good chance that you’re reading this on an x86_64. super-scalar, hyper threaded, 64bit, multicore, computer, with SSE, AVX and a bunch of other extensions of the instruction set (if you’re using a computer at all, and not a mobile device). If that’s the case did you know that as far as CPU compatibility is concerned it’ll happily run MSDOS? Yes, a 16bit operating system from 36 years ago!
Intel, AMD and others have achieved this dramatic evolution from 16bit through 32bit to 64bit computing without breaking backward compatibility, (at least with popular software and features). This presentation will describe this evolution, kludges and clever innovations.