siefkenj / unified-latex

Utilities for parsing and manipulating LaTeX ASTs with the Unified.js framework
MIT License
86 stars 20 forks source link

unified-latex and tree-sitter-latex #74

Open batchor opened 7 months ago

batchor commented 7 months ago

There is another LaTeX parser called tree-sitter-latex based on tree-sitter.

I'm wondering about the similarities and differences between them, and when I should use each?

Any information and hints would be helpful. Thanks!

siefkenj commented 7 months ago

I didn't know about tree-sitter-latex. What a neat project! (It wasn't around when I started unified-latex)

Not knowing much about the project, there are the general things: tree-sitter generates c source, where as unified-latex is pure JS. unified-latex also gives tools for working with the AST and for adding custom macros, etc. AFAIK, macros for tree-sitter-latex must be built into the grammar to be recognized.

In general tree-sitter is made for fast, error-tolerant parsing for things like syntax highlighting. The unifiedjs framework on the other hand is made for manipulation and transformation of ASTs from one format to another.