oxdock-parser

Crates.iooxdock-parser
lib.rsoxdock-parser
version0.6.0-alpha
created_at2025-12-18 21:46:46.302829+00
updated_at2025-12-25 17:46:04.927136+00
descriptionParser and AST definitions for the OxDock DSL.
homepage
repositoryhttps://github.com/jzombie/oxdock-rs
max_upload_size
id1993601
size122,779
Jeremy Harris (jzombie)

documentation

README

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

  1. The lexer (powered by pest) tokenizes scripts according to dsl.pest, handling comments and semicolons along the way.
  2. Tokens are fed into the existing ScriptParser, which performs guard stack combination, scope tracking, and StepKind construction (no language behaviour changed from the previous hand-written line parser).
  3. 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.

Commit count: 0

cargo fmt