I have created the below mentioned grammar for the following DOT code -
digraph G {
main [shape=box; /*this is a comment*/
main -> parse [weight=8];
parse -> execute;
main -> init [style=dotted];
main -> cleanup;
execute -> make_string;
init -> make_string;
main -> printf [style=bold,label= "100 times"];
make_string [label="make a\nstring"];
node [shape=box,style=filled,color=".7 .3 1.0"];
execute -> compare;
}
Grammar:
graph : digraph [ ID ] '{' stmt_list '}'
stmt_list: [ stmt [ ';' ] [ stmt_list ] ]
stmt : node_stmt
| edge_stmt
| attr_stmt /*defines a default attribute*/
| ID '=' ID
attr_stmt: (graph | node | edge) attr_list
attr_list: '[' attr ']' [ attr_list ]
attr : ID '=' ID [','] [attr]
edge_stmt: node_id -> node_id [ attr_list ]
node_stmt: node_id [ attr_list ]
node_id : ID
When I execute my parser code with the above mentioned grammar its not printing the error. I wanted to know if I have defined the correct grammar