Settings

Theme

Show HN: Zig parser in ~70 lines of JavaScript

github.com

10 points by cztomsik 14 days ago · 0 comments · 1 min read

Reader

I wanted something lighter than zig autodoc so I've implemented (and golfed a bit) a custom parser using parser combinators in JS. It's not 100% correct and it's also not meant to be, all I care about is if it can parse my own Zig code, not any valid Zig code.

There are also some bugs, and I don't intend to support, nor develop this much further, consider it vaporware which you are free to fork and use it for something, or just have some fun reading the code and figuring out how it works (I certainly had a lot of fun implementing it - no LLMs, so it was a nice exercise too).

BTW: I know it's probably very inefficient, and I don't care - it goes through 67 files in 0.19s and I don't expect it to be ever a bottleneck for this use-case, so I've spent exactly 0 minutes trying to optimize it.

No comments yet.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection