Zig parser in ~70 lines of JS

I know I could use autodoc, and that I could also probably use & compile tokenizer + parser from the stdlib but where’s the fun then? :slight_smile:

Also posted on HN

9 Likes

I had a few attempts at making nice API docs for my async I/O lib, but I always gave up. This seems a bit too extreme for my liking :slight_smile: but maybe I’ll actually give it a try to copy and adapt it.

I once wrote a CSS parser this way too. And then I gave up and rewritten the whole thing in a more typical way - parser combinators are not known to be fast and it’s sort of all-or-nothing, you don’t get a lot of helpful hints if something goes wrong (which again, is much easier to do with classic approach)

But, if you are in luck, and you don’t care about either (I don’t for API docs) then I think it’s a good fit. Have fun :slight_smile: