# github/semantic

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/github-semantic).**

9,041 stars · 459 forks · Haskell · archived

## Links

- GitHub: https://github.com/github/semantic
- awesome-repositories: https://awesome-repositories.com/repository/github-semantic.md

## Description

Semantic is a Haskell-based library and command-line tool designed for polyglot source code analysis. It functions as a static program analysis framework and a polyglot abstract syntax tree parser that converts multiple programming languages into structured syntax trees based on grammar definitions.

The system distinguishes itself through a semantic code comparison engine that detects structural and meaningful changes between code versions rather than relying on textual differences. It further enables analysis across different programming syntaxes by translating surface languages into a unified polyglot intermediate representation.

The framework provides a broad suite of capabilities for parsing languages such as Rust, Go, Python, Ruby, PHP, TypeScript, and TSX. It covers semantic analysis through code scope mapping, symbol extraction, and the generation of semantic graphs, alongside tools for pattern analysis and program behavior evaluation.

The toolset includes command-line utilities for standardizing Haskell source file layouts.

## Tags

### Part of an Awesome List

- [Semantic Code Analyzers](https://awesome-repositories.com/f/awesome-lists/devtools/code-analysis-and-linting/semantic-code-analyzers.md) — Implements semantic analysis to produce graphs and scope information by examining relationships and meanings within source code. ([source](https://github.com/github/semantic/blob/main/cabal.project))
- [Static Analysis Frameworks](https://awesome-repositories.com/f/awesome-lists/devtools/static-analysis-frameworks.md) — Provides a framework for mapping code scopes and extracting symbols to analyze program behavior.
- [Developer Utilities](https://awesome-repositories.com/f/awesome-lists/devtools/developer-utilities.md) — Tool for parsing and analyzing source code.

### Data & Databases

- [Code Symbol Extractors](https://awesome-repositories.com/f/data-databases/document-extraction-tools/code-symbol-extractors.md) — Provides specialized tools for identifying and indexing named identifiers and types within source code files. ([source](https://github.com/github/semantic/blob/main/docs/examples.md))

### Development Tools & Productivity

- [Code Version Comparisons](https://awesome-repositories.com/f/development-tools-productivity/code-version-comparisons.md) — Identifies structural and meaning-based changes between versions of source code instead of relying on simple text diffs. ([source](https://github.com/github/semantic/blob/main/cabal.project))
- [Scope-Aware Graphs](https://awesome-repositories.com/f/development-tools-productivity/dependency-analysis-tools/code-dependency-analysis/static-dependency-resolution/graph-analysis-tools/semantic-graph-analyzers/scope-aware-graphs.md) — Analyzes identifier visibility and accessibility to construct graphs mapping the relationships and meanings within a codebase.
- [Lexical Scope Analysis](https://awesome-repositories.com/f/development-tools-productivity/dynamic-variable-evaluators/scope-resolution-rules/lexical-scope-analysis.md) — Analyzes abstract syntax trees to determine the visibility and accessibility of identifiers across different scopes. ([source](https://github.com/github/semantic/tree/main/semantic-scope-graph))
- [Symbol Indexing](https://awesome-repositories.com/f/development-tools-productivity/symbol-indexing.md) — Identifies and indexes named identifiers and types from source code to facilitate fast navigation and lookup.
- [Analysis Data Modeling](https://awesome-repositories.com/f/development-tools-productivity/protobuf-code-generators/analysis-data-modeling.md) — Uses protobuf schemas to define and generate structured data types for representing source code and semantic analysis results.

### Programming Languages & Runtimes

- [Intermediate Representation Translation](https://awesome-repositories.com/f/programming-languages-runtimes/intermediate-representation-translation.md) — Translates multiple surface languages into a unified internal language to enable consistent analysis across different programming syntaxes.
- [Polyglot AST Parsers](https://awesome-repositories.com/f/programming-languages-runtimes/polyglot-ast-parsers.md) — Converts multiple programming languages into structured syntax trees based on formal grammar definitions.
- [Polyglot Source Code Analyzers](https://awesome-repositories.com/f/programming-languages-runtimes/programming-utilities/data-structure-type-helpers/data-structures/hierarchical-tree-structures/source-code-abstract-syntax-trees/polyglot-source-code-analyzers.md) — Provides a library and CLI for parsing source code into abstract syntax trees and semantic graphs.
- [Polyglot Analyzers](https://awesome-repositories.com/f/programming-languages-runtimes/source-code-analysis-tools/polyglot-analyzers.md) — Parses multiple programming languages into a unified format to analyze semantics and behavior across different files.
- [Source File Parsing](https://awesome-repositories.com/f/programming-languages-runtimes/source-file-parsing.md) — Converts source code from files or strings into abstract syntax trees using grammar definitions for multiple languages. ([source](https://github.com/github/semantic/tree/main/semantic-parse))
- [Typed Abstract Syntax Trees](https://awesome-repositories.com/f/programming-languages-runtimes/typed-abstract-syntax-trees.md) — Produces strongly typed abstract syntax trees from language definitions to enable structured static analysis. ([source](https://github.com/github/semantic/tree/main/semantic-ast))
- [Go Parsers](https://awesome-repositories.com/f/programming-languages-runtimes/go-parsers.md) — Parses and analyzes Go source code to extract semantic information for processing or comparison. ([source](https://github.com/github/semantic/tree/main/semantic-go))
- [Language Representation Types](https://awesome-repositories.com/f/programming-languages-runtimes/language-features-paradigms/language-features/language-extensions/union-types/type-safe-variants/type-safe-data-structures/language-representation-types.md) — Automates the creation of strongly typed Haskell data structures to represent language-specific syntax and semantics.
- [PHP Parsers](https://awesome-repositories.com/f/programming-languages-runtimes/php-parsers.md) — Analyzes PHP code to produce a structured representation for programmatic analysis and comparison. ([source](https://github.com/github/semantic/tree/main/semantic-php))
- [Program Behavior Analysis](https://awesome-repositories.com/f/programming-languages-runtimes/program-behavior-analysis.md) — Analyzes source code by interpreting an intermediate language to extract program behavior and properties. ([source](https://github.com/github/semantic/tree/main/semantic-analysis))
- [Python AST Parsing](https://awesome-repositories.com/f/programming-languages-runtimes/python-ast-parsing.md) — Analyzes Python code to extract structured semantic information for use in program analysis or comparison. ([source](https://github.com/github/semantic/tree/main/semantic-python))
- [Ruby Parsers](https://awesome-repositories.com/f/programming-languages-runtimes/ruby-parsers.md) — Analyzes Ruby source files to extract structural information and semantic data for code analysis. ([source](https://github.com/github/semantic/tree/main/semantic-ruby))
- [TSX Parsers](https://awesome-repositories.com/f/programming-languages-runtimes/tsx-parsers.md) — Analyzes TypeScript JSX files to extract a structured representation of the source code for study. ([source](https://github.com/github/semantic/tree/main/semantic-tsx))
- [TypeScript Parsers](https://awesome-repositories.com/f/programming-languages-runtimes/typescript-parsers.md) — Converts TypeScript code into a structured representation for programmatic analysis and comparison. ([source](https://github.com/github/semantic/tree/main/semantic-typescript))

### Software Engineering & Architecture

- [Code Analysis Tools](https://awesome-repositories.com/f/software-engineering-architecture/code-analysis-tools.md) — Provides structural indexing and symbol extraction to facilitate codebase navigation and logic understanding. ([source](https://github.com/github/semantic#readme))
- [Abstract Syntax Tree Generation](https://awesome-repositories.com/f/software-engineering-architecture/integration-extensibility/extensibility/plugin-architectures/domain-specific/language-support-definitions/language-parsing-rules/abstract-syntax-tree-generation.md) — Converts raw source code into typed tree representations for deep structural analysis and developer tooling.
- [Structural Comparison Tools](https://awesome-repositories.com/f/software-engineering-architecture/structural-comparison-tools.md) — Detects changes between versions of structured code using specialized tree difference algorithms. ([source](https://github.com/github/semantic/blob/main/README.md))
- [AST Generators](https://awesome-repositories.com/f/software-engineering-architecture/trees/syntax-tree-construction/formal-grammar-parser-generators/ast-generators.md) — Produces strongly typed abstract syntax trees by applying formal language grammar definitions to raw source text.
- [Rust Parsers](https://awesome-repositories.com/f/software-engineering-architecture/abstract-syntax-tree-parsing/rust-parsers.md) — Analyzes Rust source code to extract semantic information and structure for further processing. ([source](https://github.com/github/semantic/tree/main/semantic-rust))

### User Interface & Experience

- [AST Difference Algorithms](https://awesome-repositories.com/f/user-interface-experience/node-based-ui-components/virtual-node-trees/tree-reconciliation-algorithms/ast-difference-algorithms.md) — Employs specialized tree-based diffing to identify structural and semantic changes between hierarchical versions of source code.

### Artificial Intelligence & ML

- [Static Analysis Pattern Matching](https://awesome-repositories.com/f/artificial-intelligence-ml/pattern-matching-engines/static-analysis-pattern-matching.md) — Identifies structural patterns and potential vulnerabilities within a codebase using static analysis. ([source](https://github.com/github/semantic/tree/main/semantic-codeql))
