Closed jwoudenberg closed 2 years ago
I kinda fear, that my C understanding will be even worse then my current C++.
Maybe the linking problems are something you could ask on the discussions of the https://github.com/tree-sitter/tree-sitter/discussions repo. I would think that there are already people that solved this.
I looked at this while ago and came to the conclusion that porting the scanner to c would be a major sacrifice in terms of code quality and maintainability.
The code for instance uses the STL and writing a new std::vector in c would be a mistake I think.
They call it c "plus plus" for a reason after all.
I think it should be possible to statically link libstdc++ though. Happy to chat on discord or slack if there are c++ specific questions. :)
That makes a lot of sense. Thank you both for talking me out of this, and the tips for c++ linking!
Hi there! One thing I've been playing with recently is trying to create statically linked binaries for my little tool elm-pair which pulls in the
tree-sitter-elm
rust package. I'm running into some errors related to the C++ dependencies required because of the customscanner.cc
code. Linking C and C++ is definitely outside my area of expertise so I could probably invest a bit of time and figure out how to get this to work. However, another approach that occured to me would be to port thescanner.cc
code to C. I'd have to try this out, but my understanding of the code is that it's not relying on a ton of C++ specific functionality, and turning the existing methods into functions that pass around scanner state as struct sounds like it should be doable.Would you be interested in a change like that or do you prefer to keep that code in C++?