A small DSL to generate syntax diagrams
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
src
.gitignore
.travis.yml
Cargo.toml
LICENSE
README.md

README.md

A small DSL to generate syntax diagrams using this library.

Crates.io VersionBuild Status

Some examples

  • {...} is a horizontal stack of connected elements
  • [...] is a vertical sequence of connected elements
  • <...> is a choice of multiple options, exactly one of which has to be picked
  • "foobar" is a terminal
  • 'foobar' is a non-terminal
  • `foobar` is a comment
  • ...? is an optional element
  • ...*... is a repeated element
  • ! is the empty element

Quotes (and backslashes) can be escaped using backslashes.

For example:

{["CONSTRAINT" "name"]?,
 <["PRIMARY" "KEY" <!, "ASC", "DESC"> 'conflict-clause' <!, "AUTOINCREMENT">],
  ["NOT" "NULL" 'conflict-clause'],
  ["UNIQUE" 'conflict-clause'],
  ["CHECK" "(" 'expr' ")"],
  ["DEFAULT" <'signed-number', 'literal-value', ["(" 'expr' ")"]>],
  ["COLLATE" "collation-name"],
  'foreign-key-clause'>}

diagram for constraint syntax