{"id":51631089,"url":"https://github.com/semgrep/semgrep-ocaml-visitors","last_synced_at":"2026-07-13T07:04:10.603Z","repository":{"id":348996843,"uuid":"1198978837","full_name":"semgrep/semgrep-ocaml-visitors","owner":"semgrep","description":"A implementation of OCaml's `visitors`","archived":false,"fork":false,"pushed_at":"2026-05-21T16:47:40.000Z","size":58,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-22T01:46:17.621Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"OCaml","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/semgrep.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-02T00:19:15.000Z","updated_at":"2026-05-21T16:48:02.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/semgrep/semgrep-ocaml-visitors","commit_stats":null,"previous_names":["semgrep/visitors-cleanroom","semgrep/semgrep-ocaml-visitors"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/semgrep/semgrep-ocaml-visitors","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semgrep%2Fsemgrep-ocaml-visitors","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semgrep%2Fsemgrep-ocaml-visitors/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semgrep%2Fsemgrep-ocaml-visitors/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semgrep%2Fsemgrep-ocaml-visitors/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/semgrep","download_url":"https://codeload.github.com/semgrep/semgrep-ocaml-visitors/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/semgrep%2Fsemgrep-ocaml-visitors/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35413545,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-07-13T02:00:06.543Z","response_time":119,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-07-13T07:04:09.932Z","updated_at":"2026-07-13T07:04:10.590Z","avatar_url":"https://github.com/semgrep.png","language":"OCaml","funding_links":[],"categories":[],"sub_categories":[],"readme":"# visitors-cleanroom\n\nA drop-in replacement for the upstream\n[visitors](https://gitlab.inria.fr/fpottier/visitors) OCaml package.\nIt provides:\n\n1. **A clean-room runtime** (`visitors-cleanroom` library) -- an\n   independently-written `VisitorsRuntime` module, licensed LGPL-2.1\n   with the OCaml linking exception.\n\n2. **The upstream PPX** (`visitors-cleanroom.ppx`) -- built from a git\n   submodule, configured to depend on our runtime instead of\n   `visitors.runtime`.\n\n## Getting started\n\n```sh\ngit clone --recurse-submodules https://github.com/semgrep/visitors-cleanroom.git\ncd visitors-cleanroom\nopam install ppxlib ppx_deriving result\ndune build\n```\n\nIf you already cloned without `--recurse-submodules`, run\n`git submodule update --init`.\n\n## Testing\n\nTests compare our runtime against the upstream `visitors.runtime` on\nrandom inputs:\n\n```sh\nopam install visitors qcheck-core qcheck-alcotest alcotest\ndune test\n```\n\nPassing tests produce no output. Use `dune test --force` to see\nresults unconditionally.\n\n**Note:** The test suite links both our `VisitorsRuntime` and the\nupstream `visitors.runtime` into the same executable for comparison.\nThese have different `.cmi` digests (our interface doesn't depend on\nthe `result` compat package). `dune test` handles this correctly\nbecause each library is compiled in isolation, but `ocaml-lsp` may\nreport \"inconsistent assumptions over interface VisitorsRuntime\" in\nthe test files. This is expected and can be safely ignored.\n\n## Benchmarks\n\n```sh\nopam install bechamel\ndune exec bench/bench.exe          # OO visitor benchmarks + stack depth conformance\ndune exec bench/bench_functors.exe # functor-based visitor benchmarks\n```\n\n`bench_functors` compares PPX-generated OO visitors against hand-written\nfunctor-based visitors on the same types, measuring the overhead of\nvirtual dispatch vs. static functor application.\n\n## Usage\n\n```dune\n(library\n (name my_lib)\n (preprocess (pps visitors-cleanroom.ppx)))\n```\n\nThe PPX automatically links our clean-room `VisitorsRuntime` via\n`ppx_runtime_deps`.\n\n## ppxlib compatibility\n\nThe upstream PPX submodule (`vendor/visitors/`, tag `20250212`) requires ppxlib\n\u003c 0.36.0. ppxlib 0.36.0 added `Ptyp_open` to its public AST. The upstream\nvisitors release `20251114` handles `Ptyp_open`, but requires ppxlib \u003e= 0.36.0.\nTo upgrade, bump both together:\n\n1. `cd vendor/visitors \u0026\u0026 git checkout 20251114`\n2. Change the ppxlib constraint in `dune-project` to `(\u003e= 0.36.0)`.\n\n## License\n\nThe clean-room runtime (`lib/`) is licensed LGPL-2.1 with the OCaml\nlinking exception (Copyright 2026, Semgrep Inc.). The PPX\n(`vendor/visitors/`) is the upstream source, licensed LGPL-2.1\n(Copyright Francois Pottier / INRIA).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemgrep%2Fsemgrep-ocaml-visitors","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsemgrep%2Fsemgrep-ocaml-visitors","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsemgrep%2Fsemgrep-ocaml-visitors/lists"}