The grammar is ambiguous

Hi,

The documented grammar (http://www.graphviz.org/doc/info/lang.html) is ambiguous:

stmt_list : [ stmt [ ';' ] [ stmt_list ] ]

it says that stmt_list is optional (as, as a whole, its definition is in square bracket), and it includes an optional stmt_list (as the stmt_list in the rhs is in square bracket too).

This means that stmt_list can match a single stmt in two ways:
- with an empty [stmt_list]
- with a non-empty [stmt_list] that contains an empty stmt_list.

The fix is simple: the stmt_list in the rhs is not optional:

stmt_list : [ stmt [ ';' ] stmt_list ]

Thanks.

Thanks.

Thanks.

Recent comments