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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tree_sitter_fsharp-0.3.11.tar.gz.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11.tar.gz
- Upload date:
- Size: 4.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cd3ab061850df53bd1b98a20832256252a3a80acabfd51dda36990c8eadeee15
|
|
| MD5 |
fa731d51d07101e98b6633428627eecf
|
|
| BLAKE2b-256 |
a2bfff2f4ab3cf4e574a491c2d30811f90fbdf6110044f955aab842bf4227155
|
File details
Details for the file tree_sitter_fsharp-0.3.11-cp310-abi3-win_arm64.whl.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11-cp310-abi3-win_arm64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, Windows ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a88a15c392a644d4ea55e88eacc7d058bae5b6ebf7b2cfa723816a5f9d03ec3f
|
|
| MD5 |
c8a4b30f3c932279c921e3e602b63806
|
|
| BLAKE2b-256 |
0918c8b2b66f14f755e3ee8a60dade772d9319ea242b0a920ea8cab31ebfe172
|
File details
Details for the file tree_sitter_fsharp-0.3.11-cp310-abi3-win_amd64.whl.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11-cp310-abi3-win_amd64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a238e3eeb1da24ad8364f250973178ff5ea265aeadbd31a372c5b0d7bd28f946
|
|
| MD5 |
b8eec702a69b2ce52cfc597b969555dd
|
|
| BLAKE2b-256 |
5bdbe175931c551c9e3cafb1058a0195e909148f5abea527baf7b68e098f66c1
|
File details
Details for the file tree_sitter_fsharp-0.3.11-cp310-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11-cp310-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a700d8c765e1c850b5c7afb42966936d99b4607e4df896bcf8a15f3971858d30
|
|
| MD5 |
7b1c11c6cca4f39ce6f47c30397400d0
|
|
| BLAKE2b-256 |
a49e3151d41dc3a2098be7a18999a4540d1aeefdcab2cee5c98506be64bf8e03
|
File details
Details for the file tree_sitter_fsharp-0.3.11-cp310-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11-cp310-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d31390e1d9b162c1bef091d441772824e109c4f95aab11a527533a2794ce5e7c
|
|
| MD5 |
ae4d5b8e20cbe21bb9efc00568e36d4b
|
|
| BLAKE2b-256 |
3b9e8471950cb7169954fdd62dea22ed2300844e3fc4bd90fe1896ef46fbb2db
|
File details
Details for the file tree_sitter_fsharp-0.3.11-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11-cp310-abi3-manylinux2014_aarch64.manylinux_2_17_aarch64.manylinux_2_28_aarch64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10+, manylinux: glibc 2.17+ ARM64, manylinux: glibc 2.28+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de053d7b182e64c5a961690be69e8c27961360be3539198a2ac64c6d71e8b48f
|
|
| MD5 |
eeb20c9873661edcc2c6915e66778037
|
|
| BLAKE2b-256 |
d4b0344f72a5e9b75f8f1e8b81b116303c268948782fdbc2b6af245d2573da43
|
File details
Details for the file tree_sitter_fsharp-0.3.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11-cp310-abi3-manylinux1_x86_64.manylinux_2_28_x86_64.manylinux_2_5_x86_64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10+, manylinux: glibc 2.28+ x86-64, manylinux: glibc 2.5+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
feb7e8c380a1f682310875559bfa1297d1643dfc5ec30c5dfd9d54310a4c7717
|
|
| MD5 |
7e56ec9ca605e0a3bd0a0c1a4339e89e
|
|
| BLAKE2b-256 |
cd595fd60b4014a58418a9a486beaa059f7cf8316836446d80ef0fd63f05edc9
|
File details
Details for the file tree_sitter_fsharp-0.3.11-cp310-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11-cp310-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.4 MB
- Tags: CPython 3.10+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
87c3abca2f8b9ef7c591f01a30556b4d409db1b20374abe7c5ebf69e95615bb2
|
|
| MD5 |
08386b43ceee4805a92441afa3cc8a68
|
|
| BLAKE2b-256 |
0f720d92c8a4f822e04ef598fe56a9f9c7c5f4124fd8f852a83367bb24c22c47
|
File details
Details for the file tree_sitter_fsharp-0.3.11-cp310-abi3-macosx_10_9_x86_64.whl.
File metadata
- Download URL: tree_sitter_fsharp-0.3.11-cp310-abi3-macosx_10_9_x86_64.whl
- Upload date:
- Size: 1.3 MB
- Tags: CPython 3.10+, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0de87dc58e1617c927857f3b9d225a6cecaa05fa2222a702745cf5fd4077763
|
|
| MD5 |
b139406b688e657957cbc5fa9bc04ef1
|
|
| BLAKE2b-256 |
d7f76a4b052fe746a31a783cf4ae8a2fc09f722d616663bba2e9feb3079d01af
|