OxDock Parser
oxdock-parser builds the executable steps for the OxDock DSL that powers the
CLI and the embedding macros. The DSL is intentionally compact, but it now has
an explicit grammar so that other tooling (formatters, language servers, IDE
plugins, etc.) can understand scripts without re‑implementing the parser.
Language definition
The grammar lives in src/dsl.pest and is consumed directly by
the lexer. A copy of the grammar is also exposed at runtime via the
oxdock_parser::LANGUAGE_SPEC constant so that downstream tools can embed or
inspect the canonical definition without reaching into the crate filesystem.
use oxdock_parser::LANGUAGE_SPEC;
fn dump_grammar() {
println!("OxDock DSL grammar:\\n{}", LANGUAGE_SPEC);
}
Because the parser is generated from this same file, the “spec” and the implementation stay in lockstep—the language is exactly what the grammar describes.
Architecture overview
- The lexer (powered by
pest) tokenizes scripts according todsl.pest, handling comments and semicolons along the way. - Tokens are fed into the existing
ScriptParser, which performs guard stack combination, scope tracking, andStepKindconstruction (no language behaviour changed from the previous hand-written line parser). - The resulting
Vec<Step>is consumed by runtimes (CLI, macros, tests, etc.).
All existing semantics—including guard combinations, case sensitivity, semicolon behaviour, and error messages—remain the same, but they are now enforced through the shared grammar file.