syntect icon indicating copy to clipboard operation
syntect copied to clipboard

Provide C API

Open rawhuul opened this issue 1 year ago • 4 comments

It would be wonderful to have C-API to syntect library similar to treesitter. This will open up a gate to lot more users to use this library.

rawhuul avatar Oct 02 '23 21:10 rawhuul

My preference would be do expose a C API of syntect in a third-party crate. Effectively a C facade in front of the Rust API that is maintained elsewhere.

(I will close this issue as "won't fix" at a later point unless other maintainers express a desire to maintain a C API of syntect.)

Enselic avatar Dec 29 '23 10:12 Enselic

Okay, I will dig deep into the library and try to make a C wrapper of it in free time

rawhuul avatar Dec 29 '23 17:12 rawhuul

I realized that with patience, you can create a C-API without knowing any Rust syntax by interacting with ChatGPT for hours. Although it may not work perfectly, I have generated C-APIs for some basic functions of the syntect library. All the Rust code, C code, and even the README were generated by ChatGPT. However, it took many hours of interaction, building code, reporting errors, and giving feedback, so it's not as easy as it sounds 🙃

It would be nice if skilled engineers created a proper C-API, but there isn't one available (everyone is busy). However, anyone willing to talk to AI patiently might be able to build a prototype C-wrapper.

https://github.com/kojix2/syntect-c

kojix2 avatar Aug 04 '24 05:08 kojix2

That’s nice, thanks. I will try experimenting with it.

rawhuul avatar Aug 06 '24 04:08 rawhuul