- From: Dominique Hazael-Massieux <dom@w3.org>
- Date: Fri, 21 Dec 2012 18:38:30 +0100
- To: public-script-coord@w3.org
- Cc: public-webapps-testsuite@w3.org
- Message-ID: <1356111510.3064.8.camel@cumulustier>
Hi, As a way to test both my WebIDL parser [1] and the WebIDL grammar, I've been looking at generating random but valid fragments from the WebIDL grammar. To that end, I've been using abnfgen: http://www.quut.com/abnfgen/ Since abnfgen only takes ABNF as input, I've written a quick and dirty script (attached) that converts the grammar as defined in the WebIDL spec (when copied and pasted in a text file) into an ABNF grammar. It does mostly syntax conversion from one grammar to the other, although it also does a few tweaks in order to generate more useful test cases. The grammar that it currently generates is buggy, because the grammar in the WebIDL spec is buggy; attached is a ABNF grammar that more closely matches what I think WebIDL intends. Using that grammar, I can generate a bunch of random WebIDL fragments, e.g. with: for i in `seq 1 150` ; do abnfgen webidl.bnf > test$i.idl ; done which I then run against my parser: for i in *.idl ;do widlproc $i 1>/dev/null ; done This has proved pretty useful in finding bugs in my implementation, as well as bugs in the grammar, so I thought I would share it. (I've already modified a number of test cases in the widlproc repository as a result of this work) Dom 1. https://github.com/dontcallmedom/widlproc
Attachments
- application/x-shellscript attachment: webidl-grammar-to-bnf.sh
- text/plain attachment: webidl.bnf
Received on Friday, 21 December 2012 17:38:53 UTC