lezer-parser/lezer

Add a printer package

deemp opened this issue · 4 comments

Recently, I started making a new parser and discovered there's still no official parse tree pretty printer. I found one on the CodeMirror forum (link) and saw the original post has gotten 1.8K views since 2020.

Currently, I packaged that pretty printer (link) to use for my new package. However, it'd be nice to have an official package, with at least some parse tree pretty-printing format (not necessarily JSON).

@marijnh, could you please consider adding such a printer to the @lezer family?

No. That's not something I'm going to work on.

May I call it @lezer/printer to make it searchable by prefix on npmjs? Or @lezer-unofficial/printer? Or how?

I don't really want to open the @lezer namespace to 3rd-party code. Just lezer-printer or @lezer-unofficial/printer is perfectly fine.

(You are aware of the very basic pretty-printing that Tree.toString provides, no?)

Okay, it's @lezer-unofficial/printer. I added a comparison with Tree.toString to the README.