tree-sitter-crystal
tree-sitter-crystal copied to clipboard
How is this project coming along?
So, I am a relatively new Crystal coder, but been a Ruby one for much longer. I see this is the most active tree-sitter of crystal and I wanted to ask what the status was? I wanted to fork and see if I can help, as I am looking into wrapping a lot of C code in a game engine project I am working on crystal. Is the grammar implementation complete, have you considered this? https://crystal-lang.org/reference/1.10/syntax_and_semantics/type_grammar.html
I don't quite know much to be fair, beyond a few CLI and programming syntax stuff, I wouldn't say I 'know' Crystal like Ruby in regards to runtime/comptime but I manage.
Let me know any questions of interest you may have, currently finishing up 2 crystal books and might also do a solid web app to get things moving myself soon but if there anything big or small I can help with the project, you can ask.
@UltimaTerra Thanks for asking! I know the project status isn't very transparent, since I haven't created a proper readme or anything. I'd estimate the tree-sitter grammar is roughly 75% done. I'm still continuing to work on it in my free time. The type grammar you linked is fully implemented.
Some of the remaining bits of work are:
- Everything related to C bindings (
lib
blocks,fun
definitions, C-type structs, etc.) - Some miscellaneous keywords like
super
anduninitialized
- Macros
Macros in particular are going to be tricky to handle correctly, since they can take the place of any other AST node. I still haven't figured out the best way to do this.
If you're interested in contributing, I suggest reading the TS docs and then searching the code for TODO items. You could also find a complex Crystal file and try parsing it to see what breaks.
I just forked it, I will be doing just that. Is there any generlizations I can use to get started? I have the treesitter docs and the code. I want to assume just parsing for files see if there is any clash with the binding itself. I guess write something complex in crystal, then parse it with treesitter see if something breaks? Is the binding for c-type structs related to structs in crystal? (I would rather just do 1 to 1), same with function declarations.
Macros are interesting, are you saying it is tricky because of the low level nature of C or the more higher level nature of Crystal with AST replacements? I have experience in Nim macros, I haven't actually tried many with Crystal so I suppose that will be fun to look at.
Sorry if this is alot. Just assume I want to help, but I am still somewhat noobish. I hope these are the right questions/observations.