Chapter 1. Getting Started

Esprima is a tool to perform lexical and syntactical analysis of JavaScript programs. Esprima itself is also written in JavaScript.

To get the feeling of what Esprima can do, please try its online parser demo:

Online parser demo

The left panel is a code editor, it can accept any JavaScript source. If the source is a valid JavaScript program, the right panel shows the syntax tree as the result of parsing that JavaScript program. The syntax tree can be displayed in its original form (JSON, but formatted) or in its visual form (hierarchical node view).

Important: Esprima can only process JavaScript programs. It does not handle other variations of JavaScript such as Flow, TypeScript, etc.