explaingit

github/semantic

9,051HaskellAudience · developerComplexity · 4/5Setup · hard

TLDR

A Haskell library and CLI tool originally built by GitHub for parsing source code, extracting symbols like function names, and comparing file versions across many languages, now abandoned and no longer maintained.

Mindmap

mindmap
  root((semantic))
    What It Does
      Parse source code
      Extract symbols
      Compare file versions
    Tech Stack
      Haskell
      tree-sitter
    Languages Supported
      Python JavaScript
      Ruby Go PHP
    Output Formats
      JSON symbols
      Code tree
      Parse stats
    Status
      Abandoned
      No updates
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Parse a Python or JavaScript source file to extract all function and class names as a JSON list.

USE CASE 2

Compare two versions of a source file to get a structured diff showing exactly what code changed.

USE CASE 3

Generate a tree representation of code structure for languages like Ruby, Go, or TypeScript.

USE CASE 4

Produce binary or JSON symbol indexes from source files for code navigation tooling.

Tech stack

Haskelltree-sitter

Getting it running

Difficulty · hard Time to first run · 1day+

Requires Haskell tooling most developers do not have installed, multi-step build process with no prebuilt binaries.

License not specified in the explanation.

In plain English

Semantic is a library and command line tool, originally built by GitHub, for reading and analyzing source code written in various programming languages. It can parse code (meaning it reads the text and builds a structured representation of what the code means), extract symbols like function and class names, and compare two versions of a file to understand what changed. GitHub used this internally to power code navigation features on github.com, such as jumping to a function definition or seeing all references to a variable. The tool supports a range of programming languages including Python, JavaScript, TypeScript, Ruby, Go, PHP, and others, with varying levels of support for each. For each language, it can produce different kinds of output: a tree showing the structure of the code, a list of symbols in JSON or binary format, or statistics about how long parsing took. You run it from the command line by pointing it at one or more source code files. Under the hood, Semantic is written in Haskell and uses tree-sitter, a separate tool for building language parsers, as its foundation. Building and running it requires Haskell tooling that many developers will not already have set up, and the setup process involves several steps. This repository is no longer maintained by GitHub. The project has been abandoned and will not receive further updates or bug fixes. GitHub has recommended that anyone who wants to continue developing it should create their own copy. If you are looking for active code analysis tools, this project is not a good choice in its current state.

Copy-paste prompts

Prompt 1
Using GitHub's semantic CLI tool in Haskell, write a command that parses a Python source file and prints a JSON list of all function and class names found in it.
Prompt 2
Set up the semantic CLI on macOS to compare two versions of a JavaScript file and output a structured diff showing what changed between them.
Prompt 3
Show me how to use the semantic library to build a tree-sitter-backed symbol extractor for Go source code files and output the result as a JSON tree.
Open on GitHub → Explain another repo

← github on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.