A tiny, fast JavaScript parser written completely 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 developers to analyze, transform, or build tooling around JavaScript programs. It solves the need for a reliable, extensible parsing foundation in the JavaScript ecosystem.
Tooling developers, compiler writers, and engineers building linters, code formatters, transpilers, or custom JavaScript dialects.
Developers choose Acorn for its combination of small footprint, excellent performance, and powerful plugin system that allows extending the parser without forking it, making it ideal for experimenting with new language features or syntax.
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 highlighted in the key features, making it ideal for performance-sensitive tooling.
It supports custom syntax via plugins using Parser.extend, allowing extension without forking, as detailed in the plugin developments section.
Includes acorn-loose for parsing incomplete or syntactically invalid code, useful for tools handling malformed input.
No native dependencies ensure it runs anywhere JavaScript does, providing portability across environments like browsers and Node.js.
The plugin system requires deep knowledge of Acorn's internals and can break when internal APIs change, as admitted in the README.
Parsing JSX, TypeScript, or other dialects requires additional plugins, complicating setup and increasing maintenance overhead.
As a low-level parser, developers need to understand AST manipulation and plugin development, which may be challenging for those new to parsing.