uyha / tree-sitter-cmake

A Tree-sitter parser for CMake
MIT License
41 stars 9 forks source link

Documentation on installation and use of the repo. #10

Open mahtab-nejati opened 1 year ago

mahtab-nejati commented 1 year ago

Is there a wiki page or some documentation on how to use this repo?

uyha commented 1 year ago

What do you want to use this repo for? I started this primarily for https://github.com/nvim-treesitter/nvim-treesitter, but it is created according to https://github.com/tree-sitter/tree-sitter. If you are familiar with that then you shouldn't have anymore problems using this, if you aren't, then maybe https://tree-sitter.github.io/tree-sitter/ is a good place to start.

garyo commented 1 year ago

I would like to use this in emacs with tree-sitter-mode. But on Windows, that requires a .dll. I tried building this repo and only got some .rlib files -- can it produce a cmake.dll or similar?

uyha commented 1 year ago

since this is essentially a C library, I think it's possible to compile the files in the src directory and produce a cmake.dll. I currently don't have a setup for Windows so I can't actually try.

goldencz commented 10 months ago

What do you want to use this repo for? I started this primarily for https://github.com/nvim-treesitter/nvim-treesitter, but it is created according to https://github.com/tree-sitter/tree-sitter. If you are familiar with that then you shouldn't have anymore problems using this, if you aren't, then maybe https://tree-sitter.github.io/tree-sitter/ is a good place to start.

I'd like to use this to analyze cmake project and then try to translate it to bazel. You are right that getting familiar with tree-sitter is a good start, however, a quick usage would be a great way to reduce the learning curve. By the way, what is the latest cmake version supported by this project ?

uyha commented 10 months ago

I'd like to use this to analyze cmake project and then try to translate it to bazel. You are right that getting familiar with tree-sitter is a good start, however, a quick usage would be a great way to reduce the learning curve.

What language are you using to do this? The instruction depends heavily on that, so if you can tell what you're using, maybe I can help.

By the way, what is the latest cmake version supported by this project ?

CMake 3.28 AFAICT, since there's no new syntax introduced.

goldencz commented 10 months ago

I'd like to use this to analyze cmake project and then try to translate it to bazel. You are right that getting familiar with tree-sitter is a good start, however, a quick usage would be a great way to reduce the learning curve.

What language are you using to do this? The instruction depends heavily on that, so if you can tell what you're using, maybe I can help.

By the way, what is the latest cmake version supported by this project ?

CMake 3.28 AFAICT, since there's no new syntax introduced.

I want to use python for the first edtition, and then C to get it speeded up.
I found there's a python binding of tree-sitter named tree_sitter, is that a good way to use tree-sitter in python? Any guidance is helpful, thanks.

uyha commented 10 months ago

could you give the link to the Python binding? I haven't done anything like that so I'm not sure myself

goldencz commented 10 months ago

could you give the link to the Python binding? I haven't done anything like that so I'm not sure myself

https://github.com/tree-sitter/py-tree-sitter

uyha commented 10 months ago

I failed to even import the library so I don't think I can help you with the Python version. Maybe you can try Rust since it's more straightforward