Sunday, June 11, 2017

How to build your own programming language

I've always fascinated in how programming languages are built and have made it into my 2017's new year resolution to learn building one myself. So here are all the notes collected along the way.

My presentation at Malaysia Open Source Conference - How to build your programming language ? I plan to extend this presentation at upcoming PyCon APAC in this August with an example in Python.

A write up in Malay - Bagaimana bahasa pengaturcaraan dibina ?

A series on building simple interpreter in Python by Ruslan Plivak - Let's Build a Simple Interpreter !

A book on writing an interpreter with Go (Golang). I'm still making up my mind whether to buy this or not - https://interpreterbook.com/.

Free book on building interpreter using Java and then C. This is not complete yet but the author also recommend Interpreter book above in his reply to my reddit's comment. (Updates 2020: It's complete now!)



A classic on building compiler, the original essay was using Pascal. This is my first time trying Pascal and to my surprise the example code (from 1986) still compile in the modern FreePascal - Let's Build a Compiler.

A question on reddit on how to build own programming language.

Creating toy programming language using Python PyParsing library.

An Intro to Compilers - A step by step guide on how a simple "Hello World" in C get pre-processed, tokenized, parsed, optimized and finally compiled to machine language using LLVM frontend and backend tools. Very interesting read and easy to understand.

Using Python ply and llvmlite to build programming language.

Python behind the scenes #1: how the CPython VM works


Programming language zoo - https://plzoo.andrej.com/

https://github.com/jamiebuilds/the-super-tiny-compiler/blob/master/the-super-tiny-compiler.js

https://medium.com/dailyjs/compiler-in-javascript-using-antlr-9ec53fd2780f 

https://speakerdeck.com/pyconslides/so-you-want-to-write-an-interpreter-by-alex-gaynor?slide=43