Why Should Programmers Learn Compilers?

Hacking Compilers

Why Should Programmers Learn Compilers?

Whether you want to simply adjust your editor's syntax-highlighting or you want to write a small domain-specific language to make certain tasks easier -- a knowledge of how compilers work is important. The Jordan Open Source Association hosted Amjad Masad, JS Infrastructure Engineer at Facebook, to go over basic compiler knowledge and to talk more specifically about JavaScript transpilers and how they're changing the world of web development.

Within the monthly JOSA TechTalks organized by the Jordan Open Source Association, Amjad Masad, JS Infrastructure Engineer at Facebook, gave a session on how compilers work and how to solve real-world problems with a robust knowledge in compilers.

Masad said that every engineer should be familiar with compilers in order to understand how programming languages are built, and -in a broader perspective- how computers themselves are built. "A necessary knowledge that helps you in building tools and implementing unit testing". Masad added, citing a blog post by Steve Yegge, that every engineer should have the "superpower" of dealing with compilers to understand how to manipulate code.

After that, Masad gave an overview of DOMQL, a toy language he created in 2011, to present different compiler phases, from lexer to parser, optional analysis and code generation, all with a working example consisting of an HTML with a DOMQL script.

He then solved some real word problems with multiple techniques, he specifically focused on writing a Lint rule (to disallow new code in using function expression), adding new syntax to the lexer to allow old editors to support and style it, writing a codemod transform if a codebase uses old function expressions or writing a compiler transform (in cases similar to when IE doesn't support new syntax or features).

Finally, to improve their programming skills and to enhance their knowledge in practical methods, Masad urged participants to learn the basics of compilers, build related tools or their own programming languages, and to think -within compilers- on ways to improve the Web.



Are you interested in attending JOSA TechTalks and join the biggest Meetup group in Jordan? Register at this link: http://www.meetup.com/JOSA-TechTalks/