This section presents the grammar of GDL (Graph Description Language) in EBNF (Extended Bacchus Naur Form).
graph : ``graph: {'' (graph_entry)* ``}''
graph_entry : graph_attribute
| graph
| node
| edge
| node_defaults
| edge_defaults
| foldnode_defaults
| foldedge_defaults
| backedge
| nearedge
| lnearedge
| rnearedge
| bentnearedge
| lbentnearedge
| rbentnearedge
| region
graph_attribute : graph_attribute_name ``:'' attribute_value
graph_attribute_name : any attribute listed in section graph attributes
node_defaults : ``node.''node_attribute
edge_defaults : ``edge.''edge_attribute
foldnode_defaults : ``foldnode.''node_attribute
foldedge_defaults : ``foldedge.''edge_attribute
node : ``node: {'' (node_attribute)* ``}''
edge : ``edge: {'' (edge_attribute)* ``}''
backedge : ``backedge: {'' (edge_attribute)* ``}''
nearedge : ``nearedge: {'' (edge_attribute)* ``}''
lnearedge : ``leftnearedge: {'' (edge_attribute)* ``}''
rnearedge : ``rightnearedge: {'' (edge_attribute)* ``}''
bentnearedge : ``bentnearedge: {'' (edge_attribute)* ``}''
lbentnearedge : ``leftbentnearedge: {'' (edge_attribute)* ``}''
rbentnearedge : ``rightbentnearedge: {'' (edge_attribute)* ``}''
region : ``region: {'' (region_attribute)* ``}''
node_attribute : node_attribute_name ``:'' attribute_value
edge_attribute : edge_attribute_name ``:'' attribute_value
region_attribute : ``sourcename'' ``:'' string_list
| ``targetname'' ``:'' string_list
| ``state'' ``:'' enum_status
| ``class'' ``:'' integer_list
| ``range'' ``:'' integer_value
node_attribute_name : any attribute listed in section node attributes
edge_attribute_name : any attribute listed in section edge attributes
attribute_value : integer_value
| float_value
| string_value
| enum_value
integer_list : (integer_value)*
integer_value : any integer constant in C style
float_value : any float constant in C style
string_list : (string_value)*
string_value : ``"'' (character)* ``"''
enum_value : any possible key word value for a graph, node or edge attribute
enum_status : any possible key word value for the graph attribute state
character : any printable ASCII character
Note that graph:, node: and edge:, etc. are keywords. Therefore, no whitespace 4 character is allowed before these colons.
Integers are sequences of digits. Floating point numbers consist of a sequence of digits followed by a dot `.', followed by a sequence of digits. C style comments (/* ... */) and C++ style comments (//...) are allowed.