%start List %title "A simple comma separated list of integers" %comment "A trailing comma is allowed." %% /* 0 */ List: ListOpt /* Option */; /* 1 */ ListOpt /* `Option::Some` */ : Num ListRest ListOpt0 /* Option */; /* 2 */ ListOpt0 /* `Option::Some` */ : ","; /* 3 */ ListOpt0 /* `Option::None` */ : ; /* 4 */ ListOpt /* `Option::None` */ : ; /* 5 */ ListRest : ListRestOpt /* Option */; /* 6 */ ListRestOpt /* `Option::Some` */ : "," Num ListRest; /* 7 */ ListRestOpt /* `Option::None` */ : ; /* 8 */ Num : "0|[1-9][0-9]*";