Key Differences Between Acorn / Esprima
I found this quote from nicholas zakas pretty interesting about why eslint couldn't use acorn directly: https://github.com/eslint/espree#frequently-asked-questions
Acorn is a great JavaScript parser that produces an AST that is compatible with Esprima. Unfortunately, ESLint relies on more than just the AST to do its job. It relies on Esprima's tokens and comment attachment features to get a complete picture of the source code. We investigated switching to Acorn, but the inconsistencies between Esprima and Acorn created too much work for a project like ESLint.
We are building on top of Acorn, however, so that we can contribute back and help make Acorn even better.
This repo should try to highlight clearly what differences exist between the various parsers, most of all of which share the same AST structure and basic API.
ESTree is the standard Acorn and Esprima use. It has no notion of tokens. We had some discussions around a CST that didn't really go all that far.
@mikesherov was jscs using esprima directly the whole time?
Until 3.0. But a CST module was created that intelligently combined the tree with the tokens for easy manipulation, whitespace changes.
This is helpful. Describes the differences between babylon and estree:
https://github.com/babel/babylon#output
I plan to write something for #5, I think that should help normalizing the understanding.