Skip to content

Latest commit

 

History

History
62 lines (49 loc) · 2.73 KB

File metadata and controls

62 lines (49 loc) · 2.73 KB

Should Generated Parser Source Be Committed?

Since parser.c and friends can be generated from grammar.js (or grammar.json), wouldn't it be ok to not commit them to one's grammar / parser repository?

Discussion

On a few occasions 1 2 3 maxbrunsfeld has recommended including generated parse source.

Also, currently, various parties (e.g. nvim-treesitter, tree-sitter-langs, Emacs 29+, Cursorless, difftastic, helix-editor, semgrep, etc.) assume the inclusion of these files to varying degrees.

In late 2020, maxbrunsfeld sketched out a draft plan to move away from doing this. A few months later(?), a form of this was added to the Tree-sitter 1.0 Checklist (search for "Mergeable Git Repos").

Of the checked repositories, it appears that around 93% have src/parser.c committed.

ATM then, it appears most folks are doing so and numerous projects that use tree-sitter assume this kind of setup.

Not doing so probably means that it's less likely for the grammar / parser in question to get used as widely.

There appear to be what might be considered compromise options:

It's probably worth noting that there are security implications for what most folks are doing. (There might be some related activity attempting to address some of the concerns.)

References