Skip to content

The DOT Language Notes

Corrina Del Greco edited this page Nov 30, 2020 · 3 revisions

To develop a parser, a good knowledge of the DOT language is needed. The following grammar is used in .dot files to describe connections.

Terminals are shown in bold font and nonterminals in italics. Literal characters are given in single quotes. Parentheses ( and ) indicate grouping when needed. Square brackets [ and ] enclose optional items. Vertical bars | separate alternatives.

  • graph : [ strict ] (graph | digraph) [ ID ] '{' stmt_list '}'
  • stmt_list : [ stmt [ ';' ] stmt_list ]
  • stmt : node_stmt | edge_stmt | attr_stmt | ID '=' ID | subgraph
  • attr_stmt : (graph | node | edge) attr_list
  • attr_list : '[' [ a_list ] ']' [ attr_list ]
  • a_list : ID '=' ID [ (';' | ',') ] [ a_list ]
  • edge_stmt : (node_id | subgraph) edgeRHS [ attr_list ]
  • edgeRHS : edgeop (node_id | subgraph) [ edgeRHS ]
  • node_stmt : node_id [ attr_list ]
  • node_id : ID [ port ]
  • port : ':' ID [ ':' compass_pt ] | ':' compass_pt
  • subgraph : [ subgraph [ ID ] ] '{' stmt_list '}'
  • compass_pt : (n | ne | e | se | s | sw | w | nw | c | _)

Clone this wiki locally