W3C home > Mailing lists > Public > public-script-coord@w3.org > October to December 2012


From: Robin Berjon <robin@w3.org>
Date: Tue, 30 Oct 2012 18:25:26 +0100
Message-ID: <50900D86.4060904@w3.org>
To: public-script-coord@w3.org
Hi all,

just a quick note to tell you that I've written a completely new version 
of JS WebIDL parser. The previous version was a one-off hack that I 
wrote really quickly because I needed something, but that became used a 
fair bit more than I'd intended.

The new version is available at https://github.com/darobin/webidl2.js 
(all the useful content being currently in the develop branch). You can 
also install it with npm install webidl2.

Compare to the previous version this one is about 6x less code (which 
translates to 4x smaller minified or 2x smaller minizipped) and 4x 
faster. The test suite still needs a lot of work (which is why I'm not 
considering this to be final) but most importantly I believe this to be 
much more correct and to be up to date with features currently in the 
draft. It also has far better error reporting.

The parsing interface is simple. In node, you require it and call 
parse(idlSource) on that. In the browser it creates a global WebIDL2 
object on which to call that (I haven't run the TS in the browser yet).

The AST you get is very similar to the one you got in v1, but some 
adjustments have been made in order to be more systematic, and to map 
better to what's actually in the spec now.

So if you're using v1, I invite you to give v2 a ride and tell me how it 

Robin Berjon - http://berjon.com/ - @robinberjon
Received on Tuesday, 30 October 2012 17:25:40 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:07 UTC