wp-lang
Overview
wp-lang is the standalone WPL language crate from the Warp Parse stack. It contains the WPL AST, parser, runtime evaluator, built-in value parsers, preprocessing hooks, and generation utilities needed to parse and execute WPL rules.
The crate sits above wp-primitives: wp-primitives handles syntax-agnostic parsing helpers, while wp-lang owns language semantics, WPL-specific AST types, builtins, and runtime behavior.
What It Provides
- WPL AST types such as
WplRule,WplExpress,WplField, andWplPackage - Source parsers for rules, packages, annotations, fields, separators, and functions
- Runtime evaluation through
WplEvaluator - Built-in parsing and transformation pipeline units
- Value parsers for common formats such as JSON, KV, arrays, time, IP, and protocol text
- Precompile helpers for turning parsed rules into executable units
Quick Start
[]
= "0.1"
use Parser;
use wpl_express;
let mut code = "(digit:id, chars:name)";
let expr = wpl_express.parse_next.unwrap;
assert!;
Public API Notes
- The package name is
wp-lang - The Rust library name stays
wpl
This keeps downstream imports concise while exposing a publishable package name.
Design Boundary
wp-primitives: syntax-agnostic parsing primitiveswp-lang: WPL syntax, AST, builtins, runtime evaluation, and generation- Typed data semantics continue to rely on the published
wp-model-core,wp-parse-api, and related crates
Development
Run:
cargo checkcargo testcargo fmt --allcargo clippy --all-targets --all-features -- -D warnings
Benchmarks live under benches/ and use Criterion.
Quick Parse Validation
For quick syntax validation while editing WPL source, or to try one sample payload against a rule, use the bundled wpl-check tool:
|
Use syntax for source-only checks and sample to run one payload through a rule or expression. sample now treats a sample data file as the normal input form; --data is only for quick inline checks. By default, wpl-check looks for rule.wpl and sample.txt, and if you pass a directory it resolves those files inside the directory. If sample receives a package with multiple rules and no --rule-name, it reports the available rule names directly. Successful validation exits with code 0; syntax or data parse failures exit non-zero.
Reusable sample WPL and payload files extracted from tests live under examples/wpl-check/.
Codex Skill
The repository-managed source for the wpl-rule-check Codex skill lives under tools/skills/wpl-rule-check/.
Install or refresh the local skill with:
This copies the skill into ~/.codex/skills/wpl-rule-check/, which is the local runtime location used by Codex. Manage changes, review, and release history from the repository copy; treat ~/.codex/skills/ as an installed artifact.
License
Distributed under the Apache License 2.0. See LICENSE.