acorn

A tiny, fast JavaScript parser that turns source code into ESTree-compliant abstract syntax trees.

Library
npm
v8.19.0
11,463 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
76 /100 Good
Development Activity 84
Maintenance 44
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
86 /100 Excellent
Architecture 90
Code Quality 88
Innovation 85
Learning Curve 60

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 Parser class 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 42 apps in this directory

TypeScript
99%
Other

NocoBase

Low Code Platforms · No Code Platforms

24,686

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
99%
Other

NocoBase

Low Code Platforms · No Code Platforms

24,686

Open-source AI + no-code platform that lets coding agents and people collaborate to build business systems fast on proven infrastructure.

View details
94
Repo Health
81
Technical
63
Dependency
Built with
TypeScript 99%
Updated 5 days ago
TypeScript
65%
Other

NocoDB

Databases · Low Code Platforms · No Code Platforms

65,340

Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.

View details
91
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 65%
Vue 30%
Updated 5 days ago
TypeScript
65%
Other

NocoDB

Databases · Low Code Platforms · No Code Platforms

65,340

Turn any SQL database into a collaborative no-code spreadsheet with automatic REST APIs and real-time views.

View details
91
Repo Health
77
Technical
63
Dependency
Built with
TypeScript 65%
Vue 30%
Updated 5 days ago
TypeScript
90%
MIT

open-pencil

AI Design Tools · Design Tools

9,227

An open-source design editor that reads native Figma files, ships a built-in AI assistant with 100+ design tools, and offers real-time serverless collaboration — all without giving up your files.

View details
84
Repo Health
78
Technical
69
Dependency
Built with
TypeScript 90%
Updated 6 days ago
TypeScript
90%
MIT

OpenClaw

AI Agents · AI Assistants

392,894

An open-source AI assistant that runs on your own hardware and meets you in Discord, Slack, WhatsApp, iMessage, Telegram, and 20+ other channels, with native apps for every major platform.

View details
88
Repo Health
88
Technical
66
Dependency
Built with
TypeScript 90%
Updated 5 days ago
TypeScript
81%
MIT

OpenCode

AI Code Assistants

220,711

A fully open-source AI coding agent built for the terminal, with a TUI, desktop app, web client, plugin system, and SDK — one of the most-starred AI coding agents on GitHub.

View details
89
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 81%
MDX 16%
Updated 5 days ago
TypeScript
39%
AGPL 3.0

OpenObserve

Analytics · Devops · Monitoring

22,475

Open source observability platform for logs, metrics, traces, and real user monitoring — delivering 140x lower storage costs than Elasticsearch with a single binary you can run in under 2 minutes.

View details
90
Repo Health
9
Technical
68
Dependency
Built with
TypeScript 39%
Rust 30%
Vue 17%
Updated 5 days ago
TypeScript
39%
AGPL 3.0

OpenObserve

Analytics · Devops · Monitoring

22,475

Open source observability platform for logs, metrics, traces, and real user monitoring — delivering 140x lower storage costs than Elasticsearch with a single binary you can run in under 2 minutes.

View details
90
Repo Health
9
Technical
68
Dependency
Built with
TypeScript 39%
Rust 30%
Vue 17%
Updated 5 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers