emacs-devel
[Top][All Lists]
Advanced

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

Re: New cuda-ts-mode.


From: Ergus
Subject: Re: New cuda-ts-mode.
Date: Wed, 29 Jan 2025 23:25:11 +0100
User-agent: K-9 Mail for Android

Hi Philip:

I haven't commented more on this because I am waiting to solve some issues with the remap-alist.

Once it is done, the final cuda-ts-mode will be just a few lines that could be easily added to vanilla. To support proper Cuda OOB.

Best,
Ergus





On January 29, 2025 10:32:11 PM GMT+01:00, Philip Kaludercic <philipk@posteo.net> wrote:
Ergus <spacibba@aol.com> writes:

Hi:

Yesterday I wrote an initial version of the cuda-ts-mode.

Some months ago I was asking for a feature to simplify the
implementation as Cuda tressitter is just the same C++ grammar with very
little extensions (a few keywords and the <<< >>> brakets)

My initial idea was to reuse all the c++-ts-mode and just add a couple
of changes.

This was actually quite hard for 3 reasons:

1. The treesit-language-remap-alist sometimes updated the grammar to
cuda's but sometimes was still using the c++ one.

2. In c++-ts-mode--simple-indent-rules the conditions are limited to c
and C++, so I needed to "hack" a bit to get the rules and set them in a
cuda entry

3. There was no way to reuse the c-ts-mode--font-lock-settings function
because of the :language entries + compilation. I needed to basically
copy-paste the same code and remove the conditions (eq mode 'c++) to
make it work.
Also the function c-ts-mode--test-virtual-named-p hardcodes 'cpp

I have a preliminar functional version that I would like to simplify and
propose for to elpa.

https://github.com/Ergus/cuda-ts-mode

I don't have any interesting comments, except that you swapped the body
and the docstring in `cuda-ts-mode--simple-indent-rules' and that you
are missing a footer (checkdoc hints to both of these problems).

If we could modify c-ts-mode to reuse it's code, probably we could add
Cuda (and maybe OpenCl) support to vanilla with VERY LITTLE code. I
mean, I have now 250 lines o code for something that may be actually
~20-50.

What changes do you have in mind? If it is possible to extend the
built-in mode, then perhaps this should be done upstream to begin with,
instead of an external package?

reply via email to

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