Giter Club home page Giter Club logo

jpienaar / ocaml-tree-sitter-semgrep Goto Github PK

View Code? Open in Web Editor NEW

This project forked from zeta1999/ocaml-tree-sitter

0.0 0.0 0.0 1.47 MB

Generate parsers from tree-sitter grammars extended to support Semgrep patterns

License: GNU General Public License v3.0

OCaml 0.01% Shell 6.23% JavaScript 27.54% Makefile 1.58% C++ 3.35% C 7.57% Java 0.61% Ruby 1.43% TypeScript 0.95% Python 0.76% C# 5.28% Go 43.15% Kotlin 0.76% Lua 0.67% Rebol 0.01% Rust 0.02% Elixir 0.07% Dockerfile 0.01%

ocaml-tree-sitter-semgrep's Introduction

ocaml-tree-sitter-semgrep

CircleCI

Generate OCaml parsers based on tree-sitter grammars, for semgrep.

Related ocaml-tree-sitter repositories:

  • ocaml-tree-sitter-core: provides the code generator that takes a tree-sitter grammar and produces an OCaml library from it.
  • ocaml-tree-sitter-languages: community repository that has scripts for building and publishing OCaml libraries for parsing a variety of programming languages.
  • ocaml-tree-sitter-semgrep: this repo; same as ocaml-tree-sitter-languages but extends each language with constructs specific to semgrep patterns.

Contributing

Development setup

  1. Make sure you have at least 6 GiB of free memory. More will be needed for some of the grammars.
  2. Install the following tools:
    • git
    • GNU make
    • pkg-config: manages the installation of tree-sitter's runtime library
    • Node.js: JavaScript interpreter used to translate a grammar to json
    • cargo: Rust compiler used to build tree-sitter
    • opam: OCaml package manager
  3. Run opam init, opam switch create 4.12.0 to install a recent version of OCaml.
  4. Install ocaml dev tools for your favorite editor: typically opam install merlin + some plugin for your editor.
  5. Install pre-commit with pip3 install pre-commit and run pre-commit install to set up the pre-commit hook. This will re-indent code in a consistent fashion each time you call git commit.
  6. Check out the extra instructions for MacOS.

See the Makefile for the available targets. Get started with:

make update
make setup

Then build and install the OCaml code generator (core):

make && make install

Testing a language

Say you want to build and test support for kotlin, you would run this:

$ cd lang
$ ./test-lang kotlin

For details, see How to upgrade the grammar for a language.

Adding a new language

See How to add support for a new language.

Documentation

We have limited documentation which is mostly targeted at early contributors. It's growing organically based on demand, so don't hesitate to file an issue explaining what you're trying to do.

License

ocaml-tree-sitter is free software with contributors from multiple organizations. The project is driven by r2c.

  • OCaml code developed specifically for this project is distributed under the terms of the GNU GPL v3.
  • The OCaml bindings to tree-sitter's C API were created by Bryan Phelps as part of the reason-tree-sitter project.
  • The tree-sitter grammars for major programming languages are external projects. Each comes with its own license.

ocaml-tree-sitter-semgrep's People

Contributors

amietn avatar aryx avatar brendongo avatar colleend avatar dhutty-numo avatar drewdennison avatar eatkins avatar emjin avatar fpmosley avatar frankeld avatar iagoabal avatar ievans avatar joseemds avatar mafrosis avatar mjambon avatar mschwager avatar nmote avatar ruin0x11 avatar sjord avatar underyx avatar zythosec avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.