C++20 language engineering toolkit
Bring language engineering to modern C++.
Pegium is an open source toolkit for building textual languages with first-class support for parsing, AST/CST construction, references, validation, formatting, and language-server features.
Why Pegium?¶
-
Semantics first
Shape your language's semantic model directly through C++ AST types and grammar assignments, with CST data still available for source-aware tooling.
-
Lean by default
Start from
makeDefaultServices(...), keep the default LSP and workspace behavior, and override only the language-specific parts. -
Parser to editor
Use one document model for parsing, linking, diagnostics, formatting, completion, rename, references, and other editor features.
-
Examples that scale
Use
arithmetics,domainmodel,requirements, andstatemachineas real starting points, not isolated API snippets.
Start here¶
-
Get the high-level picture, then branch into features, showcases, or deeper concepts. Want to jump straight in? Build a language end-to-end in the walkthrough.
-
Follow the recommended path from repository build to grammar, AST, references, validation, formatting, and editor services.
-
Focused guides for common customization tasks: scoping, validation, caching, multiple languages, and LSP overrides.
-
Canonical subsystem pages for grammar, semantic model, services, workspace, and document lifecycle concepts.
-
Browse complete example languages and pick the best starting point for your project.
Related pages¶
Documentation and examples live in the main repository, so the code and docs stay close together.