With the popularity of the latest ECMAScript standard and before that CoffeeSript, JS compilers are everywhere. JS projects are now using them in one way or another, most for source to source compiling, many for code coverage etc. Babel being the most popular compiler. Apart from its native features, it also allows us to extend the language by developing custom Babel plugins. We will discuss the development of custom Babel plugins. However in this talk, we will go a step further and learn about Abstract Syntax Tree. Use that knowledge to put together our own compiler. This compiler will allow us to transform or compile JS to anything. The project will be a super tiny compiler. It will be easily extensible and opensource. By the end of the talk, an attendee should be able to use it as a boilerplate and build their own version.
- Brief discussion around Babel Plugins.
- What is an Abstract Syntax Tree?
- What is the setup required to build your own compiler?
- Bringing together a super tiny compiler.
- Code overview and demo.
- How to acquire and extend the demo compiler.
I have been contributing to open source communities since 2010 (KDE and X.Org being the main ones). I am one of the authors of the official KDE Developer’s Guide book (https://flossmanuals.net/kde-guide/).
PULUG (https://groups.google.com/forum/#!forum/pulug) is an open student developers’ community which I helped establish and now also hosts the annual SFD in Chandigarh where I mostly speak. (http://softwarefreedomday.in/)
- Blog about Babel ES6 transforms: http://supreetpal.blogspot.in/2015/08/es6-babel-transforms-code-injection-and.html
- Boilerplate to build Babel plugins: https://github.com/supreetpal/babel-plugin-boilerplate
- Twitter: https://twitter.com/supreetpal
- Linkedin: https://www.linkedin.com/in/supreetpal