New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tree-sitter-ocaml

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tree-sitter-ocaml

OCaml grammar for tree-sitter

  • 0.23.2
  • PyPI
  • Socket score

Maintainers
1

tree-sitter-ocaml

CI pypi

This module provides OCaml grammars for the tree-sitter parsing library. There are separate grammars for implementations (.ml), interfaces (.mli) and types.

Installation

pip install tree-sitter-ocaml

You will probably also need the tree-sitter binding.

pip install tree-sitter

Usage

Load the grammar as a Language object:

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:

parser = Parser(language_ocaml)

Parse some source code:

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.

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc