BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Tenko ES2020 JavaScript Parser

Tenko ES2020 JavaScript Parser

This item in japanese

Bookmarks

Tenko is a 100% specification-compliant JavaScript parser authored in JavaScript by software engineer Peter van der Zee. Tenko fully supports parsing for ES6 through to ES2020 syntax and language features.

Tenko provides a range of features. Beyond support for language features, Tenko optionally supports abstract syntax trees (AST) for Estree, Acron, Babel, and Optional chaining AST.

Tenko includes more than 33,000 input syntax tests, and passes the current ES test262 suite. Tenko provides a web-based REPL to try the parser with a variety of options. The REPL leverages ES Modules and requires browsers with native support for ES module loading.

Tenko does not have an explicit ES5 mode, but generally works with ES5 code provided that a codebase does not leverage the minor incompatibilities between ES5 and ES6 that developers should not be using, which includes function statements and duplicate object keys.

Van der Zee, on the reasons for creating Tenko:

Tenko can explicitly toggle web compat mode on/off, and it can explicitly parse against a particular EcmaScript version (6+), which may be relevant to developers targeting a particular environment guaranteed not to have anything newer. It seems all parsers include web compat mode by default, without a way to opt out of it. Some allow you to toggle sloppy vs strict mode. Many have just one mode which mixes the whole thing up.

Tenko is in its very early stages, in a space with several other JavaScript parsers. The codebase is open-source software, and contributions are encouraged via the Tenko GitHub project. Note that the project is still deciding on an open-source license which should get defined before Tenko gets leveraged for anything beyond experimentation.

Rate this Article

Adoption
Style

BT