ECMAScript Abstract Syntax Tree format.
esast is a specification for representing JavaScript as an abstract syntax tree.
It implements the unist spec.
This document defines a format for representing ECMAScript as an abstract syntax tree. Development of esast started in March 2024. This specification is written in a TypeScript-like grammar.
esast extends unist, a format for syntax trees, to benefit from its ecosystem of utilities.
esast relates to ESTree in that the first is inspired by the latter; an esast is a unist-flavored estree.
esast relates to JavaScript in that it represents it, but esast is not limited to JavaScript and can be extended to support other JavaScript-based languages, like TypeScript.
TODO: estree differences
TypeScript users can integrate esast
type definitions into their project by installing the appropriate packages:
yarn add @flex-development/esast
See Git - Protocols | Yarn for details regarding installing from Git.
interface Node extends unist.Node {}
Node (unist.Node) is a syntactic unit in esast syntax trees.
interface Literal extends Node {
value: RegExp | bigint | boolean | number | string | null | undefined
}
Literal represents an abstract interface in esast containing a value.
Its value
field is one of the following:
- a regular expression (
RegExp
) - a
bigint
primitive - a
boolean
- a
number
- a
string
null
undefined
interface Parent extends Node {
children: Child[]
}
Parent represents an abstract interface in esast containing other nodes (said to be children).
The children
field is a list representing the children of a node.
TODO: nodes
This specification is a work in progess. Please refer to the source code for preliminary documentation.
See the unist glossary.
See the unist list of utilities for more utilities.
estree-util-is-identifier-name
— check if something can be an identifier name
See CONTRIBUTING.md
.
Ideas for new utilities and tools can be posted in esast/ideas.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.