[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Tree-sitter introduction documentation
From: |
Yuan Fu |
Subject: |
Re: Tree-sitter introduction documentation |
Date: |
Fri, 30 Dec 2022 15:33:19 -0800 |
> On Dec 30, 2022, at 3:25 AM, Philip Kaludercic <philipk@posteo.net> wrote:
>
> Yuan Fu <casouri@gmail.com> writes:
>
>>> On Dec 27, 2022, at 8:44 AM, Philip Kaludercic <philipk@posteo.net> wrote:
>>>
>>> Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>>
>>>>> It doesn't need any project, it is literally two command lines.
>>>>> Here's an example:
>>>>>
>>>>> gcc -O2 -I. -c -o parser.o parser.c
>>>>> gcc -shared parser.o scanner.o -ltree-sitter -o
>>>>> libtree-sitter-c-sharp.dll
>>>>
>>>> AFAIK `parser.c` is a file generated from the actual grammar's source,
>>>> itself written in Javascript.
>>>>
>>>> So the above instructions are akin to downloading a precompiled binary
>>>> and installing it. While it is the most convenient path for the
>>>> end-users, it's important w.r.t Freedom to make sure that grammars can
>>>> also be regenerated from source by the end users.
>>>
>>> I have asked the question before, but freedom or not, the above is a
>>> nuisance to run for every language. If the process is as automatic as
>>> the above example demonstrates, shouldn't Emacs have a command to take a
>>> grammar and compile+install it? I guess this could be more complicated
>>> if the grammar is generated using a custom tool-chain for each language
>>> (or is it always Javascript?), but nothing impossible.
>>
>> Though the magic of programming, such command now exists:
>> treesit-install-language-grammar. It needs recipes to work, though. The
>> recipe would involve https://github.com, which I guess is probably too
>> heretical to include in Emacs source, so I left the recipes empty. I tested
>> the install command with these recipes:
>>
>> (setq treesit-language-source-alist
>> '((python "https://github.com/tree-sitter/tree-sitter-python.git")
>> (typescript
>> "https://github.com/tree-sitter/tree-sitter-typescript.git"
>> "typescript/src" "typescript")))
>>
>> Yuan
>
> If acceptable, it looks good. I could imagine that it should be OK if
> we point to GitHub, since we are just using it as a Git host. Here are
> a few suggestions
Thanks, I made some changes according to your diff.
Yuan
- Re: Tree-sitter introduction documentation, (continued)
- Re: Tree-sitter introduction documentation, Stefan Monnier, 2022/12/27
- Re: Tree-sitter introduction documentation, Yuan Fu, 2022/12/30
- Re: Tree-sitter introduction documentation, Philip Kaludercic, 2022/12/30
- Re: Tree-sitter introduction documentation, tomas, 2022/12/30
- Re: Tree-sitter introduction documentation, Philip Kaludercic, 2022/12/30
- Re: Tree-sitter introduction documentation, tomas, 2022/12/30
- Re: Tree-sitter introduction documentation, Philip Kaludercic, 2022/12/30
- Re: Tree-sitter introduction documentation, Dmitry Gutov, 2022/12/30
- Re: Tree-sitter introduction documentation,
Yuan Fu <=
- Re: Tree-sitter introduction documentation, Eli Zaretskii, 2022/12/30
- Re: Tree-sitter introduction documentation, Philip Kaludercic, 2022/12/30
- Re: Tree-sitter introduction documentation, Eli Zaretskii, 2022/12/30
- Re: Tree-sitter introduction documentation, Yuan Fu, 2022/12/30
- Re: Tree-sitter introduction documentation, Philip Kaludercic, 2022/12/30
- Re: Tree-sitter introduction documentation, Yuan Fu, 2022/12/31
- Re: Tree-sitter introduction documentation, Yuan Fu, 2022/12/30
- Re: Tree-sitter introduction documentation, Stefan Monnier, 2022/12/30
- Re: Tree-sitter introduction documentation, Yuan Fu, 2022/12/31
- Re: Tree-sitter introduction documentation, Eli Zaretskii, 2022/12/31