acorn
A tiny, fast JavaScript parser that turns source code into ESTree-compliant abstract syntax trees.
Repository Health
Technical Analysis
Acorn is a small, fast JavaScript parser written entirely in JavaScript. Given a string of source code, it produces an abstract syntax tree that conforms to the ESTree specification, supporting the full range of finalized ECMAScript features from ES3 through the latest stage-4 additions.
Designed to be embedded, Acorn is the parsing engine behind a large slice of the JavaScript toolchain — bundlers, linters, transpilers, and static-analysis tools rely on it to read code. Its extensible plugin architecture lets consumers redefine parser behavior to support JSX, custom syntax, and experimental proposals without forking the core.
What You Get
- A single
parse(input, options)function that returns an ESTree-compliant AST - Full support for finalized ECMAScript syntax from ES3 through the latest stage-4 features, selectable via
ecmaVersion - A standalone tokenizer and low-level
Parserclass you can drive directly - An extensible plugin system via
Parser.extend()for JSX, types, and custom dialects - Companion packages acorn-loose (error-tolerant parsing) and acorn-walk (tree traversal)
Common Use Cases
- Powering bundlers and build tools that need to read and transform JavaScript modules
- Building linters, formatters, and static-analysis tools on top of an ESTree AST
- Writing codemods and source transformations that inspect or rewrite code structurally
- Prototyping JavaScript dialects and experimental syntax through parser plugins
Under The Hood
Architecture - Acorn is built around a single Parser class defined in src/state.js whose behavior is composed from separate concern-focused modules that each augment the prototype: statement.js, expression.js, lval.js, location.js, and scope.js are imported for their side effects in src/index.js, extending the parser with recursive-descent methods. parse() constructs a Parser, tokenizes on demand through tokenize.js/tokentype.js/tokencontext.js, and walks the grammar to emit Node objects (node.js) matching the ESTree spec. Extensibility is a first-class design goal: Parser.extend() returns subclasses so plugins can override individual methods.
Tech Stack - The library is pure JavaScript (99.9% of the repo) with zero runtime dependencies, authored as ES modules under src/ and bundled with Rollup (rollup.config.mjs) into CommonJS, ESM, and TypeScript-typed distributions. The monorepo also houses acorn-loose and acorn-walk, tooling uses ESLint (eslint.config.mjs), and the package targets Node >=0.4.0, reflecting an emphasis on broad compatibility.
Code Quality - The codebase is mature and well-factored, splitting parsing concerns across focused files with clear naming (readToken, parseStatement, parseExpression). Test coverage is extensive: test/ holds dozens of feature-specific suites (regexp per ECMAScript year, class features, import attributes, top-level await, etc.) run via node test/run.js, plus a Test262 conformance runner (bin/run_test262.js) that validates against the official ECMAScript test suite.
API Design - The public surface is intentionally small — most consumers only need parse(input, {ecmaVersion}) — while power users can reach for the standalone tokenizer, the low-level Parser class, and the Parser.extend() plugin mechanism. Options are numerous but well-documented in the README, and ESM builds ship TypeScript definitions for editor autocompletion. The plugin API requires understanding Acorn’s internals and can break across releases, which is the main ergonomic cost of its flexibility.
Used by 25 apps in this directory
Activepieces
Automation · AI Assistants
Open-source AI automation platform that converts 280+ workflow integrations into MCP servers for LLMs, with no-code builders and TypeScript extensibility.
Appsmith
Developer Tools · Automation · No Code Platforms
Open-source low-code platform to build admin panels, dashboards, and internal tools connected to any database or API.
Armory
Game Development
Open-source 3D game engine that lives inside Blender, letting you model, script, and ship cross-platform games without ever leaving your design tool.
Bun
Developer Tools
An all-in-one JavaScript and TypeScript toolkit — one Rust-and-JavaScriptCore binary that replaces Node.js, npm, a bundler, and a test runner with faster equivalents.
ChartBrew
Analytics · Databases
Open-source reporting platform to build live dashboards from SQL, NoSQL, APIs, and SaaS tools with an AI assistant that creates charts from natural language.
Convex Backend
Developer Tools · Databases
Open-source reactive database that lets developers build live-updating apps with pure TypeScript, strong consistency, and real-time subscriptions—no separate API layer required.
FastGPT
AI Agents · AI Development
Build, debug, and deploy knowledge-based AI agents with a visual workflow editor, RAG retrieval, and support for any OpenAI-compatible LLM.
Hoppscotch
Developer Tools
A lightweight, offline-capable API development ecosystem for testing HTTP, GraphQL, WebSocket, MQTT, and SSE endpoints across web, desktop, and CLI.
HyperFrames
AI Development · AI Design Tools
Turn plain HTML and CSS into deterministic, pixel-perfect MP4 videos — authored by humans or AI agents, rendered by headless Chrome and FFmpeg.