Hi Ricardo, On Fri, Jun 6, 2025 at 3:36 PM Ricardo G. Herdt <r.he...@posteo.de> wrote: > > Hi, > > Motivated by this discussion I took the chance to have some fun writing > parsers and > wrote one for Web IDL files in Guile: > > https://codeberg.org/rgherdt/webidl-parser
Wow, this is awesome!!! > Actually there are two parsers involved. The first reads the > WebIDL-grammar and generates parts of > the main parser for IDL files. But that's an implementation detail :) . > See README.md. > > For now the result is an s-expression based parse tree, with some > simplifications to make > working with it easier. I could develop it further to simplify even more > or help generating > bindings or something like that. If you have ideas of what target > bindings could look like let me know. Right > now I'm not sure what information of IDL-described APIs are relevant for > binding generation, so I will > postpone work on it until needed. > > I did some tests with IDL references from > https://github.com/w3c/webref/tree/curated. Most of them > work, with two exceptions due a possible inconsistency in the spec, as > noted in my README. > Solving it should be trivial though. Some IDLs I got from Gecko are > problematic, since they have #ifdef > directives and stuff like that, which are not expected by the grammar. > Adapting the lexer shouldn't be difficult, > just let me know if that's needed. I hope to find some time to take this library for a spin soon. Maybe sometime in the next couple of weeks. I'll let you know if I run into any trouble or have questions. This is one huge step towards having Scheme libraries for a whole bunch of Web APIs! Thanks again, - Dave