LPG2 (Lookahead Parser Generator v2) compiles .g / .lpg grammars into parse tables and semantic-action code for your target language.
Current version: 2.3.0 (lpg-v2.3.0)
Docs are layered by audience. New to LPG? Start with the Quick Start.
| Document | Audience | Contents |
|---|---|---|
| Quick Start (5 min) | Beginners | Download/build generator → run calculator |
| Concepts | Beginners | How generator / templates / runtime fit together |
| Tutorial | Beginners | Step-by-step calculator grammar |
| User guide | Grammar authors, integrators | Tooling, CLI, languages, runtimes, FAQ |
| Developer guide | Generator maintainers | Build, layout, bootstrap, tests, backends |
| AI / Agent playbook | AI coding agents | Workflow, CLI, language matrix, anti-patterns (AGENTS.md) |
| Chinese docs | 中文读者 | 上手 / 概念 / 教程 / USER / AI 等 |
| Contributing | Contributors | Build, goldens, PR process |
| Doc index | — | Pick a path by role |
| Ecosystem | Integrators / release | Runtime versions, package coords, release checklist |
Topics:
- Grammar reference (EN summary) · full Chinese
- Bootstrap policy — regenerating
jikespg_*parsers - Machine-readable matrix: ecosystem/compat.json
| Path | Role |
|---|---|
lpg2/ |
Generator sources |
runtime/ |
Language runtimes (git submodules) |
tool/ |
VS Code extension and language server (submodules) |
grammars-example/ |
Example grammars (submodule) |
examples/calculator/ |
Runnable calculator starter |
docs/ |
Documentation (docs/en/ default; Chinese alongside) |
Fastest: npm
npx lpg2 --help
npx lpg2 -programming_language=java -table your.gBrowser playground (WASM, built by CI): playground/.
The C++ runtime provides token-level re-lex + statement-level re-parse (not tree-sitter subtree reuse); see USER.md / ECOSYSTEM.md.
Recommended: Release binary + calculator
- Download a platform archive from GitHub Releases and verify
SHA256SUMS - Init the runtime submodule for your language (e.g. Java):
git submodule update --init runtime/lpg-runtime
export LPG_BIN=/path/to/bin/lpg-v2.3.0
./examples/calculator/scripts/run.sh javaFull steps: docs/en/QUICKSTART.md.
Or build the generator from source:
cd lpg2
cmake -S . -B build && cmake --build build -j
export LPG_BIN="$PWD/build/lpg-v2.3.0"
cd ..
./examples/calculator/scripts/run.sh javaIntegration and CLI details: user guide.
- LPG-rust-runtime — Rust parse runtime
- LPG2-grammars-example — grammar examples
- LPG-VScode — VS Code extension