render_regex 0.0.0

SVG visualization of regex DFAs.
Documentation

๐Ÿงฎ render_regex

render_regex is a static SVG rendering tool that visually represents the internal structure of a regular expression using the rusty_regex engine.

It supports visualizing:

  • ๐Ÿ“ Abstract Syntax Trees (AST)
  • ๐Ÿ”€ Non-deterministic Finite Automata (NFA)
  • ๐Ÿ” Deterministic Finite Automata (DFA)

Each visual stage is cleanly drawn as a *.svg and can be styled and laid out flexibly.


๐Ÿ”ง CLI Usage

cargo run -p render_regex -- '' [options]

๐ŸŽฏ Stage Options

You must either specify one stage or render all of them:

  • --stage <dfa|nfa|ast>
    Render one specific stage
  • --all
    Render all stages (ast, nfa, dfa)

๐Ÿ–ผ Layout Options

  • --layout <circle|tree|layeredbfs|forcedirected|radial>

Defaults per stage:
โ€ข AST โ†’ tree
โ€ข NFA โ†’ layeredbfs
โ€ข DFA โ†’ layeredbfs

๐Ÿงพ Output Options

  • --output <filename.svg>
    File to save to (only with --stage)
  • --output-dir <dir>
    Directory for all outputs (default: output/)
  • --slug <text>
    Override sanitized filename slug for regex

๐Ÿคซ Logging / Feedback

  • --quiet
    Suppress standard logging
  • --print-paths
    Always print resolved output paths (even in quiet mode)

๐Ÿงช Examples

All stages with default layout

cargo run -p render_regex -- 'a(b|c)*d'

DFA only with a specific layout

cargo run -p render_regex -- 'a(b|c)*d' --stage dfa --layout layeredbfs

Save to a specific file path

cargo run -p render_regex -- 'xyz' --stage ast --output diagram.svg

Specify target output directory

cargo run -p render_regex -- 'abc*' --all --output-dir ./my_diagrams

Slug override for filename

cargo run -p render_regex -- 'a(b|c)*d' --slug myregex

Quiet mode but show file paths

cargo run -p render_regex -- 'a(b|c)*d' --quiet --print-paths