[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Tree-sitter introduction documentation

From: Philip Kaludercic
Subject: Re: Tree-sitter introduction documentation
Date: Tue, 27 Dec 2022 20:06:05 +0000

Stefan Monnier <monnier@iro.umontreal.ca> writes:

> Eli Zaretskii [2022-12-27 20:08:32] wrote:
>> Good luck with that!  It requires to install Node.js and other stiff,
>> which I personally won't touch with a 3-mile pole, and I'm unsure (but
>> never bothered to find out) whether free replacements even exist.
> That's the part of Tree-sitter which makes me a bit uneasy.

I took a look at an the C grammar, and it doesn't appear to use any
fancy Javascript stuff:


Depending on who or what loads these files, it might be possible to use
something nice like quickjs (https://bellard.org/quickjs/) to generate
the intermediate C files.

The documentation at


indicates that the tree-sitter toolchain is written in Rust (yet another
build-time dependency), but unless I am mistaken, it just invokes "node"


and pipes this file


into the process.  The output of this script is JSON, and it seems like
pretty vanilla Javascript.  If I manage to build QuickJS, I'll try and
see if this can be used to process a grammar.

The remaining part that generates the C code is written in Rust, and
translates the JSON output into C:




It should be possible to port this, but I question if it is worth the
effort.  As Stefan said, it really looks like something that
distributions should take care of -- though considering that Emacs isn't
the first editor with TreeSitter support, I wonder why this hasn't
happened yet. 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]