Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I use this to parse code in OCaml? #55

Open
roddyyaga opened this issue Nov 20, 2022 · 2 comments
Open

How can I use this to parse code in OCaml? #55

roddyyaga opened this issue Nov 20, 2022 · 2 comments

Comments

@roddyyaga
Copy link

Hi, I'd like to use tree-sitter from OCaml in the same way I'd use e.g. the tree-sitter rust bindings (i.e. I don't want different OCaml types for each language). How can I do this? I see there are repos to parse different languages (e.g. https://github.com/returntocorp/ocaml-tree-sitter-typescript) but I'm not sure how to work with them (they have public_name in dune files but they don't appear to be opam packages). Or should I use this repo directly, and if so how?

Thanks, Roddy

@aryx
Copy link
Contributor

aryx commented Nov 20, 2022

cc @mjambon
Ideally you should use https://github.com/returntocorp/ocaml-tree-sitter-languages and each language would be an OPAM package, but this is not the case right now.

@roddyyaga
Copy link
Author

Makes sense. I couldn't get this repo working with opam (I got this error:

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⬇ retrieved tree-sitter.~dev  (no changes)
[ERROR] The compilation of tree-sitter.~dev failed at "make".

#=== ERROR while compiling tree-sitter.~dev ===================================#
# context     2.1.3 | linux/x86_64 |  | pinned(git+https://github.com/returntocorp/ocaml-tree-sitter-core.git#c19c6de7)
# path        ~/rod/_opam/.opam-switch/build/tree-sitter.~dev
# command     ~/.opam/opam-init/hooks/sandbox.sh build make
# exit-code   2
# env-file    ~/.opam/log/tree-sitter-25733-33a6fa.env
# output-file ~/.opam/log/tree-sitter-25733-33a6fa.out
### output ###
# dune build
# Entering directory '...'
# Error: _build/log: Read-only file system
# make: *** [Makefile:12: build] Error 1

but after copying it and a language repo into my project and removing the public_name stanzas as mentioned above I managed to get it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants