Tenko New JavaScript Parser Launched
Written by Kay Ewbank   
Tuesday, 10 March 2020

A new JavaScript parser has been developed that supports parsing for versions from ES6 to ES2020 syntax and language features. The developer describes it as "pixel perfect" and 100 percent spec compliant.

Tenko has been developed by Peter van der Zee, an ex-Facebook developer who worked on Infra JS. He chose the name Tenko for the project because it's an anagram of Token, and in Japanese it's a divine beast  - the heavenly fox.

JSlogo

More practically, Tenko supports anything stage 4 up to ES11 / ES2020, as well as deep Regex syntax. It supports a variety of parsing modes, from strict and module to sloppy / non-strict, as well as web compatible/AnnexB.

comes with optional (but enabled by default) support for abstract syntax trees (AST). The default AST that is enabled is Estree, but there's also support for Acorn and any stage 4 Babel except for comments. Van der Zee says Optional chaining AST works but AST spec seems to be still in flux. The AST supports location data, matching Acorn or Babel for reference.

You can set up a no-AST build that the developer says will validate JavaScript almost as perfectly as the regular build except for certain validation cases where it requires the AST. Specifically, these are a binary op afterarrow with block body; regular expressions on a new line after arrow with block body; an update operator anything that's writable but not a valid var or member expression; and delete with an ident that is wrapped in parentheses. 

Tenko comes with 33,000 input syntax tests, and passes the March 2020 ES test262 suite. It has a web-based REPL that can display the output in the parsing modes mentioned earlier (strict, module, sloppy, web compatible, and ES versions6 to 11. The REPL can only run in browsers that have with native support for ES module loading.

It's worth noting that while Tenko is open source, the developers haven't decided on an open-source license, so couldn't be recommended for any production projects. 

JSlogo

 

More Information

Tenko On GitHub

Related Articles

V8 JavaScript Engine Reduces Heap Size

Babel Adds Ability To Parse F# Like Pipelines

Google JavaScript Engine Speeds JSON Parsing

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Azure AI And Pgvector Run Generative AI Directly On Postgres
26/03/2024

It's a match made in heaven. The Azure AI extension enables the database to call into various Azure AI services like Azure OpenAI. Combined with pgvector you can go far beyond full text search. Let's  [ ... ]



CISA Offers More Support For Open Source
22/03/2024

The Cybersecurity and Infrastructure Security Agency (CISA) has announced a number of key actions that they hope will improve the open source ecosystem.


More News

{laodposition comment}

Last Updated ( Tuesday, 10 March 2020 )