A tree representation of source code structure. Each node is a construct (VariableDeclaration, BinaryExpression, FunctionDeclaration, etc.). The AST is the input to compilation, linting, transpilation, and bundling.
Syntax Parser and AST in JavaScript
What is an Abstract Syntax Tree (AST) in JavaScript?
The answer
More FAQs in Syntax Parser and AST in JavaScript
A program that reads source code, splits it into tokens (lexing), and builds an Abstract Syntax Tree (parsing). V8's parser does this before any code is compiled or executed.
Because the parser fails to build an AST. Without an AST, the engine cannot compile or execute the code. One syntax error invalidates the entire script or module.
V8 pre-parses functions (a quick scan) and only fully parses them when they are called. This speeds up startup for code that is not immediately executed. It is one reason code splitting improves load time.
Still have questions?
Browse all our FAQs or reach out to our support team
Want to upskill yourself?
Your learning library
Small steps. Big possibilities.
Find your next course. Build something great.