A tiny, fast JavaScript parser written entirely in JavaScript, designed for extensibility.
Acorn is a lightweight, high-speed JavaScript parser written entirely in JavaScript. It generates abstract syntax trees (ASTs) from JavaScript code, enabling tools like linters, compilers, and code formatters to analyze and transform source code efficiently.
Tooling developers, compiler engineers, and library authors who need to parse, analyze, or transform JavaScript code programmatically.
Developers choose Acorn for its combination of small footprint, fast performance, and extensible plugin system, allowing customization for various JavaScript dialects without forking the core parser.
A small, fast, JavaScript-based JavaScript parser
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Acorn is optimized for minimal size and maximum parsing speed, as explicitly stated in its README description as a 'tiny, fast JavaScript parser'.
The plugin architecture allows adding support for JavaScript dialects like JSX or TypeScript, enabling customization without forking the core, as detailed in the 'Plugin developments' section.
Includes the `acorn-loose` package for parsing malformed or incomplete code, which is useful for tools that need to handle syntax errors gracefully.
Runs anywhere JavaScript does with no native dependencies, making it highly portable and easy to integrate into various environments.
Creating plugins requires deep knowledge of Acorn's internals and is fragile, as the README warns that plugins are 'likely to break' with significant internal changes.
Support for modern JavaScript dialects often requires additional plugins, meaning extra setup and dependency management compared to parsers with built-in support.
Extending the parser through plugins is not elegant and demands familiarity with the codebase, making it less accessible for developers new to AST manipulation.