GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - github/semantic: Parsing, analyzing, and comparing source code across many languages

This repository was archived by the owner on Apr 1, 2025. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

34,713 Commits
34,713 Commits

Folders and files

NameName
Last commit message
Last commit date
.github/workflows
.github/workflows
 
 
.licenses/semantic/cabal
.licenses/semantic/cabal
 
 
bin
bin
 
 
build
build
 
 
docs
docs
 
 
notices
notices
 
 
proto
proto
 
 
script
script
 
 
semantic-analysis
semantic-analysis
 
 
semantic-ast
semantic-ast
 
 
semantic-codeql
semantic-codeql
 
 
semantic-go
semantic-go
 
 
semantic-java
semantic-java
 
 
semantic-json
semantic-json
 
 
semantic-parse
semantic-parse
 
 
semantic-php
semantic-php
 
 
semantic-proto
semantic-proto
 
 
semantic-python
semantic-python
 
 
semantic-ruby
semantic-ruby
 
 
semantic-rust
semantic-rust
 
 
semantic-scope-graph
semantic-scope-graph
 
 
semantic-source
semantic-source
 
 
semantic-tags
semantic-tags
 
 
semantic-tsx
semantic-tsx
 
 
semantic-typescript
semantic-typescript
 
 
semantic
semantic
 
 
.bazelignore
.bazelignore
 
 
.bazelrc
.bazelrc
 
 
.dockerignore
.dockerignore
 
 
.ghci.repl
.ghci.repl
 
 
.ghci.sample
.ghci.sample
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
.hlint.yaml
.hlint.yaml
 
 
.hspec
.hspec
 
 
.stylish-haskell.yaml
.stylish-haskell.yaml
 
 
BUILD.bazel
BUILD.bazel
 
 
CODEOWNERS
CODEOWNERS
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
Dockerfile
Dockerfile
 
 
HACKING.md
HACKING.md
 
 
README.md
README.md
 
 
WORKSPACE
WORKSPACE
 
 
cabal.project
cabal.project
 
 
cabal.project.ci
cabal.project.ci
 
 
hie.yaml
hie.yaml
 
 
stack-snapshot.yaml
stack-snapshot.yaml
 
 
stackage_snapshot.json
stackage_snapshot.json
 
 

Repository files navigation

NOTE: This repository is no longer supported or updated by GitHub. If you wish to continue to develop this code yourself, we recommend you fork it.

Semantic

semantic is a Haskell library and command line tool for parsing, analyzing, and comparing source code.

In a hurry? Check out our documentation of example uses for the semantic command line tool.

Table of Contents
Usage
Language support
Development
Technology and architecture
Licensing

Usage

Run semantic --help for complete list of up-to-date options.

Parse

Usage: semantic parse [--sexpression | (--json-symbols|--symbols) |
                        --proto-symbols | --show | --quiet] [FILES...]
  Generate parse trees for path(s)

Available options:
  --sexpression            Output s-expression parse trees (default)
  --json-symbols,--symbols Output JSON symbol list
  --proto-symbols          Output protobufs symbol list
  --show                   Output using the Show instance (debug only, format
                           subject to change without notice)
  --quiet                  Don't produce output, but show timing stats
  -h,--help                Show this help text

Language support

Language Parse AST Symbols† Stack graphs
Ruby ✅ ✅
JavaScript ✅ ✅
TypeScript ✅ ✅ 🚧
Python ✅ ✅ 🚧
Go ✅ ✅
PHP ✅ ✅
Java 🚧 ✅
JSON ✅ ⬜️ ⬜️
JSX ✅ ✅
TSX ✅ ✅
CodeQL ✅ ✅
Haskell 🚧 🚧

† Used for code navigation on github.com.

  • ✅ — Supported
  • 🔶 — Partial support
  • 🚧 — Under development
  • ⬜ - N/A ️

Development

semantic requires at least GHC 8.10.1 and Cabal 3.0. We strongly recommend using ghcup to sandbox GHC versions, as GHC packages installed through your OS's package manager may not install statically-linked versions of the GHC boot libraries. semantic currently builds only on Unix systems; users of other operating systems may wish to use the Docker images.

We use cabal's Nix-style local builds for development. To get started quickly:

git clone [email protected]:github/semantic.git
cd semantic
script/bootstrap
cabal v2-build all
cabal v2-run semantic:test
cabal v2-run semantic:semantic -- --help

You can also use the Bazel build system for development. To learn more about Bazel and why it might give you a better development experience, check the build documentation.

git clone [email protected]:github/semantic.git
cd semantic
script/bootstrap-bazel
bazel build //...

stack as a build tool is not officially supported; there is unofficial stack.yaml support available, though we cannot make guarantees as to its stability.

Technology and architecture

Architecturally, semantic:

  1. Generates per-language Haskell syntax types based on tree-sitter grammar definitions.
  2. Reads blobs from a filesystem or provided via a protocol buffer request.
  3. Returns blobs or performs analysis.
  4. Renders output in one of many supported formats.

Throughout its lifecycle, semantic has leveraged a number of interesting algorithms and techniques, including:

  • Myers' algorithm (SES) as described in the paper An O(ND) Difference Algorithm and Its Variations
  • RWS as described in the paper RWS-Diff: Flexible and Efficient Change Detection in Hierarchical Data.
  • Open unions and data types à la carte.
  • An implementation of Abstracting Definitional Interpreters extended to work with an à la carte representation of syntax terms.

Contributions

Contributions are welcome! Please see our contribution guidelines and our code of conduct for details on how to participate in our community.

Licensing

Semantic is licensed under the MIT license.

About

Parsing, analyzing, and comparing source code across many languages

Topics

keep

Resources

Readme

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

9.0k stars

Watchers

93 watching

Forks

469 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.