Reducing the parser's size

Hello Marijn,

We’re bundling up the parser to run it in functions with size limitations. With minify and tree shaking, we were able to compress the entire bundle to ~170KB.

Is there any other way to reduce the size beyond this? Thank you.

Not that I’m aware of, no. But that is big—even the most horrible grammars (C++, PHP) that I’ve written come out at around 90k. Sometimes small changes to the grammar reduce the state count (and thus disk size) a lot, but unfortunately this is also still black magic to me (the LR algorithm isn’t the most intuitive thing) so I can’t really give you pointers on what might help.

1 Like

Ah okay. Thanks for your response! The language is a dialect of sql, so is syntax heavy, the grammar crosses 2K lines, along with a lot of keywords.