The Art of Abstrax Syntax Tree on Javascript

Nicolas Restrepo

Sr Frontend in Zemoga and coo-organizer of Bogota.js

@nic_restrepo

How javascript works?

Parsers & The abstract syntax tree

Title Text

V8 - Chrome

SpiderMonkey - Firefox

Chackra - Edge

JavaScriptCore - Safari

TOKENS ?

var foo = 3 * 3;

[
  {
    "type": "Keyword",
    "value": "var" 
  },
  {
    "type": "Identifier",
    "value": "foo"
  },
  {
    "type": "Punctuator",
    "value": "="
  },
  {
    "type": "numeric",
    "value": "3"
  },
  {
    "type": "Punctuator",
    "value": "*"
  },
  {
    "type": "numeric",
    "value": "3"
  },
  {
    "type": "Punctuator",
    "value": ";"
  }
]

(SyntaxError) 😩

So what is the AST?Β  πŸ€”

Β is a tree representation of the abstract syntactic structure of source code written in a programming language. Each node of the tree denotes a construct occurring in the source code.

DEMO, AST (ESLINT RULES)Β  πŸš€

THANKS !!! πŸ‘¨πŸΌβ€πŸ’»

The Art of Abstrax Syntax Tree

By nicolas restrepo

The Art of Abstrax Syntax Tree

  • 285