Fantastic ASTs and where to find them
summary
A working Parseltongue→JavaScript transpiler is built end to end: lexer produces tokens, a parser builds an AST, the AST is mutated to ban or rewrite dangerous calls, and code generation plus source maps produce runnable JS and browser debugging. Specific tools shown are esprima, escodegen, esquery. The demo replaces unforgivable functions with rictusempra, emits three alerts, debugs back to Parseltongue source and frees Harry inside about 25 minutes.
AI-written summary · about
chapters (12)
- 0:00Start
- 3:15Weakly Typed
- 3:32Variable Declarations
- 4:07Function Expressions
- 4:30Call Expression
- 7:29Converting variables
- 7:55Converting loops
- 8:25Converting functions
- 11:36Abstract
- 14:19Tokens in JavaScript
- 16:54Function Declaration
- 22:28Detect bad stuff
related talks
31mAST à la Vista, Baby
27mParsing, Compiling, and Static Metaprogramming
44mJavaScript AST programming: Introduction and beyond
22mHow Linters, Compilers & Other Cool Things Work
33mEmbracing Black Magic: The Power of Code Transpilation
31mJavaScript Compilers For Fun and Profit
20mJavaScript Transformation
38mThe magical land of AST's with babel, eslint and codemods
