“Create Your Own Compiler” is an interactive tutorial that shows step by step how to write your own simple compiler that transforms JavaScript into Lisp. Along with that, we take a look at what a compiler actually is and the state of the art that is Roslyn.
Compilers are important, but most people go day by day using their favorite programming language and tools without
thinking too much about them, ignoring what happens under the covers.
However peeking into that black box and learning to write a compiler gives you super powers. It will allow you to write custom tools, min languages/DSLs, make your own fully fledged language, or as in “Create Your Own Compiler”, transform one language to another!
A prime example of why the latter, in other words transpilation, has proved indispensable is the case of Babel. Since not all browsers are able to cope with all the latest Javascript language features, Babel translates the newest Javascript code into backwards compatible versions of JavaScript in current and older browsers or environments.
Yet another example is the case of Typescript which adds optional typing (on that matter make sure to also check Sorbet –