about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/parsing
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/tools/parsing')
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/antlr/2.7.7-fixes.patch26
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/antlr/2.7.7.nix26
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/antlr/3.4.nix39
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/antlr/3.5.nix52
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/antlr/4.8.nix84
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/antlr/builder.sh23
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/bison/default.nix46
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/bisonc++/default.nix56
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/byacc/default.nix31
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/flex/2.5.35.nix33
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/flex/2.6.1.nix36
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/flex/default.nix53
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/flexc++/default.nix47
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/hammer/default.nix30
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/javacc/default.nix32
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/jikespg/default.nix29
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/jshon/default.nix41
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/lemon/default.nix45
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/peg/default.nix19
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/ragel/default.nix51
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/re2c/default.nix30
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/default.nix168
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammar.nix56
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/default.nix38
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-agda.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-bash.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-c-sharp.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-c.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-cpp.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-css.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-embedded-template.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-fennel.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-fluent.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-go.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-haskell.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-html.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-java.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-javascript.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-jsdoc.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-json.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-julia.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-lua.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-markdown.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-nix.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ocaml.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-php.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-python.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ql.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-razor.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-regex.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ruby.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-rust.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-scala.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-svelte.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-swift.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-toml.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-tsq.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-typescript.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-verilog.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-yaml.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-zig.json10
-rw-r--r--nixpkgs/pkgs/development/tools/parsing/tree-sitter/update.nix225
62 files changed, 1686 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/tools/parsing/antlr/2.7.7-fixes.patch b/nixpkgs/pkgs/development/tools/parsing/antlr/2.7.7-fixes.patch
new file mode 100644
index 000000000000..a71b7718e3bf
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/antlr/2.7.7-fixes.patch
@@ -0,0 +1,26 @@
+diff --git a/lib/cpp/antlr/CharScanner.hpp b/lib/cpp/antlr/CharScanner.hpp
+index 8a97e97..1835a3e 100644
+--- a/lib/cpp/antlr/CharScanner.hpp
++++ b/lib/cpp/antlr/CharScanner.hpp
+@@ -11,6 +11,8 @@
+ #include <antlr/config.hpp>
+ 
+ #include <map>
++#include <cstdio>
++#include <cstring>
+ 
+ #ifdef HAS_NOT_CCTYPE_H
+ #include <ctype.h>
+diff --git a/scripts/config.make.in b/scripts/config.make.in
+index c23dd5c..6057309 100644
+--- a/scripts/config.make.in
++++ b/scripts/config.make.in
+@@ -38,7 +38,7 @@ MAKEOVERRIDES := $(patsubst SUBDIRS=%,,$(MAKEOVERRIDES))
+ all clean distclean test install force-target clean-target :: 
+ 	@dirs="$(SUBDIRS)" ; \
+ 	test -z "$${dirs}" && { \
+-		dirs=`/bin/ls` ; \
++		dirs=`ls` ; \
+   } ; \
+ 	for d in . $${dirs} ; do \
+ 		case $${d} in \
diff --git a/nixpkgs/pkgs/development/tools/parsing/antlr/2.7.7.nix b/nixpkgs/pkgs/development/tools/parsing/antlr/2.7.7.nix
new file mode 100644
index 000000000000..fed96e954751
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/antlr/2.7.7.nix
@@ -0,0 +1,26 @@
+{ lib, stdenv, fetchurl, jdk, python2 }:
+
+stdenv.mkDerivation {
+  name = "antlr-2.7.7";
+  src = fetchurl {
+    url = "https://www.antlr2.org/download/antlr-2.7.7.tar.gz";
+    sha256 = "1ffvcwdw73id0dk6pj2mlxjvbg0662qacx4ylayqcxgg381fnfl5";
+  };
+  patches = [ ./2.7.7-fixes.patch ];
+  buildInputs = [ jdk ];
+  nativeBuildInputs = [ python2 ];
+
+  meta = with lib; {
+    description = "Powerful parser generator";
+    longDescription = ''
+      ANTLR (ANother Tool for Language Recognition) is a powerful parser
+      generator for reading, processing, executing, or translating structured
+      text or binary files. It's widely used to build languages, tools, and
+      frameworks. From a grammar, ANTLR generates a parser that can build and
+      walk parse trees.
+    '';
+    homepage = "https://www.antlr.org/";
+    license = licenses.bsd3;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/antlr/3.4.nix b/nixpkgs/pkgs/development/tools/parsing/antlr/3.4.nix
new file mode 100644
index 000000000000..962cd079a8e9
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/antlr/3.4.nix
@@ -0,0 +1,39 @@
+{lib, stdenv, fetchurl, jre}:
+
+stdenv.mkDerivation rec {
+  pname = "antlr";
+  version = "3.4";
+  src = fetchurl {
+    url ="https://www.antlr3.org/download/antlr-${version}-complete.jar";
+    sha256 = "1xqbam8vf04q5fasb0m2n1pn5dbp2yw763sj492ncq04c5mqcglx";
+  };
+
+  dontUnpack = true;
+
+  installPhase = ''
+    mkdir -p "$out"/{lib/antlr,bin}
+    cp "$src" "$out/lib/antlr/antlr-${version}-complete.jar"
+
+    echo "#! ${stdenv.shell}" >> "$out/bin/antlr"
+    echo "'${jre}/bin/java' -cp '$out/lib/antlr/antlr-${version}-complete.jar' -Xms200M -Xmx400M org.antlr.Tool \"\$@\"" >> "$out/bin/antlr"
+
+    chmod a+x "$out/bin/antlr"
+    ln -s "$out/bin/antlr"{,3}
+  '';
+
+  inherit jre;
+
+  meta = with lib; {
+    description = "Powerful parser generator";
+    longDescription = ''
+      ANTLR (ANother Tool for Language Recognition) is a powerful parser
+      generator for reading, processing, executing, or translating structured
+      text or binary files. It's widely used to build languages, tools, and
+      frameworks. From a grammar, ANTLR generates a parser that can build and
+      walk parse trees.
+    '';
+    homepage = "https://www.antlr.org/";
+    license = licenses.bsd3;
+    platforms = platforms.linux ++ platforms.darwin;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/antlr/3.5.nix b/nixpkgs/pkgs/development/tools/parsing/antlr/3.5.nix
new file mode 100644
index 000000000000..cb6263aca424
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/antlr/3.5.nix
@@ -0,0 +1,52 @@
+{lib, stdenv, fetchpatch, fetchurl, fetchFromGitHub, jre}:
+
+stdenv.mkDerivation rec {
+  pname = "antlr";
+  version = "3.5.2";
+  jar = fetchurl {
+    url = "https://www.antlr3.org/download/antlr-${version}-complete.jar";
+    sha256 = "0srjwxipwsfzmpi0v32d1l5lzk9gi5in8ayg33sq8wyp8ygnbji6";
+  };
+  src = fetchFromGitHub {
+    owner = "antlr";
+    repo = "antlr3";
+    rev = "5c2a916a10139cdb5c7c8851ee592ed9c3b3d4ff";
+    sha256 = "1i0w2v9prrmczlwkfijfp4zfqfgrss90a7yk2hg3y0gkg2s4abbk";
+  };
+
+  patches = [
+    (fetchpatch {
+      url = "https://src.fedoraproject.org/rpms/antlr3/raw/f1bb8d639678047935e1761c3bf3c1c7da8d0f1d/f/0006-antlr3memory.hpp-fix-for-C-20-mode.patch";
+      sha256 = "0apk904afjqbad6c7z9r72a9lkbz69vwrl8j2a6zgxjn8dfb2p8b";
+    })
+  ];
+
+  installPhase = ''
+    mkdir -p "$out"/{lib/antlr,bin,include}
+    cp "$jar" "$out/lib/antlr/antlr-${version}-complete.jar"
+    cp runtime/Cpp/include/* $out/include/
+
+    echo "#! ${stdenv.shell}" >> "$out/bin/antlr"
+    echo "'${jre}/bin/java' -cp '$out/lib/antlr/antlr-${version}-complete.jar' -Xms200M -Xmx400M org.antlr.Tool \"\$@\"" >> "$out/bin/antlr"
+
+    chmod a+x "$out/bin/antlr"
+    ln -s "$out/bin/antlr"{,3}
+  '';
+
+  inherit jre;
+
+  meta = with lib; {
+    description = "Powerful parser generator";
+    longDescription = ''
+      ANTLR (ANother Tool for Language Recognition) is a powerful parser
+      generator for reading, processing, executing, or translating structured
+      text or binary files. It's widely used to build languages, tools, and
+      frameworks. From a grammar, ANTLR generates a parser that can build and
+      walk parse trees.
+    '';
+    homepage = "https://www.antlr.org/";
+    license = licenses.bsd3;
+    platforms = platforms.linux;
+    maintainers = [ lib.maintainers.farlion ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/antlr/4.8.nix b/nixpkgs/pkgs/development/tools/parsing/antlr/4.8.nix
new file mode 100644
index 000000000000..0708ba754b2a
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/antlr/4.8.nix
@@ -0,0 +1,84 @@
+{ lib, stdenv, fetchurl, jre
+, fetchFromGitHub, cmake, ninja, pkg-config, libuuid, darwin }:
+
+let
+  version = "4.8";
+  source = fetchFromGitHub {
+    owner = "antlr";
+    repo = "antlr4";
+    rev = version;
+    sha256 = "1qal3add26qxskm85nk7r758arladn5rcyjinmhlhznmpbbv9j8m";
+  };
+
+  runtime = {
+    cpp = stdenv.mkDerivation {
+      pname = "antlr-runtime-cpp";
+      inherit version;
+      src = source;
+
+      outputs = [ "out" "dev" "doc" ];
+
+      nativeBuildInputs = [ cmake ninja pkg-config ];
+      buildInputs = lib.optional stdenv.isLinux libuuid
+        ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.CoreFoundation;
+
+      postUnpack = ''
+        export sourceRoot=$sourceRoot/runtime/Cpp
+      '';
+
+      meta = with lib; {
+        description = "C++ target for ANTLR 4";
+        homepage = "https://www.antlr.org/";
+        license = licenses.bsd3;
+        platforms = platforms.unix;
+      };
+    };
+  };
+
+  antlr = stdenv.mkDerivation {
+    pname = "antlr";
+    inherit version;
+
+    src = fetchurl {
+      url ="https://www.antlr.org/download/antlr-${version}-complete.jar";
+      sha256 = "0nms976cnqyr1ndng3haxkmknpdq6xli4cpf4x4al0yr21l9v93k";
+    };
+
+    dontUnpack = true;
+
+    installPhase = ''
+      mkdir -p "$out"/{share/java,bin}
+      cp "$src" "$out/share/java/antlr-${version}-complete.jar"
+
+      echo "#! ${stdenv.shell}" >> "$out/bin/antlr"
+      echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' -Xmx500M org.antlr.v4.Tool \"\$@\"" >> "$out/bin/antlr"
+
+      echo "#! ${stdenv.shell}" >> "$out/bin/grun"
+      echo "'${jre}/bin/java' -cp '$out/share/java/antlr-${version}-complete.jar:$CLASSPATH' org.antlr.v4.gui.TestRig \"\$@\"" >> "$out/bin/grun"
+
+      chmod a+x "$out/bin/antlr" "$out/bin/grun"
+      ln -s "$out/bin/antlr"{,4}
+    '';
+
+    inherit jre;
+
+    passthru = {
+      inherit runtime;
+      jarLocation = "${antlr}/share/java/antlr-${version}-complete.jar";
+    };
+
+    meta = with lib; {
+      description = "Powerful parser generator";
+      longDescription = ''
+        ANTLR (ANother Tool for Language Recognition) is a powerful parser
+        generator for reading, processing, executing, or translating structured
+        text or binary files. It's widely used to build languages, tools, and
+        frameworks. From a grammar, ANTLR generates a parser that can build and
+        walk parse trees.
+      '';
+      homepage = "https://www.antlr.org/";
+      license = licenses.bsd3;
+      platforms = platforms.unix;
+    };
+  };
+in antlr
diff --git a/nixpkgs/pkgs/development/tools/parsing/antlr/builder.sh b/nixpkgs/pkgs/development/tools/parsing/antlr/builder.sh
new file mode 100644
index 000000000000..b8e7791b6fc9
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/antlr/builder.sh
@@ -0,0 +1,23 @@
+source $stdenv/setup
+
+tar zxvf $src
+cd antlr-*
+cd lib
+
+mkdir -p $out/lib/antlr
+mkdir -p $out/bin
+
+cp *.jar $out/lib/antlr
+
+classpath=""
+for jar in $out/lib/antlr/*.jar; do
+  classpath="$classpath:$jar"
+done
+
+cat > $out/bin/antlr <<EOF
+#! $SHELL
+
+$jre/bin/java -cp $classpath -Xms200M -Xmx400M org.antlr.Tool \$*
+EOF
+
+chmod u+x $out/bin/antlr
diff --git a/nixpkgs/pkgs/development/tools/parsing/bison/default.nix b/nixpkgs/pkgs/development/tools/parsing/bison/default.nix
new file mode 100644
index 000000000000..1de45b08447b
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/bison/default.nix
@@ -0,0 +1,46 @@
+{ lib, stdenv, fetchurl, m4, perl, help2man }:
+
+# Note: this package is used for bootstrapping fetchurl, and thus
+# cannot use fetchpatch! All mutable patches (generated by GitHub or
+# cgit) that are needed here should be included directly in Nixpkgs as
+# files.
+
+stdenv.mkDerivation rec {
+  pname = "bison";
+  version = "3.7.6";
+
+  src = fetchurl {
+    url = "mirror://gnu/${pname}/${pname}-${version}.tar.gz";
+    sha256 = "sha256-adwLtG6o/DB9TKHgthyMNV6yB9Cwxp9PhGIyjnTXueo=";
+  };
+
+  nativeBuildInputs = [ m4 perl ] ++ lib.optional stdenv.isSunOS help2man;
+  propagatedBuildInputs = [ m4 ];
+
+  doCheck = false; # fails
+  doInstallCheck = false; # fails
+
+  meta = {
+    homepage = "https://www.gnu.org/software/bison/";
+    description = "Yacc-compatible parser generator";
+    license = lib.licenses.gpl3Plus;
+
+    longDescription = ''
+      Bison is a general-purpose parser generator that converts an
+      annotated context-free grammar into an LALR(1) or GLR parser for
+      that grammar.  Once you are proficient with Bison, you can use
+      it to develop a wide range of language parsers, from those used
+      in simple desk calculators to complex programming languages.
+
+      Bison is upward compatible with Yacc: all properly-written Yacc
+      grammars ought to work with Bison with no change.  Anyone
+      familiar with Yacc should be able to use Bison with little
+      trouble.  You need to be fluent in C or C++ programming in order
+      to use Bison.
+    '';
+
+    platforms = lib.platforms.unix;
+  };
+
+  passthru = { glrSupport = true; };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/bisonc++/default.nix b/nixpkgs/pkgs/development/tools/parsing/bisonc++/default.nix
new file mode 100644
index 000000000000..5710500a18f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/bisonc++/default.nix
@@ -0,0 +1,56 @@
+{lib, stdenv, fetchurl, fetchFromGitLab
+, yodl, icmake, flexcpp, bobcat
+}:
+stdenv.mkDerivation rec {
+  pname = "bisonc++";
+  version = "6.04.00";
+
+  src = fetchFromGitLab {
+    domain = "gitlab.com";
+    owner = "fbb-git";
+    repo = "bisoncpp";
+    rev = "6.04.00";
+    sha256 = "sha256:0aa9bij4g08ilsk6cgrbgi03vyhqr9fn6j2164sjin93m63212wl";
+  };
+
+  buildInputs = [ bobcat ];
+
+  nativeBuildInputs = [ yodl icmake flexcpp ];
+
+  setSourceRoot = ''
+    sourceRoot="$(echo */bisonc++)"
+  '';
+
+  gpl = fetchurl {
+    url = "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt";
+    sha256 = "sha256:0hq6i0dm4420825fdm0lnnppbil6z67ls67n5kgjcd912dszjxw1";
+  };
+
+  postPatch = ''
+    substituteInPlace INSTALL.im --replace /usr $out
+    patchShebangs .
+    for file in $(find documentation -type f); do
+      substituteInPlace "$file" --replace /usr/share/common-licenses/GPL ${gpl}
+      substituteInPlace "$file" --replace /usr $out
+    done
+  '';
+
+  buildPhase = ''
+    ./build program
+    ./build man
+    ./build manual
+  '';
+
+  installPhase = ''
+    ./build install x
+  '';
+
+  meta = with lib; {
+    inherit version;
+    description = "A parser generator like bison, but it generates C++ code";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ raskin ];
+    platforms = platforms.linux;
+    homepage = "https://fbb-git.gitlab.io/bisoncpp/";
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/byacc/default.nix b/nixpkgs/pkgs/development/tools/parsing/byacc/default.nix
new file mode 100644
index 000000000000..756d99c6e7f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/byacc/default.nix
@@ -0,0 +1,31 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  pname = "byacc";
+  version = "20210109";
+
+  src = fetchurl {
+    urls = [
+      "ftp://ftp.invisible-island.net/byacc/${pname}-${version}.tgz"
+      "https://invisible-mirror.net/archives/byacc/${pname}-${version}.tgz"
+    ];
+    sha256 = "sha256-nn13aFhxQed4RJJhXf78cKjgBBAEO2OQHv7cG1DBm5c=";
+  };
+
+  configureFlags = [
+    "--program-transform-name='s,^,b,'"
+  ];
+
+  doCheck = true;
+
+  postInstall = ''
+    ln -s $out/bin/byacc $out/bin/yacc
+  '';
+
+  meta = with lib; {
+    description = "Berkeley YACC";
+    homepage = "https://invisible-island.net/byacc/byacc.html";
+    license = licenses.publicDomain;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/flex/2.5.35.nix b/nixpkgs/pkgs/development/tools/parsing/flex/2.5.35.nix
new file mode 100644
index 000000000000..b2245ff9c9b9
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/flex/2.5.35.nix
@@ -0,0 +1,33 @@
+{ lib, stdenv, fetchurl, autoreconfHook, flex, bison, texinfo, help2man, m4 }:
+
+stdenv.mkDerivation {
+  name = "flex-2.5.35";
+
+  src = fetchurl {
+    url = "https://github.com/westes/flex/archive/flex-2-5-35.tar.gz";
+    sha256 = "0wh06nix8bd4w1aq4k2fbbkdq5i30a9lxz3xczf3ff28yy0kfwzm";
+  };
+
+  postPatch = ''
+    patchShebangs tests
+  '';
+
+  nativeBuildInputs = [ flex bison texinfo help2man autoreconfHook ];
+
+  propagatedBuildInputs = [ m4 ];
+
+  preConfigure = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  doCheck = false; # fails 2 out of 46 tests
+
+  meta = with lib; {
+    branch = "2.5.35";
+    homepage = "http://flex.sourceforge.net/";
+    description = "A fast lexical analyser generator";
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/flex/2.6.1.nix b/nixpkgs/pkgs/development/tools/parsing/flex/2.6.1.nix
new file mode 100644
index 000000000000..cc0ecb148c44
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/flex/2.6.1.nix
@@ -0,0 +1,36 @@
+{ lib, stdenv, fetchurl, bison, m4 }:
+
+stdenv.mkDerivation {
+  name = "flex-2.6.1";
+
+  src = fetchurl {
+    url = "https://github.com/westes/flex/releases/download/v2.6.1/flex-2.6.1.tar.gz";
+    sha256 = "0fy14c35yz2m1n1m4f02by3501fn0cca37zn7jp8lpp4b3kgjhrw";
+  };
+
+  postPatch = ''
+    patchShebangs tests
+  '' + lib.optionalString (stdenv.hostPlatform != stdenv.buildPlatform) ''
+    substituteInPlace Makefile.in --replace "tests" " ";
+  '';
+
+  buildInputs = [ bison ];
+
+  propagatedBuildInputs = [ m4 ];
+
+  preConfigure = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "ac_cv_func_malloc_0_nonnull=yes"
+    "ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  postConfigure = lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) ''
+    sed -i Makefile -e 's/-no-undefined//;'
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/westes/flex";
+    description = "A fast lexical analyser generator";
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/flex/default.nix b/nixpkgs/pkgs/development/tools/parsing/flex/default.nix
new file mode 100644
index 000000000000..0bc26db57504
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/flex/default.nix
@@ -0,0 +1,53 @@
+{ lib, stdenv, buildPackages, fetchurl, bison, m4
+, fetchpatch, autoreconfHook, help2man
+}:
+
+stdenv.mkDerivation rec {
+  pname = "flex";
+  version = "2.6.4";
+
+  src = fetchurl {
+    url = "https://github.com/westes/flex/releases/download/v${version}/flex-${version}.tar.gz";
+    sha256 = "15g9bv236nzi665p9ggqjlfn4dwck5835vf0bbw2cz7h5c1swyp8";
+  };
+
+  # Also upstream, will be part of 2.6.5
+  # https://github.com/westes/flex/commit/24fd0551333e
+  patches = [(fetchpatch {
+    name = "glibc-2.26.patch";
+    url = "https://raw.githubusercontent.com/lede-project/source/0fb14a2b1ab2f82c"
+        + "/tools/flex/patches/200-build-AC_USE_SYSTEM_EXTENSIONS-in-configure.ac.patch";
+    sha256 = "1aarhcmz7mfrgh15pkj6f7ikxa2m0mllw1i1vscsf1kw5d05lw6f";
+  })];
+
+  postPatch = ''
+    patchShebangs tests
+  '' + lib.optionalString (stdenv.buildPlatform != stdenv.hostPlatform) ''
+    substituteInPlace Makefile.in --replace "tests" " "
+
+    substituteInPlace doc/Makefile.am --replace 'flex.1: $(top_srcdir)/configure.ac' 'flex.1: '
+  '';
+
+  depsBuildBuild = [ buildPackages.stdenv.cc ];
+  nativeBuildInputs = [ autoreconfHook help2man ];
+  buildInputs = [ bison ];
+  propagatedBuildInputs = [ m4 ];
+
+  preConfigure = lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [
+    "export ac_cv_func_malloc_0_nonnull=yes"
+    "export ac_cv_func_realloc_0_nonnull=yes"
+  ];
+
+  postConfigure = lib.optionalString (stdenv.isDarwin || stdenv.isCygwin) ''
+    sed -i Makefile -e 's/-no-undefined//;'
+  '';
+
+  dontDisableStatic = stdenv.buildPlatform != stdenv.hostPlatform;
+
+  meta = with lib; {
+    homepage = "https://github.com/westes/flex";
+    description = "A fast lexical analyser generator";
+    license = licenses.bsd2;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/flexc++/default.nix b/nixpkgs/pkgs/development/tools/parsing/flexc++/default.nix
new file mode 100644
index 000000000000..e4db5631e7fe
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/flexc++/default.nix
@@ -0,0 +1,47 @@
+{ lib, stdenv, fetchFromGitHub, bobcat, icmake, yodl }:
+
+stdenv.mkDerivation rec {
+  pname = "flexc++";
+  version = "2.05.00";
+
+  src = fetchFromGitHub {
+    sha256 = "0s25d9jsfsqvm34rwf48cxwz23aq1zja3cqlzfz3z33p29wwazwz";
+    rev = version;
+    repo = "flexcpp";
+    owner = "fbb-git";
+  };
+
+  setSourceRoot = ''
+    sourceRoot=$(echo */flexc++)
+  '';
+
+  buildInputs = [ bobcat ];
+  nativeBuildInputs = [ icmake yodl ];
+
+  postPatch = ''
+    substituteInPlace INSTALL.im --replace /usr $out
+    patchShebangs .
+  '';
+
+  buildPhase = ''
+    ./build man
+    ./build manual
+    ./build program
+  '';
+
+  installPhase = ''
+    ./build install x
+  '';
+
+  meta = with lib; {
+    description = "C++ tool for generating lexical scanners";
+    longDescription = ''
+      Flexc++ was designed after `flex'. Flexc++ offers a cleaner class design
+      and requires simpler specification files than offered by flex's C++
+      option.
+    '';
+    homepage = "https://fbb-git.github.io/flexcpp/";
+    license = licenses.gpl3;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/hammer/default.nix b/nixpkgs/pkgs/development/tools/parsing/hammer/default.nix
new file mode 100644
index 000000000000..0a9dfdec0163
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/hammer/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchgit, glib, pkg-config, python, scons }:
+
+stdenv.mkDerivation {
+  pname = "hammer";
+  version = "e7aa734";
+
+  src = fetchgit {
+    url = "git://github.com/UpstandingHackers/hammer";
+    sha256 = "01l0wbhz7dymxlndacin2vi8sqwjlw81ds2i9xyi200w51nsdm38";
+    rev = "47f34b81e4de834fd3537dd71928c4f3cdb7f533";
+  };
+
+  nativeBuildInputs = [ pkg-config ];
+  buildInputs = [ glib python scons ];
+
+  meta = with lib; {
+    description = "A bit-oriented parser combinator library";
+    longDescription = ''
+      Hammer is a parsing library. Like many modern parsing libraries,
+      it provides a parser combinator interface for writing grammars
+      as inline domain-specific languages, but Hammer also provides a
+      variety of parsing backends. It's also bit-oriented rather than
+      character-oriented, making it ideal for parsing binary data such
+      as images, network packets, audio, and executables.
+    '';
+    homepage = "https://github.com/UpstandingHackers/hammer";
+    license = licenses.gpl2;
+    platforms = platforms.linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/javacc/default.nix b/nixpkgs/pkgs/development/tools/parsing/javacc/default.nix
new file mode 100644
index 000000000000..d074e3dda93e
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/javacc/default.nix
@@ -0,0 +1,32 @@
+{ stdenv, lib, fetchFromGitHub, ant, jdk }:
+
+stdenv.mkDerivation rec {
+  pname = "javacc";
+  version = "7.0.10";
+
+  src = fetchFromGitHub {
+    owner = pname;
+    repo = pname;
+    rev = "${pname}-${version}";
+    sha256 = "120jva4sw1kylkwgqf869zxddss01mcn1nmimx9vmd4xaadz7cf2";
+  };
+
+  nativeBuildInputs = [ ant jdk ];
+
+  buildPhase = ''
+    ant jar
+  '';
+
+  installPhase = ''
+    mkdir -p $out/target
+    mv scripts $out/bin
+    mv target/javacc.jar $out/target/
+  '';
+
+  meta = with lib; {
+    homepage = "https://javacc.github.io/javacc";
+    description = "A parser generator for building parsers from grammars";
+    license = licenses.bsd2;
+    maintainers = [ teams.deshaw.members ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/jikespg/default.nix b/nixpkgs/pkgs/development/tools/parsing/jikespg/default.nix
new file mode 100644
index 000000000000..8179855e6ebc
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/jikespg/default.nix
@@ -0,0 +1,29 @@
+{lib, stdenv, fetchurl}:
+
+stdenv.mkDerivation rec {
+  pname = "jikespg";
+  version = "1.3";
+
+  src = fetchurl {
+    url = "mirror://sourceforge/jikes/${pname}-${version}.tar.gz";
+    sha256 = "083ibfxaiw1abxmv1crccx1g6sixkbyhxn2hsrlf6fwii08s6rgw";
+  };
+
+  postPatch = ''
+    substituteInPlace Makefile --replace "gcc" "${stdenv.cc.targetPrefix}cc"
+  '';
+
+  sourceRoot = "jikespg/src";
+
+  installPhase = ''
+    install -Dm755 -t $out/bin jikespg
+  '';
+
+  meta = with lib; {
+    homepage = "http://jikes.sourceforge.net/";
+    description = "The Jikes Parser Generator";
+    platforms = platforms.all;
+    license = licenses.ipl10;
+    maintainers = with maintainers; [ pSub ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/jshon/default.nix b/nixpkgs/pkgs/development/tools/parsing/jshon/default.nix
new file mode 100644
index 000000000000..04a1a637207d
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/jshon/default.nix
@@ -0,0 +1,41 @@
+{ stdenv, lib, fetchFromGitHub, fetchpatch, jansson }:
+
+stdenv.mkDerivation rec {
+  pname = "jshon";
+  version = "20170302";
+
+  src = fetchFromGitHub {
+    owner = "keenerd";
+    repo = "jshon";
+    rev = "d919aeaece37962251dbe6c1ee50f0028a5c90e4";
+    sha256 = "1x4zfmsjq0l2y994bxkhx3mn5vzjxxr39iib213zjchi9h6yxvnc";
+  };
+
+  buildInputs = [ jansson ];
+
+  patches = [
+    (fetchpatch {
+      # https://github.com/keenerd/jshon/pull/62
+      url = "https://github.com/keenerd/jshon/commit/96b4e9dbf578be7b31f29740b608aa7b34df3318.patch";
+      sha256 = "0kwbn3xb37iqb5y1n8vhzjiwlbg5jmki3f38pzakc24kzc5ksmaa";
+    })
+  ];
+
+  postPatch =
+    ''
+      substituteInPlace Makefile --replace "/usr/" "/"
+    '';
+
+  preInstall =
+    ''
+      export DESTDIR=$out
+    '';
+
+  meta = with lib; {
+    homepage = "http://kmkeen.com/jshon";
+    description = "JSON parser designed for maximum convenience within the shell";
+    license = licenses.free;
+    platforms = platforms.all;
+    maintainers = with maintainers; [ rushmorem ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/lemon/default.nix b/nixpkgs/pkgs/development/tools/parsing/lemon/default.nix
new file mode 100644
index 000000000000..3db9e0f6d9ed
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/lemon/default.nix
@@ -0,0 +1,45 @@
+{ lib, stdenv, fetchurl }:
+
+let
+
+  srcs = {
+    lemon = fetchurl {
+      sha256 = "1c5pk2hz7j9hix5mpc38rwnm8dnlr2jqswf4lan6v78ccbyqzkjx";
+      url = "http://www.sqlite.org/src/raw/tool/lemon.c?name=680980c7935bfa1edec20c804c9e5ba4b1dd96f5";
+      name = "lemon.c";
+    };
+    lempar = fetchurl {
+      sha256 = "1ba13a6yh9j2cs1aw2fh4dxqvgf399gxq1gpp4sh8q0f2w6qiw3i";
+      url = "http://www.sqlite.org/src/raw/tool/lempar.c?name=01ca97f87610d1dac6d8cd96ab109ab1130e76dc";
+      name = "lempar.c";
+    };
+  };
+
+in stdenv.mkDerivation {
+  pname = "lemon";
+  version = "1.69";
+
+  phases = [ "buildPhase" "installPhase" ];
+
+  buildPhase = ''
+    sh -xc "$CC ${srcs.lemon} -o lemon"
+  '';
+
+  installPhase = ''
+    install -Dvm755 lemon $out/bin/lemon
+    install -Dvm644 ${srcs.lempar} $out/bin/lempar.c
+  '';
+
+  meta = with lib; {
+    description = "An LALR(1) parser generator";
+    longDescription = ''
+      The Lemon program is an LALR(1) parser generator that takes a
+      context-free grammar and converts it into a subroutine that will parse a
+      file using that grammar. Lemon is similar to the much more famous
+      programs "yacc" and "bison", but is not compatible with either.
+    '';
+    homepage = "http://www.hwaci.com/sw/lemon/";
+    license = licenses.publicDomain;
+    platforms = platforms.unix;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/peg/default.nix b/nixpkgs/pkgs/development/tools/parsing/peg/default.nix
new file mode 100644
index 000000000000..a7ffeb697459
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/peg/default.nix
@@ -0,0 +1,19 @@
+{ lib, stdenv, fetchurl }:
+
+stdenv.mkDerivation rec {
+  name = "peg-0.1.18";
+
+  src = fetchurl {
+    url = "${meta.homepage}/${name}.tar.gz";
+    sha256 = "114h1y4k8fwcq9m0hfk33dsp7ah8zxzjjzlk71x4iirzczfkn690";
+  };
+
+  preBuild="makeFlagsArray+=( PREFIX=$out )";
+
+  meta = with lib; {
+    homepage = "http://piumarta.com/software/peg/";
+    description = "Tools for generating recursive-descent parsers: programs that perform pattern matching on text";
+    platforms = platforms.all;
+    license = licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/ragel/default.nix b/nixpkgs/pkgs/development/tools/parsing/ragel/default.nix
new file mode 100644
index 000000000000..6bbcf36cd2c2
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/ragel/default.nix
@@ -0,0 +1,51 @@
+{ lib, stdenv, fetchurl, transfig, tex, ghostscript, colm
+, build-manual ? false
+}:
+
+let
+  generic = { version, sha256, license }:
+    stdenv.mkDerivation rec {
+      pname = "ragel";
+      inherit version;
+
+      src = fetchurl {
+        url = "https://www.colm.net/files/ragel/${pname}-${version}.tar.gz";
+        inherit sha256;
+      };
+
+      buildInputs = lib.optional build-manual [ transfig ghostscript tex ];
+
+      preConfigure = lib.optional build-manual ''
+        sed -i "s/build_manual=no/build_manual=yes/g" DIST
+      '';
+
+      configureFlags = [ "--with-colm=${colm}" ];
+
+      NIX_CFLAGS_COMPILE = lib.optionalString stdenv.cc.isGNU "-std=gnu++98";
+
+      doCheck = true;
+
+      meta = with lib; {
+        homepage = "https://www.colm.net/open-source/ragel/";
+        description = "State machine compiler";
+        inherit license;
+        platforms = platforms.unix;
+        maintainers = with maintainers; [ pSub ];
+      };
+    };
+
+in
+
+{
+  ragelStable = generic {
+    version = "6.10";
+    sha256 = "0gvcsl62gh6sg73nwaxav4a5ja23zcnyxncdcdnqa2yjcpdnw5az";
+    license = lib.licenses.gpl2;
+  };
+
+  ragelDev = generic {
+    version = "7.0.0.12";
+    sha256 = "0x3si355lv6q051lgpg8bpclpiq5brpri5lv3p8kk2qhzfbyz69r";
+    license = lib.licenses.mit;
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/re2c/default.nix b/nixpkgs/pkgs/development/tools/parsing/re2c/default.nix
new file mode 100644
index 000000000000..a945f3bdde03
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/re2c/default.nix
@@ -0,0 +1,30 @@
+{ lib, stdenv, fetchFromGitHub, autoreconfHook }:
+
+stdenv.mkDerivation rec {
+  pname = "re2c";
+  version = "2.1.1";
+
+  src = fetchFromGitHub {
+    owner  = "skvadrik";
+    repo   = "re2c";
+    rev    = version;
+    sha256 = "06nvk5sf4vrc2bvpj4vi2xwy3ggv548sn530drz5fi67nhzgga26";
+  };
+
+  nativeBuildInputs = [ autoreconfHook ];
+
+  doCheck = true;
+  enableParallelBuilding = true;
+
+  preCheck = ''
+    patchShebangs run_tests.sh
+  '';
+
+  meta = with lib; {
+    description = "Tool for writing very fast and very flexible scanners";
+    homepage    = "https://re2c.org";
+    license     = licenses.publicDomain;
+    platforms   = platforms.all;
+    maintainers = with maintainers; [ thoughtpolice ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/default.nix b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/default.nix
new file mode 100644
index 000000000000..6ab1463917c8
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/default.nix
@@ -0,0 +1,168 @@
+{ lib
+, stdenv
+, fetchgit
+, fetchFromGitHub
+, fetchurl
+, writeShellScript
+, runCommand
+, which
+, formats
+, rustPlatform
+, jq
+, nix-prefetch-git
+, xe
+, curl
+, emscripten
+, Security
+, callPackage
+, linkFarm
+
+, enableShared ? !stdenv.hostPlatform.isStatic
+, enableStatic ? stdenv.hostPlatform.isStatic
+, webUISupport ? false
+}:
+
+# TODO: move to carnix or https://github.com/kolloch/crate2nix
+let
+  # to update:
+  # 1) change all these hashes
+  # 2) nix-build -A tree-sitter.updater.update-all-grammars
+  # 3) run the ./result script that is output by that (it updates ./grammars)
+  version = "0.19.5";
+  sha256 = "1qmb0sva28zv6r3c3j7xs9pc8bpwwhkb9vxxndw2zbdn9wkvmbmn";
+  cargoSha256 = "0hnjik3pymb1s7frhfpfzvd6w2k3lgpsmh6milpriwxmqsmkwdzz";
+
+  src = fetchFromGitHub {
+    owner = "tree-sitter";
+    repo = "tree-sitter";
+    rev = "v${version}";
+    inherit sha256;
+    fetchSubmodules = true;
+  };
+
+  update-all-grammars = import ./update.nix {
+    inherit writeShellScript nix-prefetch-git curl jq xe src formats lib;
+  };
+
+  fetchGrammar = (v: fetchgit { inherit (v) url rev sha256 fetchSubmodules; });
+
+  grammars =
+    runCommand "grammars" { } (''
+      mkdir $out
+    '' + (lib.concatStrings (lib.mapAttrsToList
+      (name: grammar: "ln -s ${fetchGrammar grammar} $out/${name}\n")
+      (import ./grammars))));
+
+  builtGrammars =
+    let
+      change = name: grammar:
+        callPackage ./grammar.nix { } {
+          language = name;
+          inherit version;
+          source = fetchGrammar grammar;
+          location = if grammar ? location then grammar.location else null;
+        };
+      grammars' = (import ./grammars);
+      grammars = grammars' //
+        { tree-sitter-ocaml = grammars'.tree-sitter-ocaml // { location = "ocaml"; }; } //
+        { tree-sitter-ocaml-interface = grammars'.tree-sitter-ocaml // { location = "interface"; }; } //
+        { tree-sitter-typescript = grammars'.tree-sitter-typescript // { location = "typescript"; }; } //
+        { tree-sitter-tsx = grammars'.tree-sitter-typescript // { location = "tsx"; }; };
+    in
+    lib.mapAttrs change grammars;
+
+  # Usage:
+  # pkgs.tree-sitter.withPlugins (p: [ p.tree-sitter-c p.tree-sitter-java ... ])
+  #
+  # or for all grammars:
+  # pkgs.tree-sitter.withPlugins (_: allGrammars)
+  # which is equivalent to
+  # pkgs.tree-sitter.withPlugins (p: builtins.attrValues p)
+  withPlugins = grammarFn:
+    let
+      grammars = grammarFn builtGrammars;
+    in
+    linkFarm "grammars"
+      (map
+        (drv:
+          let
+            name = lib.strings.getName drv;
+          in
+          {
+            name =
+              (lib.strings.removePrefix "tree-sitter-"
+                (lib.strings.removeSuffix "-grammar" name))
+              + stdenv.hostPlatform.extensions.sharedLibrary;
+            path = "${drv}/parser";
+          }
+        )
+        grammars);
+
+  allGrammars = builtins.attrValues builtGrammars;
+
+in
+rustPlatform.buildRustPackage {
+  pname = "tree-sitter";
+  inherit src version cargoSha256;
+
+  buildInputs =
+    lib.optionals stdenv.isDarwin [ Security ];
+  nativeBuildInputs =
+    [ which ]
+    ++ lib.optionals webUISupport [ emscripten ];
+
+  postPatch = lib.optionalString (!webUISupport) ''
+    # remove web interface
+    sed -e '/pub mod web_ui/d' \
+        -i cli/src/lib.rs
+    sed -e 's/web_ui,//' \
+        -e 's/web_ui::serve(&current_dir.*$/println!("ERROR: web-ui is not available in this nixpkgs build; enable the webUISupport"); std::process::exit(1);/' \
+        -i cli/src/main.rs
+  '';
+
+  # Compile web assembly with emscripten. The --debug flag prevents us from
+  # minifying the JavaScript; passing it allows us to side-step more Node
+  # JS dependencies for installation.
+  preBuild = lib.optionalString webUISupport ''
+    bash ./script/build-wasm --debug
+  '';
+
+  postInstall = ''
+    PREFIX=$out make install
+    ${lib.optionalString (!enableShared) "rm $out/lib/*.so{,.*}"}
+    ${lib.optionalString (!enableStatic) "rm $out/lib/*.a"}
+  '';
+
+  # test result: FAILED. 120 passed; 13 failed; 0 ignored; 0 measured; 0 filtered out
+  doCheck = false;
+
+  passthru = {
+    updater = {
+      inherit update-all-grammars;
+    };
+    inherit grammars builtGrammars withPlugins allGrammars;
+
+    tests = {
+      # make sure all grammars build
+      builtGrammars = lib.recurseIntoAttrs builtGrammars;
+    };
+  };
+
+  meta = with lib; {
+    homepage = "https://github.com/tree-sitter/tree-sitter";
+    description = "A parser generator tool and an incremental parsing library";
+    longDescription = ''
+      Tree-sitter is a parser generator tool and an incremental parsing library.
+      It can build a concrete syntax tree for a source file and efficiently update the syntax tree as the source file is edited.
+
+      Tree-sitter aims to be:
+
+      * General enough to parse any programming language
+      * Fast enough to parse on every keystroke in a text editor
+      * Robust enough to provide useful results even in the presence of syntax errors
+      * Dependency-free so that the runtime library (which is written in pure C) can be embedded in any application
+    '';
+    license = licenses.mit;
+    maintainers = with maintainers; [ Profpatsch ];
+  };
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammar.nix b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammar.nix
new file mode 100644
index 000000000000..93e1cb3804fb
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammar.nix
@@ -0,0 +1,56 @@
+{ stdenv
+, tree-sitter
+, libcxx
+, lib
+}:
+
+# Build a parser grammar and put the resulting shared object in `$out/parser`
+
+{
+  # language name
+  language
+  # version of tree-sitter
+, version
+  # source for the language grammar
+, source
+, location ? null
+}:
+
+stdenv.mkDerivation {
+
+  pname = "${language}-grammar";
+  inherit version;
+
+  src =
+    if location == null
+    then
+      source
+    else
+      "${source}/${location}"
+  ;
+
+  NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin "-I${lib.getDev libcxx}/include/c++/v1";
+  buildInputs = [ tree-sitter ];
+
+  dontUnpack = true;
+  configurePhase = ":";
+  buildPhase = ''
+    runHook preBuild
+    scanner_cc="$src/src/scanner.cc"
+    if [ ! -f "$scanner_cc" ]; then
+      scanner_cc=""
+    fi
+    scanner_c="$src/src/scanner.c"
+    if [ ! -f "$scanner_c" ]; then
+      scanner_c=""
+    fi
+    $CC -I$src/src/ -shared -o parser -Os $src/src/parser.c $scanner_cc $scanner_c -lstdc++
+    runHook postBuild
+  '';
+  installPhase = ''
+    runHook preInstall
+    mkdir $out
+    mv parser $out/
+    runHook postInstall
+  '';
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/default.nix b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/default.nix
new file mode 100644
index 000000000000..e5eb3029c868
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/default.nix
@@ -0,0 +1,38 @@
+{
+  tree-sitter-agda = (builtins.fromJSON (builtins.readFile ./tree-sitter-agda.json));
+  tree-sitter-bash = (builtins.fromJSON (builtins.readFile ./tree-sitter-bash.json));
+  tree-sitter-c = (builtins.fromJSON (builtins.readFile ./tree-sitter-c.json));
+  tree-sitter-c-sharp = (builtins.fromJSON (builtins.readFile ./tree-sitter-c-sharp.json));
+  tree-sitter-cpp = (builtins.fromJSON (builtins.readFile ./tree-sitter-cpp.json));
+  tree-sitter-css = (builtins.fromJSON (builtins.readFile ./tree-sitter-css.json));
+  tree-sitter-embedded-template = (builtins.fromJSON (builtins.readFile ./tree-sitter-embedded-template.json));
+  tree-sitter-fennel = (builtins.fromJSON (builtins.readFile ./tree-sitter-fennel.json));
+  tree-sitter-fluent = (builtins.fromJSON (builtins.readFile ./tree-sitter-fluent.json));
+  tree-sitter-go = (builtins.fromJSON (builtins.readFile ./tree-sitter-go.json));
+  tree-sitter-haskell = (builtins.fromJSON (builtins.readFile ./tree-sitter-haskell.json));
+  tree-sitter-html = (builtins.fromJSON (builtins.readFile ./tree-sitter-html.json));
+  tree-sitter-java = (builtins.fromJSON (builtins.readFile ./tree-sitter-java.json));
+  tree-sitter-javascript = (builtins.fromJSON (builtins.readFile ./tree-sitter-javascript.json));
+  tree-sitter-jsdoc = (builtins.fromJSON (builtins.readFile ./tree-sitter-jsdoc.json));
+  tree-sitter-json = (builtins.fromJSON (builtins.readFile ./tree-sitter-json.json));
+  tree-sitter-julia = (builtins.fromJSON (builtins.readFile ./tree-sitter-julia.json));
+  tree-sitter-lua = (builtins.fromJSON (builtins.readFile ./tree-sitter-lua.json));
+  tree-sitter-markdown = (builtins.fromJSON (builtins.readFile ./tree-sitter-markdown.json));
+  tree-sitter-nix = (builtins.fromJSON (builtins.readFile ./tree-sitter-nix.json));
+  tree-sitter-ocaml = (builtins.fromJSON (builtins.readFile ./tree-sitter-ocaml.json));
+  tree-sitter-php = (builtins.fromJSON (builtins.readFile ./tree-sitter-php.json));
+  tree-sitter-python = (builtins.fromJSON (builtins.readFile ./tree-sitter-python.json));
+  tree-sitter-ql = (builtins.fromJSON (builtins.readFile ./tree-sitter-ql.json));
+  tree-sitter-regex = (builtins.fromJSON (builtins.readFile ./tree-sitter-regex.json));
+  tree-sitter-ruby = (builtins.fromJSON (builtins.readFile ./tree-sitter-ruby.json));
+  tree-sitter-rust = (builtins.fromJSON (builtins.readFile ./tree-sitter-rust.json));
+  tree-sitter-scala = (builtins.fromJSON (builtins.readFile ./tree-sitter-scala.json));
+  tree-sitter-svelte = (builtins.fromJSON (builtins.readFile ./tree-sitter-svelte.json));
+  tree-sitter-swift = (builtins.fromJSON (builtins.readFile ./tree-sitter-swift.json));
+  tree-sitter-toml = (builtins.fromJSON (builtins.readFile ./tree-sitter-toml.json));
+  tree-sitter-tsq = (builtins.fromJSON (builtins.readFile ./tree-sitter-tsq.json));
+  tree-sitter-typescript = (builtins.fromJSON (builtins.readFile ./tree-sitter-typescript.json));
+  tree-sitter-verilog = (builtins.fromJSON (builtins.readFile ./tree-sitter-verilog.json));
+  tree-sitter-yaml = (builtins.fromJSON (builtins.readFile ./tree-sitter-yaml.json));
+  tree-sitter-zig = (builtins.fromJSON (builtins.readFile ./tree-sitter-zig.json));
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-agda.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-agda.json
new file mode 100644
index 000000000000..f16877e94655
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-agda.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-agda",
+  "rev": "d710ff14d15ddee3764fd73a0837c6c4c8c913e9",
+  "date": "2019-09-20T18:06:06+08:00",
+  "path": "/nix/store/wqz9v9znaiwhhqi19hgig9bn0yvl4i9s-tree-sitter-agda",
+  "sha256": "1wpfj47l97pxk3i9rzdylqipy849r482fnj3lmx8byhalv7z1vm6",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-bash.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-bash.json
new file mode 100644
index 000000000000..abb86b305459
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-bash.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-bash",
+  "rev": "b6667bed364733c8a8f8e5973749f86cfa04ba2a",
+  "date": "2021-03-04T14:15:26-08:00",
+  "path": "/nix/store/nvlvdv02wdy4dq4w19bvzq6nlkgvpj20-tree-sitter-bash",
+  "sha256": "18c030bb65r50i6z37iy7jb9z9i8i36y7b08dbc9bchdifqsijs5",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-c-sharp.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-c-sharp.json
new file mode 100644
index 000000000000..148004de4657
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-c-sharp.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-c-sharp",
+  "rev": "5b6bfbdcdbdda7da4839d7163ce579ed98410282",
+  "date": "2021-05-21T15:22:56+02:00",
+  "path": "/nix/store/msyjbgxf3y3rj6m3w2apd65cvr9x523r-tree-sitter-c-sharp",
+  "sha256": "0ls2qic3jb20zv4m5pdrc3ikfb66afay3krvc6gsq1fi9hbxrmvv",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-c.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-c.json
new file mode 100644
index 000000000000..13fd96817095
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-c.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-c",
+  "rev": "f05e279aedde06a25801c3f2b2cc8ac17fac52ae",
+  "date": "2021-03-28T09:12:10-07:00",
+  "path": "/nix/store/4bcxsfrgrcpjy3f6dsmqli2xawjpyz44-tree-sitter-c",
+  "sha256": "1rismmgaqii1sdnri66h75sgw3mky4aha9hff6fan1qzll4f3hif",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-cpp.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-cpp.json
new file mode 100644
index 000000000000..f88c5f9cf996
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-cpp.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-cpp",
+  "rev": "c61212414a3e95b5f7507f98e83de1d638044adc",
+  "date": "2021-03-27T10:08:51-07:00",
+  "path": "/nix/store/a8cd3sv1j900sd8l7cdjw91iw7pp3jhv-tree-sitter-cpp",
+  "sha256": "04nv9j03q20idk9pnm2lgw7rbwzy5jf9v0y6l102by68z4lv79fi",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-css.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-css.json
new file mode 100644
index 000000000000..924eea489cee
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-css.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-css",
+  "rev": "94e10230939e702b4fa3fa2cb5c3bc7173b95d07",
+  "date": "2021-03-04T15:25:23-08:00",
+  "path": "/nix/store/0q3y4zhphdcc54qijbx2pdp8li9idk64-tree-sitter-css",
+  "sha256": "0y90nsfbh13mf33yahbk7zklbv7124rpm0v19qydz6nv1f9hpywd",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-embedded-template.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-embedded-template.json
new file mode 100644
index 000000000000..32459e77ef01
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-embedded-template.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-embedded-template",
+  "rev": "1c03594a44df1fc2020b989d503cb084abd5fd01",
+  "date": "2021-03-04T10:06:18-08:00",
+  "path": "/nix/store/09b9drfnywcy1i8wlw6slnn76ch40kqk-tree-sitter-embedded-template",
+  "sha256": "0c9l4i6kwb29zp05h616y3vk2hhcfc8bhdf9m436bk47pfy2zabg",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-fennel.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-fennel.json
new file mode 100644
index 000000000000..85e2f5e71b80
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-fennel.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/travonted/tree-sitter-fennel",
+  "rev": "bc689e2ef264e2cba499cfdcd16194e8f5fe87d2",
+  "date": "2021-03-09T16:47:45-05:00",
+  "path": "/nix/store/3h4j1mrqvn0ybqjalic92bnhk7c15442-tree-sitter-fennel",
+  "sha256": "1jm21bmsdrz9x5skqmx433q9b4mfi88gzc4la5hqps4is28inqms",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-fluent.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-fluent.json
new file mode 100644
index 000000000000..f40b8465b7db
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-fluent.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-fluent",
+  "rev": "858fdd6f1e81992e00d3541bfb31bac9365d7a47",
+  "date": "2018-06-18T13:00:38-07:00",
+  "path": "/nix/store/zbj8abdlrqi9swm8qn8rhpqmjwcz145f-tree-sitter-fluent",
+  "sha256": "0528v9w0cs73p9048xrddb1wpdhr92sn1sw8yyqfrq5sq0danr9k",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-go.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-go.json
new file mode 100644
index 000000000000..69d4869010f4
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-go.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-go",
+  "rev": "eb306e6e60f393df346cfc8cbfaf52667a37128a",
+  "date": "2021-05-04T14:03:16-07:00",
+  "path": "/nix/store/xgi4w5by155m1zqhqf2s7hmngy6sxdq3-tree-sitter-go",
+  "sha256": "03x3nkjxdfck9a4z2i50wq065vixqqk4v5w6fnd870q63v0zrc7c",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-haskell.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-haskell.json
new file mode 100644
index 000000000000..3dc04b3b08ad
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-haskell.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-haskell",
+  "rev": "2e33ffa3313830faa325fe25ebc3769896b3a68b",
+  "date": "2021-04-19T23:45:03+02:00",
+  "path": "/nix/store/75mc2mfs4sm21c871s5lm9djnjk90r7n-tree-sitter-haskell",
+  "sha256": "0np7mzi1na1qscdxsjpyw314iwcmpzzrx1v7fk3yxc70qwzjcpp1",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-html.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-html.json
new file mode 100644
index 000000000000..8c190011fd0f
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-html.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-html",
+  "rev": "d93af487cc75120c89257195e6be46c999c6ba18",
+  "date": "2021-03-04T14:11:18-08:00",
+  "path": "/nix/store/26yjfh6v17n4ajs9ln7x25sf1m3ijcjg-tree-sitter-html",
+  "sha256": "1hg7vbcy7bir6b8x11v0a4x0glvqnsqc3i2ixiarbxmycbgl3axy",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-java.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-java.json
new file mode 100644
index 000000000000..0856320ef59b
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-java.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-java",
+  "rev": "2efe37f92d2e6aeb25186e9da07455bb4a30163c",
+  "date": "2021-05-04T14:05:05-07:00",
+  "path": "/nix/store/bzljwaraqj6zqpq85cz9xb0vwh7c10yj-tree-sitter-java",
+  "sha256": "09v3xg1356ghc2n0yi8iqkp80lbkav0jpfgz8iz2j1sl7ihbvkyw",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-javascript.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-javascript.json
new file mode 100644
index 000000000000..c0411d15fb69
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-javascript.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-javascript",
+  "rev": "6c8cfae935f67dd9e3a33982e5e06be0ece6399a",
+  "date": "2021-05-11T09:51:32-07:00",
+  "path": "/nix/store/dhh1gz45l3h3p31jfg5fgy1kns1lbw6d-tree-sitter-javascript",
+  "sha256": "1mw6miw4yp6s1i0b08hflamfvrjdim4fnnj6fy461n05jp1s1i78",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-jsdoc.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-jsdoc.json
new file mode 100644
index 000000000000..94920e80442f
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-jsdoc.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-jsdoc",
+  "rev": "189a6a4829beb9cdbe837260653b4a3dfb0cc3db",
+  "date": "2021-03-04T14:39:14-08:00",
+  "path": "/nix/store/dpm11vziss6jbgp3dxvmgkb0dgg1ygc8-tree-sitter-jsdoc",
+  "sha256": "0qpsy234p30j6955wpjlaqwbr21bi56p0ln5vhrd84s99ac7s6b6",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-json.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-json.json
new file mode 100644
index 000000000000..ad00365e71ee
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-json.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-json",
+  "rev": "65bceef69c3b0f24c0b19ce67d79f57c96e90fcb",
+  "date": "2021-03-09T16:25:11-05:00",
+  "path": "/nix/store/bn5smxwwg4zzdc52wp2qb6s6yjdfi8mg-tree-sitter-json",
+  "sha256": "13p4ffmajirl9qh64d6qnng1gjnh5f6jkqbra0nlc1260nsf12hp",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-julia.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-julia.json
new file mode 100644
index 000000000000..ef319a1e33d7
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-julia.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-julia",
+  "rev": "12ea597262125fc22fd2e91aa953ac69b19c26ca",
+  "date": "2021-05-03T17:44:45-07:00",
+  "path": "/nix/store/lbz23r698hn7cha09qq0dbfay7dh74gg-tree-sitter-julia",
+  "sha256": "0rmd7k3rv567psxrlqv17gvckijs19xs6mxni045rpayxmk441sk",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-lua.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-lua.json
new file mode 100644
index 000000000000..9996ac8d917e
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-lua.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/Azganoth/tree-sitter-lua",
+  "rev": "a943944ec09c5e96f455bb166079de4ef3534457",
+  "date": "2020-12-27T00:15:24-03:00",
+  "path": "/nix/store/6glr8p3x58pva0nn586dk5jwb3bpgqrj-tree-sitter-lua",
+  "sha256": "0pm6wwb3kv73bfvvshdmvazcb1is5x1z6jwr31gz0niln18nqvpb",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-markdown.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-markdown.json
new file mode 100644
index 000000000000..0079a47810a3
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-markdown.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/ikatyang/tree-sitter-markdown",
+  "rev": "8b8b77af0493e26d378135a3e7f5ae25b555b375",
+  "date": "2021-04-18T20:49:21+08:00",
+  "path": "/nix/store/4z2k0q6rwqmb7vbqr4vgc26w28szlan3-tree-sitter-markdown",
+  "sha256": "1a2899x7i6dgbsrf13qzmh133hgfrlvmjsr3bbpffi1ixw1h7azk",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-nix.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-nix.json
new file mode 100644
index 000000000000..ff638a08baf0
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-nix.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/cstrahan/tree-sitter-nix",
+  "rev": "50f38ceab667f9d482640edfee803d74f4edeba5",
+  "date": "2021-04-27T17:21:51-05:00",
+  "path": "/nix/store/fhf3mvxg17g0xli59cgmmwqy4g21fbzj-tree-sitter-nix",
+  "sha256": "11gifb9b7x9v223hsrcb6wlkqpxbc4p5v4ny9aixzi9k8g0jhb3d",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ocaml.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ocaml.json
new file mode 100644
index 000000000000..fe6b149e0409
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ocaml.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-ocaml",
+  "rev": "0348562f385bc2bd67ecf181425e1afd6d454192",
+  "date": "2021-05-07T21:05:16+02:00",
+  "path": "/nix/store/s2499rsi28k0nrwx8wl2idsp86zsx2iz-tree-sitter-ocaml",
+  "sha256": "0iqmwcz3c2ai4gyx4xli1rhn6hi6a0f60dn20f8jas9ham9dc2df",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-php.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-php.json
new file mode 100644
index 000000000000..4ff38790b6f7
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-php.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-php",
+  "rev": "6a271f4075e11815e787df9055a950fb844ee63b",
+  "date": "2021-05-13T12:41:22+02:00",
+  "path": "/nix/store/n6hycd1scxa990xchk5h09ilxi7w18f5-tree-sitter-php",
+  "sha256": "1ijxc6brd0d35hr89ic8k5ispc6sj4mxln7bznd9n6zrgjvfdjqb",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-python.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-python.json
new file mode 100644
index 000000000000..1b6e562f85a6
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-python.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-python",
+  "rev": "d6210ceab11e8d812d4ab59c07c81458ec6e5184",
+  "date": "2021-03-27T09:41:53-07:00",
+  "path": "/nix/store/4v24ahydid4hr7kj0xi41mgbpglfnnki-tree-sitter-python",
+  "sha256": "173lpxi4vqa42dcdr9aj5phg5g6ny9ns04djw9n86pasx2w66dhk",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ql.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ql.json
new file mode 100644
index 000000000000..37b0d1532408
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ql.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-ql",
+  "rev": "965948cce9a94a710b1339851e0919471ad5ee2c",
+  "date": "2021-03-04T14:34:34-08:00",
+  "path": "/nix/store/4hi59c856ii2b79nv2wjib6qbp3hk24i-tree-sitter-ql",
+  "sha256": "01y1fzclwlaffx0rzg49h7kyvhhm25fba0w362n2y8hgjp3imgmg",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-razor.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-razor.json
new file mode 100644
index 000000000000..6905f4145aaf
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-razor.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-razor",
+  "rev": "60edbd8e798e416f5226a746396efa6a8614fa9b",
+  "date": "2016-07-08T15:17:50-07:00",
+  "path": "/nix/store/2vkxw48wc0xf07awi65r4rg2m1lpqq6c-tree-sitter-razor",
+  "sha256": "1ldsn9nxldxkxdy7irywx88d6a56q05f6907lypzass07piyqp2i",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-regex.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-regex.json
new file mode 100644
index 000000000000..6df921757bb8
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-regex.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-regex",
+  "rev": "3041aa3472d16fd94c6a9e15b741dbfecd9b714e",
+  "date": "2021-03-04T14:37:27-08:00",
+  "path": "/nix/store/7d200fzyx2rkbbgf47g5ismvd4id0fqy-tree-sitter-regex",
+  "sha256": "0jah3apalvp7966sjzdrka2n7f83h64sd56nbq2lzmrxgv98rxmg",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ruby.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ruby.json
new file mode 100644
index 000000000000..c8142974fd43
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-ruby.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-ruby",
+  "rev": "fe6a2d634da0e16b11b5aa255cc3df568a4572fd",
+  "date": "2021-03-03T16:54:30-08:00",
+  "path": "/nix/store/ragrvqj7hm98r74v5b3fljvc47gd3nhj-tree-sitter-ruby",
+  "sha256": "0m3h4928rbs300wcb6776h9r88hi32rybbhcaf6rdympl5nzi83v",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-rust.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-rust.json
new file mode 100644
index 000000000000..b83bcb258852
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-rust.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-rust",
+  "rev": "a360da0a29a19c281d08295a35ecd0544d2da211",
+  "date": "2021-03-27T09:50:22-07:00",
+  "path": "/nix/store/h4snh879ccy159fa390qr8l0nyaf5ndr-tree-sitter-rust",
+  "sha256": "0knaza3ww5h5w95hzdaalg5yrfpiv0r394q0imadxp5611132hxz",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-scala.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-scala.json
new file mode 100644
index 000000000000..b7c214cc720a
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-scala.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-scala",
+  "rev": "fb23ed9a99da012d86b7a5059b9d8928607cce29",
+  "date": "2021-04-01T10:11:15-07:00",
+  "path": "/nix/store/n1wvxkz4h38770lxvwakway34ac2a8h7-tree-sitter-scala",
+  "sha256": "05g95340g4labkdvfka5cbg7pr6vzigc40y54js1b5wml0w3d8f7",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-svelte.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-svelte.json
new file mode 100644
index 000000000000..41c4fcfe734d
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-svelte.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/Himujjal/tree-sitter-svelte",
+  "rev": "c696a13a587b0595baf7998f1fb9e95c42750263",
+  "date": "2021-03-20T16:45:11+05:30",
+  "path": "/nix/store/8krdxqwpi95ljrb5jgalwgygz3aljqr8-tree-sitter-svelte",
+  "sha256": "0ckmss5gmvffm6danlsvgh6gwvrlznxsqf6i6ipkn7k5lxg1awg3",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-swift.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-swift.json
new file mode 100644
index 000000000000..8f73380e3799
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-swift.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-swift",
+  "rev": "a22fa5e19bae50098e2252ea96cba3aba43f4c58",
+  "date": "2019-10-24T19:04:02-06:00",
+  "path": "/nix/store/pk5xk8yp6vanbar75bhfrs104w0k1ph0-tree-sitter-swift",
+  "sha256": "14b40lmwrnyvdz2wiv684kfh4fvqfhbj1dgrx81ppmy7hsz7jcq7",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-toml.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-toml.json
new file mode 100644
index 000000000000..a3d9bedd133b
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-toml.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/ikatyang/tree-sitter-toml",
+  "rev": "8bd2056818b21860e3d756b5a58c4f6e05fb744e",
+  "date": "2021-05-11T12:47:32+08:00",
+  "path": "/nix/store/isgpadcxmgkb14w9yg67pb8lx7wlfhnn-tree-sitter-toml",
+  "sha256": "0yasw5fp4mq6vzrdwlc3dxlss8a94bsffv4mzrfp0b3iw0s1dlyg",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-tsq.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-tsq.json
new file mode 100644
index 000000000000..918e87b38a42
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-tsq.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-tsq",
+  "rev": "b665659d3238e6036e22ed0e24935e60efb39415",
+  "date": "2021-05-18T15:57:40-04:00",
+  "path": "/nix/store/j59y4s3bsv6d5nbmhhdgb043hmk8157k-tree-sitter-tsq",
+  "sha256": "03bch2wp2jwxk69zjplvm0gbyw06qqdy7il9qkiafvhrbh03ayd9",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-typescript.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-typescript.json
new file mode 100644
index 000000000000..04ad785f76f9
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-typescript.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-typescript",
+  "rev": "28e757a2f498486931b3cb13a100a1bcc9261456",
+  "date": "2021-05-04T14:04:30-07:00",
+  "path": "/nix/store/d90hgv5g374a6mrwhq9vcxk6d6lp2ags-tree-sitter-typescript",
+  "sha256": "0dxy5h68hhypzq0z15q8iawjgw3kx7dlpw76zv6xkxh25idqgxqh",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-verilog.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-verilog.json
new file mode 100644
index 000000000000..5e4e14a95b37
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-verilog.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/tree-sitter/tree-sitter-verilog",
+  "rev": "1b624ab8b3f8d54ecc37847aa04512844f0226ac",
+  "date": "2021-03-31T21:27:26-07:00",
+  "path": "/nix/store/4j6hrf8bc8zjd7r9xnna9njpw0i4z817-tree-sitter-verilog",
+  "sha256": "0ygm6bdxqzpl3qn5l58mnqyj730db0mbasj373bbsx81qmmzkgzz",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-yaml.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-yaml.json
new file mode 100644
index 000000000000..8959c80f9f48
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-yaml.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/ikatyang/tree-sitter-yaml",
+  "rev": "0e36bed171768908f331ff7dff9d956bae016efb",
+  "date": "2021-05-11T12:47:24+08:00",
+  "path": "/nix/store/7d7m4zs4ydnwbn3xnfm3pvpy7gvkrmg8-tree-sitter-yaml",
+  "sha256": "0wyvjh62zdp5bhd2y8k7k7x4wz952l55i1c8d94rhffsbbf9763f",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-zig.json b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-zig.json
new file mode 100644
index 000000000000..97774bc58f61
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/grammars/tree-sitter-zig.json
@@ -0,0 +1,10 @@
+{
+  "url": "https://github.com/GrayJack/tree-sitter-zig",
+  "rev": "41bbc7f7b94bde3e948e41e4d42673945238ff03",
+  "date": "2021-03-30T12:55:10-03:00",
+  "path": "/nix/store/av4xgzr3c1rhr7v4fa9mm68krd2qv1lg-tree-sitter-zig",
+  "sha256": "0gjxac43qpqc4332bp3mpdbvh7rqv0q3hvw8834b30ml5q0r0qr0",
+  "fetchSubmodules": false,
+  "deepClone": false,
+  "leaveDotGit": false
+}
diff --git a/nixpkgs/pkgs/development/tools/parsing/tree-sitter/update.nix b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/update.nix
new file mode 100644
index 000000000000..168c9a0a403d
--- /dev/null
+++ b/nixpkgs/pkgs/development/tools/parsing/tree-sitter/update.nix
@@ -0,0 +1,225 @@
+{ writeShellScript, nix-prefetch-git, formats, lib
+, curl, jq, xe
+, src }:
+
+# Grammar list:
+# https://github.com/tree-sitter/tree-sitter/blob/master/docs/index.md
+
+let
+  # Grammars we want to fetch from the tree-sitter github orga
+  knownTreeSitterOrgGrammarRepos = [
+    "tree-sitter-javascript"
+    "tree-sitter-c"
+    "tree-sitter-swift"
+    "tree-sitter-json"
+    "tree-sitter-cpp"
+    "tree-sitter-ruby"
+    "tree-sitter-go"
+    "tree-sitter-c-sharp"
+    "tree-sitter-python"
+    "tree-sitter-typescript"
+    "tree-sitter-rust"
+    "tree-sitter-bash"
+    "tree-sitter-php"
+    "tree-sitter-java"
+    "tree-sitter-scala"
+    "tree-sitter-ocaml"
+    "tree-sitter-julia"
+    "tree-sitter-agda"
+    "tree-sitter-fluent"
+    "tree-sitter-html"
+    "tree-sitter-haskell"
+    "tree-sitter-regex"
+    "tree-sitter-css"
+    "tree-sitter-verilog"
+    "tree-sitter-jsdoc"
+    "tree-sitter-ql"
+    "tree-sitter-embedded-template"
+    "tree-sitter-tsq"
+  ];
+  knownTreeSitterOrgGrammarReposJson = jsonFile "known-tree-sitter-org-grammar-repos" knownTreeSitterOrgGrammarRepos;
+
+  # repos of the tree-sitter github orga we want to ignore (not grammars)
+  ignoredTreeSitterOrgRepos = [
+    "tree-sitter"
+    "tree-sitter-cli"
+    # this is the haskell language bindings, tree-sitter-haskell is the grammar
+    "haskell-tree-sitter"
+    # this is the ruby language bindings, tree-sitter-ruby is the grammar
+    "ruby-tree-sitter"
+    # this is the (unmaintained) rust language bindings, tree-sitter-rust is the grammar
+    "rust-tree-sitter"
+    # this is the nodejs language bindings, tree-sitter-javascript is the grammar
+    "node-tree-sitter"
+    # this is the python language bindings, tree-sitter-python is the grammar
+    "py-tree-sitter"
+    # afl fuzzing for tree sitter
+    "afl-tree-sitter"
+    # archived
+    "highlight-schema"
+    # website
+    "tree-sitter.github.io"
+    # not maintained
+    "tree-sitter-razor"
+    # rust library for constructing arbitrary graph structures from source code
+    "tree-sitter-graph"
+  ];
+  ignoredTreeSitterOrgReposJson = jsonFile "ignored-tree-sitter-org-repos" ignoredTreeSitterOrgRepos;
+
+  # Additional grammars that are not in the official github orga.
+  # If you need a grammar that already exists in the official orga,
+  # make sure to give it a different name.
+  otherGrammars = {
+    "tree-sitter-nix" = {
+      orga = "cstrahan";
+      repo = "tree-sitter-nix";
+    };
+    "tree-sitter-lua" = {
+      orga = "Azganoth";
+      repo = "tree-sitter-lua";
+    };
+    "tree-sitter-fennel" = {
+      orga = "travonted";
+      repo = "tree-sitter-fennel";
+    };
+    "tree-sitter-markdown" = {
+      orga = "ikatyang";
+      repo = "tree-sitter-markdown";
+    };
+    "tree-sitter-svelte" = {
+      orga = "Himujjal";
+      repo = "tree-sitter-svelte";
+    };
+    "tree-sitter-yaml" = {
+      orga = "ikatyang";
+      repo = "tree-sitter-yaml";
+    };
+    "tree-sitter-toml" = {
+      orga = "ikatyang";
+      repo = "tree-sitter-toml";
+    };
+    "tree-sitter-zig" = {
+      orga = "GrayJack";
+      repo = "tree-sitter-zig";
+    };
+  };
+
+  allGrammars =
+    let
+      treeSitterOrgaGrammars =
+        lib.listToAttrs (map (repo:
+          { name = repo;
+            value = {
+              orga = "tree-sitter";
+              inherit repo;
+            };
+          })
+        knownTreeSitterOrgGrammarRepos);
+
+    in
+      mergeAttrsUnique otherGrammars treeSitterOrgaGrammars;
+
+  # TODO: move to lib
+  mergeAttrsUnique = left: right:
+    let intersect = lib.intersectLists (lib.attrNames left) (lib.attrNames right); in
+    assert
+      lib.assertMsg (intersect == [])
+        (lib.concatStringsSep "\n" [
+          "mergeAttrsUnique: keys in attrset overlapping:"
+          "left: ${lib.generators.toPretty {} (lib.getAttrs intersect left)}"
+          "right: ${lib.generators.toPretty {} (lib.getAttrs intersect right)}"
+        ]);
+    left // right;
+
+
+
+  jsonFile = name: val: (formats.json {}).generate name val;
+
+  # check the tree-sitter orga repos
+  checkTreeSitterRepos = writeShellScript "get-grammars.sh" ''
+    set -euo pipefail
+    res=$(${jq}/bin/jq \
+      --slurpfile known "${knownTreeSitterOrgGrammarReposJson}" \
+      --slurpfile ignore "${ignoredTreeSitterOrgReposJson}" \
+      '. - ($known[0] + $ignore[0])' \
+      )
+    if [ ! "$res" == "[]" ]; then
+      echo "These repositories are neither known nor ignored:" 1>&2
+      echo "$res" 1>&2
+      exit 1
+    fi
+  '';
+
+  # TODO
+  urlEscape = x: x;
+
+  # generic bash script to find the latest github release for a repo
+  latestGithubRelease = { orga, repo }: writeShellScript "latest-github-release" ''
+    set -euo pipefail
+    res=$(${curl}/bin/curl \
+      --silent \
+      "https://api.github.com/repos/${urlEscape orga}/${urlEscape repo}/releases/latest")
+    if [[ "$(printf "%s" "$res" | ${jq}/bin/jq '.message?')" =~ "rate limit" ]]; then
+      echo "rate limited" >&2
+    fi
+    release=$(printf "%s" "$res" | ${jq}/bin/jq '.tag_name')
+    # github sometimes returns an empty list even tough there are releases
+    if [ "$release" = "null" ]; then
+      echo "uh-oh, latest for ${orga + "/" + repo} is not there, using HEAD" >&2
+      release="HEAD"
+    fi
+    echo "$release"
+  '';
+
+  # find the latest repos of a github organization
+  latestGithubRepos = { orga }: writeShellScript "latest-github-repos" ''
+    set -euo pipefail
+    res=$(${curl}/bin/curl \
+      --silent \
+      'https://api.github.com/orgs/${urlEscape orga}/repos?per_page=100')
+
+    if [[ "$(printf "%s" "$res" | ${jq}/bin/jq '.message?')" =~ "rate limit" ]]; then
+      echo "rate limited" >&2   #
+    fi
+
+    printf "%s" "$res" | ${jq}/bin/jq 'map(.name)' \
+      || echo "failed $res"
+  '';
+
+  # update one tree-sitter grammar repo and print their nix-prefetch-git output
+  updateGrammar = { orga, repo }: writeShellScript "update-grammar.sh" ''
+    set -euo pipefail
+    latest="$(${latestGithubRelease { inherit orga repo; }})"
+    echo "Fetching latest release ($latest) of ${repo} …" >&2
+    ${nix-prefetch-git}/bin/nix-prefetch-git \
+      --quiet \
+      --no-deepClone \
+      --url "https://github.com/${urlEscape orga}/${urlEscape repo}" \
+      --rev "$latest"
+    '';
+
+  foreachSh = attrs: f:
+    lib.concatMapStringsSep "\n" f
+    (lib.mapAttrsToList (k: v: { name = k; } // v) attrs);
+
+  update-all-grammars = writeShellScript "update-all-grammars.sh" ''
+    set -euo pipefail
+    echo "fetching list of grammars" 1>&2
+    treeSitterRepos=$(${latestGithubRepos { orga = "tree-sitter"; }})
+    echo "checking the tree-sitter repo list against the grammars we know" 1>&2
+    printf '%s' "$treeSitterRepos" | ${checkTreeSitterRepos}
+    outputDir="${toString ./.}/grammars"
+    echo "writing files to $outputDir" 1>&2
+    mkdir -p "$outputDir"
+    ${foreachSh allGrammars
+      ({name, orga, repo}: ''${updateGrammar { inherit orga repo; }} > $outputDir/${name}.json'')}
+    ( echo "{"
+      ${foreachSh allGrammars
+        ({name, ...}: ''
+           # indentation hack
+             printf "  %s = (builtins.fromJSON (builtins.readFile ./%s.json));\n" "${name}" "${name}"'')}
+      echo "}" ) \
+      > "$outputDir/default.nix"
+  '';
+
+in update-all-grammars