tree-sitter-org VS instaparse

Compare tree-sitter-org vs instaparse and see what are their differences.

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
tree-sitter-org instaparse
11 7
206 2,705
- -
2.1 6.0
2 months ago 24 days ago
C Clojure
MIT License Eclipse Public License 1.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.

tree-sitter-org

Posts with mentions or reviews of tree-sitter-org. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-05-19.
  • Emacs and Java Development: Corfu + Cape + LSP-Mode + Treesit
    21 projects | /r/emacs | 19 May 2023
    (use-package treesit :ensure nil :custom ;; Some stuff taken from here: https://robbmann.io/posts/emacs-treesit-auto/ (treesit-extra-load-path '("/usr/lib64/")) (treesit-language-source-alist '((bash . ("https://github.com/tree-sitter/tree-sitter-bash")) (c . ("https://github.com/tree-sitter/tree-sitter-c")) (c++ . ("https://github.com/tree-sitter/tree-sitter-cpp")) (csharp . ("https://github.com/tree-sitter/tree-sitter-c-sharp")) (css . ("https://github.com/tree-sitter/tree-sitter-css")) (elixir ("https://github.com/elixir-lang/tree-sitter-elixir")) (html . ("https://github.com/tree-sitter/tree-sitter-html")) (java . ("https://github.com/tree-sitter/tree-sitter-java")) (javascript . ("https://github.com/tree-sitter/tree-sitter-javascript")) (json . ("https://github.com/tree-sitter/tree-sitter-json")) (lua . ("https://github.com/Azganoth/tree-sitter-lua")) (makefile . ("https://github.com/alemuller/tree-sitter-make")) (org . ("https://github.com/milisims/tree-sitter-org")) (python . ("https://github.com/tree-sitter/tree-sitter-python")) (tsx . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "tsx/src")) (typescript . ("https://github.com/tree-sitter/tree-sitter-typescript" "master" "typescript/src")) (ruby . ("https://github.com/tree-sitter/tree-sitter-ruby")) (rust . ("https://github.com/tree-sitter/tree-sitter-rust")) (sql . ("https://github.com/m-novikov/tree-sitter-sql")) (toml . ("https://github.com/tree-sitter/tree-sitter-toml")) (yaml . ("https://github.com/ikatyang/tree-sitter-yaml")))) (major-mode-remap-alist '((c-mode . c-ts-mode) (c++-mode . c++-ts-mode) (csharp-mode . csharp-ts-mode) (css-mode . css-ts-mode) (html-mode . html-ts-mode) (java-mode . java-ts-mode) (js-mode . js-ts-mode) (json-mode . json-ts-mode) (makefile-mode . makefile-ts-mode) ;; (org-mode . org-ts-mode) ;; not mature yet (python-mode . python-ts-mode) (typescript-mode . typescript-ts-mode) (ruby-mode . ruby-ts-mode) (rust-mode . rust-ts-mode) (toml-mode . toml-ts-mode) (yaml-mode . yaml-ts-mode))) (treesit-auto-fallback-alist '((toml-ts-mode . conf-toml-mode) (typescript-ts-mode . nil) (tsx-ts-mode . nil))) (treesit-font-lock-settings t) (treesit-simple-indent t) (treesit-defun-type-regexp t)) (use-package treesit-auto :demand t :config (setq treesit-auto-install t) (global-treesit-auto-mode))
  • Tree-sitter grammar for org-mode
    1 project | /r/patient_hackernews | 7 Apr 2022
    1 project | /r/hackernews | 7 Apr 2022
    1 project | /r/emacs | 7 Apr 2022
    5 projects | /r/orgmode | 7 Apr 2022
    8 projects | news.ycombinator.com | 7 Apr 2022
  • Formal Specification and Programmatic Parser for Org-mode
    9 projects | /r/emacs | 10 Jan 2022
    org-element-parse-buffer 'element granularity (7.688000744 0 0.0) 8sec tree-sitter via https://github.com/milisims/tree-sitter-org parsed down to 58% of the buffer in 5.3sec extrapolates to ~9sec Racket's brack via https://github.com/tgbugs/laundry failed to finish parsing in reasonable time. Cancelled at 10m11.436s Clojure parser via https://github.com/200ok-ch/org-parser failed to finish parsing with java.lang.OutOfMemoryError: GC overhead limit exceeded Running time 8m28.078s
  • tree-sitter-org: Org grammar for tree-sitter
    1 project | /r/planetemacs | 26 Nov 2021
  • Tree Sitter and the Complications of Parsing Languages
    12 projects | /r/emacs | 23 Nov 2021
    Interesting enough, I discovered there's tree-sitter-org and Neovim folks are trying to implement Org-Mode.
  • Orgmode.nvim tree-sitter support
    3 projects | /r/neovim | 3 Sep 2021
    local parser_config = require "nvim-treesitter.parsers".get_parser_configs() parser_config.org = { install_info = { url = 'https://github.com/milisims/tree-sitter-org', revision = 'main', files = {'src/parser.c', 'src/scanner.cc'}, }, filetype = 'org', }

instaparse

Posts with mentions or reviews of instaparse. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2022-07-08.
  • Chumsky, a Rust parser-combinator library with error recovery
    8 projects | news.ycombinator.com | 8 Jul 2022
    Caveats: I've used nom in anger, chumsky hardly at all, and tree-sitter only for prototyping. I'm using it for parsing a DSL, essentially a small programming language.

    The essential difference between nom/chomsky and tree-sitter is that the former are libraries for constructing parsers out of smaller parsers, whereas tree-sitter takes a grammar specification and produces a parser. This may seem small at first, but is a massive difference in practice.

    As far as ergonomics go, that's a rather subjective question. On the surface, the parser combinator libraries seem easier to use. They integrate well with the the host language, so you can stay in the same environment. But this comes with a caveat: parser combinators are a functional programming pattern, and Rust is only kind of a functional language, if you treat it juuuuust right. This will make itself known when your program isn't quite right; I've seen type errors that take up an entire terminal window or more. It's also very difficult to decompose a parser into functions. In the best case, you need to write your functions to be generic over type constraints that are subtle and hard to write. (again, if you get this wrong, the errors are overwhelming) I often give up and just copy the code. I have at times believed that some of these types are impossible to write down in a program (and can only exist in the type inferencer), but I don't know if that's actually true.

    deep breath

    Tree-sitter's user interface is rather different. You write your grammar in a javascript internal dsl, which gets run and produces a json file, and then a code generator reads that and produces C source code (I think the codegen is now written in rust). This is a much more roundabout way of getting to a parser, but it's worth it because: (1) tree-sitter was designed for parsing programming languages while nom very clearly was not, and (2) the parsers it generates are REALLY GOOD. Tree-sitter knows operator precedence, where nom cannot do this natively (there's a PR open for the next version: https://github.com/Geal/nom/pull/1362) Tree-sitter's parsing algorithm (GLR) is tolerant to recursion patterns that will send a parser combinator library off into the weeds, unless it uses special transformations to accommodate them.

    It might sound like I'm shitting on nom here, but that's not the goal. It's a fantastic piece of work, and I've gotten a lot of value from it. But it's not for parsing programming languages. Reach for nom when you want to parse a binary file or protocol.

    As for chumsky: the fact that it's a parser combinator library in Rust means that it's going to be subject to a lot of the same issues as nom, fundamentally. That's why I'm targeting tree-sitter next.

    There's no reason tree-sitter grammars couldn't be written in an internal DSL, perhaps in parser-combinator style (https://github.com/engelberg/instaparse does this). That could smooth over a lot of the rough edges.

  • Langdev in Clojure
    2 projects | /r/Clojure | 28 Jun 2022
    Sure, you can use https://github.com/Engelberg/instaparse to create parser for any language you want, or simply create DSL in basic clojure types, like vectors.
  • Formal Specification and Programmatic Parser for Org-mode
    9 projects | /r/emacs | 10 Jan 2022
    Enter org-parser! It is indeed such a thing implemented already! Remember the magical parser I mentioned above? It is already implemented here Engelberg/instaparse too (in a Lisp)! org-parser is built on top of it by providing a formal specification for org-mode in the EBN form. Any proof that org-parser works? Indeed, there is the celebrated organice which is built on top of it. Kudos for 200ok-ch!
  • Casual Parsing in JavaScript
    5 projects | news.ycombinator.com | 19 Aug 2021
    You might enjoy checking out Instaparse, a Clojure library. Its project page reads, “What if context-free grammars were as easy to use as regular expressions?”

    It’s not over-promising, either. I went from never having heard of it before to getting complete and correct parse trees of some ancient JSP Expression Language in about 20 minutes. Most of that time was spent typing in the BNF description that I could find only in an image.

    https://github.com/Engelberg/instaparse

  • Parsing Tools
    5 projects | /r/ProgrammingLanguages | 22 Apr 2021
    Instaparse sounds pretty close to what you're looking for assuming you're ok being limited to context-free grammars.
  • I toyed with some ideas from various languages and concocted a Frankenstein which might not live for long. Come see and critique!
    1 project | /r/ProgrammingLanguages | 2 Apr 2021
    It is in EBNF, with some alternate conventions. It follows the syntax found in here, which I think is pretty easy to get behind.
  • Advent of Code 2020 Day 19 Monster Messages in Clojure (rest vs. next, empty sequence vs. nil)
    1 project | /r/Clojure | 23 Dec 2020
    Another way to solve it is to load the grammar directly into instaparse, specify the start rule :0 and count the successful applications of the parser to the messages:

What are some alternatives?

When comparing tree-sitter-org and instaparse you can also consider the following projects:

language-server-protocol - Defines a common protocol for language servers.

rakudo - 🦋 Rakudo – Raku on MoarVM, JVM, and JS

tree-sitter-norg - A TreeSitter parser for the Neorg File Format

parser - String parser combinators

orgmode - Orgmode clone written in Lua for Neovim 0.9+.

chumsky - Write expressive, high-performance parsers with ease.

smartparens - Minor mode for Emacs that deals with parens pairs and tries to be smart about it.

parser-combinators - Parser combinators.

combobulate - Structured Editing and Navigation in Emacs with Tree-Sitter

rosie

tree-edit - 🌲 Structural editing in Emacs for any™ language!

yieldparser - Parse using JavaScript generator functions — it’s like components but for parsing!