tree-sitter-fsharp
F# grammars for tree-sitter, packaged for Python.
The package ships two parsers:
| Function | Grammar | File types |
|---|---|---|
language() |
implementation files | .fs, .fsx |
language_signature() |
signature files | .fsi |
Installation
pip install tree-sitter-fsharp tree-sitter
Requires Python 3.10 or later. The tree-sitter runtime (~=0.24) is an optional
dependency, also installable as an extra:
pip install "tree-sitter-fsharp[core]"
Wheels are published for the common platforms; other platforms build the extension from the bundled C sources, which needs a C11 compiler.
Usage
from tree_sitter import Language, Parser
import tree_sitter_fsharp
parser = Parser(Language(tree_sitter_fsharp.language()))
tree = parser.parse(b"let x = 1\n")
print(tree.root_node)
Signature files need the other grammar — it is a separate parser, not a mode of the first:
parser = Parser(Language(tree_sitter_fsharp.language_signature()))
tree = parser.parse(b"module M\nval x : int\n")
Queries
Highlight, injection, locals and tags queries ship inside the package and are exposed as
lazily-read module attributes holding the query source (each is None when that query
file is absent):
import tree_sitter_fsharp
source = tree_sitter_fsharp.HIGHLIGHTS_QUERY
Available: HIGHLIGHTS_QUERY, INJECTIONS_QUERY, LOCALS_QUERY and TAGS_QUERY for the
implementation grammar, plus SIGNATURE_HIGHLIGHTS_QUERY and SIGNATURE_TAGS_QUERY for
the signature grammar.
Type stubs (py.typed, __init__.pyi) are included.
Contributing and grammar development
Grammar sources, the test corpus and the development workflow live in the repository: see the main README and AGENTS.md. Bug reports for mis-parsed F# code are welcome — reduce the snippet to a minimal example and open an issue or PR.
License
MIT — see LICENSE.
Metadata
Release files for tree-sitter-fsharp 0.3.12
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| tree_sitter_fsharp-0.3.12.tar.gz | 4.0 MB | Details |
Built distributions (wheels)
Total release size: 14.7 MB
Release files / tree_sitter_fsharp-0.3.12.tar.gz
| Download URL | tree_sitter_fsharp-0.3.12.tar.gz |
|---|---|
| Size | 4.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07759fd4837b226f800cf26ecaf6a58f51365c2cacacf69db4094ff146eac8bd
|
|
BLAKE2b-256 checksum How to use checksums |
265e5eea094519a04eba7275773ab416cc2476595d5101f45115929b438364be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_fsharp-0.3.12-cp310-abi3-win_arm64.whl
| Download URL | tree_sitter_fsharp-0.3.12-cp310-abi3-win_arm64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 Windows ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
1b6ee6c48b6c6a283209fdd3a12db0963d1316e5d9868593a98b0c8816388a6c
|
|
BLAKE2b-256 checksum How to use checksums |
4f3735ae40cc8368ef3b0b6240224780db01de5a75cc1e03cebaf0ace364740e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_fsharp-0.3.12-cp310-abi3-win_amd64.whl
| Download URL | tree_sitter_fsharp-0.3.12-cp310-abi3-win_amd64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
6f27d514acf664e62f24ec8838dca66a84eb62acd4a4eff48edcfc8bd66175c3
|
|
BLAKE2b-256 checksum How to use checksums |
9f17b2ce536387d2feb66f2be8908fb885ebfd445dbdff33a7d6af08197ec91c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_fsharp-0.3.12-cp310-abi3-musllinux_1_2_x86_64.whl
| Download URL | tree_sitter_fsharp-0.3.12-cp310-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
d524a2a6c996dbd069843c1e7ed31f5f08f1fd7475ba99162002257b98ed267c
|
|
BLAKE2b-256 checksum How to use checksums |
f20d619d8499b3749a7884a2b42b13bc8ecb962834f4c80c3784aedaba3cf26d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_fsharp-0.3.12-cp310-abi3-musllinux_1_2_aarch64.whl
| Download URL | tree_sitter_fsharp-0.3.12-cp310-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
391cfcf0f6eb0eac0cb04a8c4d1340c429da4377f90bd56a486cdf5eac1b71ff
|
|
BLAKE2b-256 checksum How to use checksums |
0c975688a78c35d5ebd3751c8e03ef5c09f649c200c2b88a901153eafa2b6edf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_fsharp-0.3.12-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
| Download URL | tree_sitter_fsharp-0.3.12-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ ARM64 Linux glibc 2.28+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
c62dea7574a67c9deb67a72f8162ee3f20f82ccb0aa63b78442919c35b306c37
|
|
BLAKE2b-256 checksum How to use checksums |
fe3efe148f33093f0dbc533a5f9c91967ee3afc9647bbbe7c7c568fc70378aa7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_fsharp-0.3.12-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
| Download URL | tree_sitter_fsharp-0.3.12-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 Linux glibc 2.28+ x86-64 Linux glibc 2.5+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
ee4670c3daf64d8ccc117578d9ecdfb5c363e676462c90ded02e4104c1f04659
|
|
BLAKE2b-256 checksum How to use checksums |
9f4a5e44803c1f06e7ba20e3baccb42f9fdacf18b2478d1bba575bf2703cd939
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_fsharp-0.3.12-cp310-abi3-macosx_11_0_arm64.whl
| Download URL | tree_sitter_fsharp-0.3.12-cp310-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.4 MB |
| Tags | CPython 3.10 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
08c8db48fabbfe0193b94d507b1d51d57ee87c517b1b32e523a3ad2f3ed68753
|
|
BLAKE2b-256 checksum How to use checksums |
6c5fefd682cb9e85ba26301ba19f3983f11d984b64a67253f5a9903b287d572a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / tree_sitter_fsharp-0.3.12-cp310-abi3-macosx_10_9_x86_64.whl
| Download URL | tree_sitter_fsharp-0.3.12-cp310-abi3-macosx_10_9_x86_64.whl |
|---|---|
| Size | 1.3 MB |
| Tags | CPython 3.10 abi3 macOS 10.9+ x86-64 |
|
SHA-256 checksum How to use checksums |
f2a6c270018130ad7aea379c669ba13d3a87da49382c7af870c6b541baebab86
|
|
BLAKE2b-256 checksum How to use checksums |
205b1170c266a3399a9cf84b92043e33412cc65e6ede13ba54e195ffb88ae387
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|