github.com/github/semantic

Parsing, analyzing, and comparing source code across many languages

Open this visualization on its own page →

Contributors

42

Lines of Code

95,953

From

2015-07-18

To

2020-11-05

About github/semantic

Semantic is a Haskell library and command-line tool for parsing, analyzing, and comparing source code across multiple programming languages. It generates language-specific syntax types based on tree-sitter grammar definitions and can read source code from the filesystem or protocol buffer requests, then perform various analyses and render output in multiple formats.

The tool supports parsing and AST symbol extraction for a broad range of languages including Ruby, JavaScript, TypeScript, Python, Go, PHP, Java, JSON, JSX, TSX, CodeQL, and Haskell, with varying levels of feature completeness across languages. Some languages have partial support for advanced features like stack graphs, which are still under development. The project leverages sophisticated algorithms for code comparison and analysis, including Myers' difference algorithm, RWS-Diff for hierarchical data change detection, and advanced functional programming techniques like data types à la carte and definitional interpreters.

As of the repository's last update, GitHub has discontinued official support and maintenance, encouraging users to fork the code if they wish to continue development. The project requires GHC 8.10.1 and Cabal 3.0 at minimum and officially supports Unix systems only, though Docker images are available for other platforms. Development can be conducted using either Cabal or Bazel build systems, with unofficial Stack support available separately.

Share this video