Thank you for your interest in contributing! Here is everything you need to get started.
- Go 1.22+
- Node.js 18+ — only needed to rebuild the VS Code extension
- Graphviz — only needed to render
.dotfiles to PNG/SVG
git clone https://github.com/<your-org>/lexscript.git
cd lexscript
make build # compiles → bin/lexs (bin/lexs.exe on Windows)
make setup # build + install VS Code extensionmake testmake validate-rental
make compile-rental
make compile-rental-pdf
make visualize-rentalcmd/ CLI subcommands (compile, fmt, parse, validate, visualize, lsp, serve)
pkg/
ast/ Lexer + parser (participle/v2 struct-tag grammar)
semantic/ Five-pass semantic validator (accumulates all errors)
codegen/ Markdown + PDF backends; jurisdiction clause library
format/ Source formatter
visualize/ Graphviz DOT emitter
lsp/ LSP server (diagnostics, hover, completion, definition)
playground/ Web playground HTTP server + embedded static assets
grammar/ Formal EBNF grammar (keep in sync with ast/ast.go)
vscode-extension/ VS Code extension (TypeScript)
examples/ Sample .lxs contracts with generated outputs
- Add the AST node struct with
participle/v2parser tags topkg/ast/ast.go. - Update
grammar/grammar.ebnfto reflect the new grammar rule. - Add validation logic to
pkg/semantic/validate.go— accumulate errors, never short-circuit. - Add fields to the relevant
*Datastruct inpkg/codegen/emitter.goand updatepkg/codegen/templates/contract.md.tmpl. - Update the formatter in
pkg/format/format.go. - Update the LSP hover/completion tables in
pkg/lsp/hover.goandpkg/lsp/completion.go.
Edit pkg/codegen/jurisdiction.go and add a new case to the JurisdictionClauses function following the existing pattern.
Edit pkg/codegen/templates/contract.md.tmpl. The template is embedded at compile time via //go:embed — no extra build step needed.
- Go:
gofmt-formatted. Rungo fmt ./...before committing. - TypeScript: Use
tscto verify compilation. Runnpm run compileinsidevscode-extension/. - Semantic validator: Never add early returns — all five passes must always run to completion.
- Error messages: Include the
(REQ-x.x)tag for errors tied to an SRS requirement.
- Keep PRs focused — one logical change per PR.
- Include a short description of why the change is needed, not just what it does.
- Regenerate example outputs if you change the compiler or templates:
make compile-rental compile-software make visualize-rental visualize-software
- Do not implement the items listed under Planned but Not Yet Implemented in
.github/copilot-instructions.mdwithout discussion — they conflict with planned architecture decisions.
Open a GitHub issue with:
- The
.lxssource that reproduces the problem (or a minimal repro). - The command you ran and the full output.
- Your OS and Go version (
go version).