This repository contains the Python implementation of mdl, an ML-inspired
language used as an intermediate representation for normative provisions. The
language separates ordinary pure computations, LTLf temporal formulas, and
defeasible deontic rules.
The project lives in mdl/:
- command-line utility:
mdl; - parser and typed AST dataclasses;
- pretty-printer / formatter;
- translator to a JSON-like DDL-LTLf core;
- bounded Z3 solver for consistency checks;
- deterministic runtime for evaluating pure functions and facts;
- linter and stdio LSP server;
- semantic aligner;
- tests for the core language constructs.
The MCP adapter lives in mdl-mcp/. It exposes mdl-mcp for
LLM-assisted verification without adding MCP server dependencies to the core
mdl package.
Editor integrations live under editor-support/:
editor-support/vscode-extension/- VS Code extension with TextMate highlighting and LSP wiring;editor-support/tree-sitter-grammar/- Tree-sitter grammar scaffold.
mdl development builds are published to TestPyPI after successful master
builds. Install the latest test build with:
python -m pip install --extra-index-url https://test.pypi.org/simple/ mprokazin-mdl
mdl --versionUse --extra-index-url instead of replacing the main index so third-party
dependencies can still be resolved from PyPI.
After a successful master build, GitHub Actions publishes a VSIX artifact from
the VS Code VSIX workflow. Download the mdl-language-support-vsix-* artifact
from the workflow run, unzip it, and install the contained .vsix file:
code --install-extension mdl-language-support-0.0.0-<version-label>.vsixThe extension starts mdl lsp by default, so install the Python package first
and make sure the mdl command is available in the VS Code environment.
nix develop
cd mdl
python -m pip install -e '.[dev]'
pytestBuild the VS Code extension from its own directory:
cd editor-support/vscode-extension
make buildUseful CLI examples:
cd mdl
mdl parse examples/email.mdl
mdl parse examples/pipe.mdl.py
mdl format examples/email.mdl
mdl lint examples/pipe.mdl.py
mdl translate examples/email.mdl
mdl run examples/pipe.mdl.py --expr 'pipe.length > 0'
mdl align examples/pipe.mdl.py examples/tube.mdl
mdl solve examples/pipe.mdl examples/tube.mdl examples/alignment.mdl --horizon 1
mdl lsp