# tree-sitter-ocaml
[![CI][ci]](https://github.com/tree-sitter/tree-sitter-ocaml/actions/workflows/ci.yml)
[![pypi][pypi]](https://pypi.org/project/tree-sitter-ocaml/)
This module provides OCaml grammars for the [tree-sitter][] parsing library.
There are separate grammars for implementations (`.ml`), interfaces (`.mli`)
and types.
## Installation
```sh
pip install tree-sitter-ocaml
```
You will probably also need the [tree-sitter binding][tree-sitter binding].
```sh
pip install tree-sitter
```
## Usage
Load the grammar as a `Language` object:
```python
import tree_sitter_ocaml
from tree_sitter import Language, Parser
language_ocaml = Language(tree_sitter_ocaml.language_ocaml())
```
Create a `Parser` and configure it to use the language:
```python
parser = Parser(language_ocaml)
```
Parse some source code:
```python
tree = parser.parse(
b"""
module M : sig
val x : int
end
"""
)
```
Use `language_ocaml_interface()` to parse interface files (with `.mli` extension)
and `language_ocaml_type()` to parse type signatures.
[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/tree-sitter-ocaml/ci.yml?logo=github&label=CI
[pypi]: https://img.shields.io/pypi/v/tree-sitter-ocaml?logo=pypi&logoColor=white&label=PyPI
[tree-sitter]: https://tree-sitter.github.io/tree-sitter/
[tree-sitter binding]: https://pypi.org/project/tree-sitter/
Raw data
{
"_id": null,
"home_page": null,
"name": "tree-sitter-ocaml",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "incremental, parsing, tree-sitter, ocaml",
"author": null,
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/de/34/480755d2c41c22e0955ca4eeb6cde48a8fce346d27ed3b61baef2b609a51/tree_sitter_ocaml-0.24.0.tar.gz",
"platform": null,
"description": "# tree-sitter-ocaml\n\n[![CI][ci]](https://github.com/tree-sitter/tree-sitter-ocaml/actions/workflows/ci.yml)\n[![pypi][pypi]](https://pypi.org/project/tree-sitter-ocaml/)\n\nThis module provides OCaml grammars for the [tree-sitter][] parsing library.\nThere are separate grammars for implementations (`.ml`), interfaces (`.mli`)\nand types.\n\n## Installation\n\n```sh\npip install tree-sitter-ocaml\n```\n\nYou will probably also need the [tree-sitter binding][tree-sitter binding].\n\n```sh\npip install tree-sitter\n```\n\n## Usage\n\nLoad the grammar as a `Language` object:\n\n```python\nimport tree_sitter_ocaml\nfrom tree_sitter import Language, Parser\n\nlanguage_ocaml = Language(tree_sitter_ocaml.language_ocaml())\n```\n\nCreate a `Parser` and configure it to use the language:\n\n```python\nparser = Parser(language_ocaml)\n```\n\nParse some source code:\n\n```python\ntree = parser.parse(\n b\"\"\"\n module M : sig\n val x : int\n end\n \"\"\"\n)\n```\n\nUse `language_ocaml_interface()` to parse interface files (with `.mli` extension)\nand `language_ocaml_type()` to parse type signatures.\n\n[ci]: https://img.shields.io/github/actions/workflow/status/tree-sitter/tree-sitter-ocaml/ci.yml?logo=github&label=CI\n[pypi]: https://img.shields.io/pypi/v/tree-sitter-ocaml?logo=pypi&logoColor=white&label=PyPI\n[tree-sitter]: https://tree-sitter.github.io/tree-sitter/\n[tree-sitter binding]: https://pypi.org/project/tree-sitter/\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "OCaml grammar for tree-sitter",
"version": "0.24.0",
"project_urls": {
"Homepage": "https://github.com/tree-sitter/tree-sitter-ocaml"
},
"split_keywords": [
"incremental",
" parsing",
" tree-sitter",
" ocaml"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d12095fdf0af7c9adbfecb81b359410e20aa35c0d089d284ce513be93d9721fb",
"md5": "0acb54ed3146c1950f312a833c689872",
"sha256": "1cda1db828933f5a4d4cf6d6581ead1d98ab2a4bf5641e57c836eefeac29b3df"
},
"downloads": -1,
"filename": "tree_sitter_ocaml-0.24.0-cp39-abi3-macosx_10_9_x86_64.whl",
"has_sig": false,
"md5_digest": "0acb54ed3146c1950f312a833c689872",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1399860,
"upload_time": "2025-01-11T21:21:10",
"upload_time_iso_8601": "2025-01-11T21:21:10.265036Z",
"url": "https://files.pythonhosted.org/packages/d1/20/95fdf0af7c9adbfecb81b359410e20aa35c0d089d284ce513be93d9721fb/tree_sitter_ocaml-0.24.0-cp39-abi3-macosx_10_9_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ac322f0d10aeaa82a2eef0f9b218488f7dc3bb2759814f730a596a264a8e22d4",
"md5": "dbdc4fd05e73e2753fc27132acf40714",
"sha256": "5de2b1c62198ec71d7ba317bb7a3144242681c5247706e4483053f9576193a77"
},
"downloads": -1,
"filename": "tree_sitter_ocaml-0.24.0-cp39-abi3-macosx_11_0_arm64.whl",
"has_sig": false,
"md5_digest": "dbdc4fd05e73e2753fc27132acf40714",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1501424,
"upload_time": "2025-01-11T21:21:11",
"upload_time_iso_8601": "2025-01-11T21:21:11.965403Z",
"url": "https://files.pythonhosted.org/packages/ac/32/2f0d10aeaa82a2eef0f9b218488f7dc3bb2759814f730a596a264a8e22d4/tree_sitter_ocaml-0.24.0-cp39-abi3-macosx_11_0_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "24ec89876c71170f5598015e77885715388e80998cd3b8f2ec5db33d4dbf4339",
"md5": "9234b95966da0144000982b3a3493281",
"sha256": "0f21cb6294e55be566258c76406bc8a50210689023dec5376c4bf6a30301d623"
},
"downloads": -1,
"filename": "tree_sitter_ocaml-0.24.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"has_sig": false,
"md5_digest": "9234b95966da0144000982b3a3493281",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1565173,
"upload_time": "2025-01-11T21:21:14",
"upload_time_iso_8601": "2025-01-11T21:21:14.762333Z",
"url": "https://files.pythonhosted.org/packages/24/ec/89876c71170f5598015e77885715388e80998cd3b8f2ec5db33d4dbf4339/tree_sitter_ocaml-0.24.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "2e8f33162a0b1fcbf302a6d55082199e7d9718455aa26182fb12abce24d53a59",
"md5": "3fce96d5f6a75c463fc5ad6859c40fac",
"sha256": "09cbc60be0a400277828ea5e859f7c85072cc35dd9256429d785e2e1ad1a75ff"
},
"downloads": -1,
"filename": "tree_sitter_ocaml-0.24.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"has_sig": false,
"md5_digest": "3fce96d5f6a75c463fc5ad6859c40fac",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1521938,
"upload_time": "2025-01-11T21:21:17",
"upload_time_iso_8601": "2025-01-11T21:21:17.444356Z",
"url": "https://files.pythonhosted.org/packages/2e/8f/33162a0b1fcbf302a6d55082199e7d9718455aa26182fb12abce24d53a59/tree_sitter_ocaml-0.24.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e5e5c557cd38ec3e6e5ff762464b0e2768a967c8bed39c690975692d7be48e9e",
"md5": "26fe602f5bb326f8025e9b896da2a041",
"sha256": "3a48807f7c41e65bdf0fc1baabc0e2e6f55a8ceec37b356584df5563338cd9de"
},
"downloads": -1,
"filename": "tree_sitter_ocaml-0.24.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"has_sig": false,
"md5_digest": "26fe602f5bb326f8025e9b896da2a041",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1472026,
"upload_time": "2025-01-11T21:21:19",
"upload_time_iso_8601": "2025-01-11T21:21:19.126098Z",
"url": "https://files.pythonhosted.org/packages/e5/e5/c557cd38ec3e6e5ff762464b0e2768a967c8bed39c690975692d7be48e9e/tree_sitter_ocaml-0.24.0-cp39-abi3-musllinux_1_2_x86_64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e002b60ea64e9549b924fbb1ca81bb888ac2ec7818f6cc816cd23e6ba39606fe",
"md5": "b796f8426bc83c6e58c1a54c8cc54524",
"sha256": "24e3275f8005a7d0a6e4a1c984097d9f6ba9441e761763aaeab35be18f15ca3c"
},
"downloads": -1,
"filename": "tree_sitter_ocaml-0.24.0-cp39-abi3-win_amd64.whl",
"has_sig": false,
"md5_digest": "b796f8426bc83c6e58c1a54c8cc54524",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1403355,
"upload_time": "2025-01-11T21:21:21",
"upload_time_iso_8601": "2025-01-11T21:21:21.797224Z",
"url": "https://files.pythonhosted.org/packages/e0/02/b60ea64e9549b924fbb1ca81bb888ac2ec7818f6cc816cd23e6ba39606fe/tree_sitter_ocaml-0.24.0-cp39-abi3-win_amd64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b7f26f2b7dbe4a34a8c562c46b74311dd12c6ba76bb718af19ebf466b7c3d436",
"md5": "4170a2e22f56e128058e24e9ce1ca3b1",
"sha256": "748cca4a8ec7e613be2cfd4328bf9d31e8bf610b2fef5fb9acb542848923ed81"
},
"downloads": -1,
"filename": "tree_sitter_ocaml-0.24.0-cp39-abi3-win_arm64.whl",
"has_sig": false,
"md5_digest": "4170a2e22f56e128058e24e9ce1ca3b1",
"packagetype": "bdist_wheel",
"python_version": "cp39",
"requires_python": ">=3.9",
"size": 1389187,
"upload_time": "2025-01-11T21:21:24",
"upload_time_iso_8601": "2025-01-11T21:21:24.531176Z",
"url": "https://files.pythonhosted.org/packages/b7/f2/6f2b7dbe4a34a8c562c46b74311dd12c6ba76bb718af19ebf466b7c3d436/tree_sitter_ocaml-0.24.0-cp39-abi3-win_arm64.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "de34480755d2c41c22e0955ca4eeb6cde48a8fce346d27ed3b61baef2b609a51",
"md5": "3e1166669a9ed630af42eb0a1f088da3",
"sha256": "d063ed902ca0a0e3628ef0f034564b23c8006e74f23a090eab32f7dfcdb12acb"
},
"downloads": -1,
"filename": "tree_sitter_ocaml-0.24.0.tar.gz",
"has_sig": false,
"md5_digest": "3e1166669a9ed630af42eb0a1f088da3",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 3464485,
"upload_time": "2025-01-11T21:21:26",
"upload_time_iso_8601": "2025-01-11T21:21:26.270050Z",
"url": "https://files.pythonhosted.org/packages/de/34/480755d2c41c22e0955ca4eeb6cde48a8fce346d27ed3b61baef2b609a51/tree_sitter_ocaml-0.24.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-11 21:21:26",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tree-sitter",
"github_project": "tree-sitter-ocaml",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "tree-sitter-ocaml"
}