github /semantic

Parsing, analyzing, and comparing source code across many languages

★ 9,041⑂ 469👁 93⑃ 422● 274▤ 9
HaskellCreated 2019-03-15
下载:sha_c1486db42dcbcc0a7748fc759017ab8d30d0f2d1sha_c1486db42dcbcc0a7748fc759017ab8d30d0f2d1 ↓12019-08-26
+0
日增长
9,041
stars
469
forks
93
watchers
422
prs
274
issues
9
releases

README

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][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][nix] for development. To get started quickly:

bash
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.

 bash
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

Latest release

sha_c1486db42dcbcc0a7748fc759017ab8d30d0f2d1 sha_c1486db42dcbcc0a7748fc759017ab8d30d0f2d1 2019-08-26

Snapshot: 2026-11-16T09:23:14Z · Data license Apache-2.0 · JSON