Upgrade to Pro — share decks privately, control downloads, hide ads and more …

5-min-introduction-to-ASTs-in-javascript.pdf

 5-min-introduction-to-ASTs-in-javascript.pdf

From transpilation to linting to static code analysis, ASTs are everywhere. Learn about ASTs and the different tools that come equipped with it. Use the power of Abstract Syntax Trees (AST) to understand your code better.

Further Readings / References:

1. https://www.youtube.com/watch?v=CFQBHy8RCpg
2. https://medium.com/basecs/leveling-up-ones-parsing-game-with-asts-d7a6fc2400ff
3. https://blog.sessionstack.com/how-javascript-works-parsing-abstract-syntax-trees-asts-5-tips-on-how-to-minimize-parse-time-abfcf7e8a0c8
4. https://alligator.io/js/traversing-ast

Saugat Acharya

September 21, 2019
Tweet

More Decks by Saugat Acharya

Other Decks in Programming

Transcript

  1. Formatting Format code using Prettier Works by compiling code to

    an AST, and then pretty-printing the AST
  2. What Can You Do with ASTs? Examples 1. Create your

    own Babel plugin 2. Write custom ESLint rules 3. Generate codemods to refactor code quickly 4. Analyze your code by looking into AST parse times 5. Build your own AST parser