Overview
Explore the fundamentals of parsing, compiling, and static metaprogramming in this 27-minute JSConf EU 2013 talk by Patrick Dubroy. Discover how to leverage compilers and parser generators to eliminate boilerplate, construct domain-specific languages, and accomplish seemingly impossible tasks. Gain insights into compiler basics and popular JavaScript tools and libraries. Learn practical applications such as implementing presubmit checks for style guide violations, extracting translatable strings from code, and automatically inserting logging statements around specific function calls. For aspiring language designers, find out how to create a custom compiled-to-JS language in just five minutes using a parser generator. Delve into topics including parse trees, code generation, context-free grammar, left recursion, nested arrays, and PegJS. Examine real-world code snippets and examples to reinforce your understanding of these advanced concepts.
Syllabus
Introduction
What is a compiler
Parser and Code Generator
SPrema
Parsing Tree
Code
Sample Code
Parse Tree
Compiling Example
ContextFree Grammar
Parsing arithmetic
Left recursion
Nested arrays
PegJS
Snippet Code
Arithmetic
Multiple Expressions
Parse
Variable Declarations
Clean Up
Not JavaScript
Conclusion
Taught by
JSConf